transfer

View as MarkdownOpen in Claude

Transfer control of the call to another Relay application or SWML script. The current application loses control of the call after a successful transfer.

Parameters

dest
stringRequired

The transfer destination. This can be a Relay context name or a URL pointing to a SWML script.

Returns

Promise<Record<string, unknown>> — Server response confirming the transfer.

Example

import { RelayClient } from '@signalwire/sdk';
const client = new RelayClient({
project: process.env.SIGNALWIRE_PROJECT_ID!,
token: process.env.SIGNALWIRE_API_TOKEN!,
contexts: ['default']
});
client.onCall(async (call) => {
await call.answer();
const action = await call.play([{ type: 'tts', text: 'Transferring you now...' }]);
await action.wait();
const result = await call.transfer('support-queue');
console.log(`Transfer result: ${JSON.stringify(result)}`);
});
await client.run();