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

1import { RelayClient } from '@signalwire/sdk';
2
3const client = new RelayClient({
4 project: process.env.SIGNALWIRE_PROJECT_ID!,
5 token: process.env.SIGNALWIRE_TOKEN!,
6 contexts: ['default']
7});
8
9client.onCall(async (call) => {
10 await call.answer();
11 const action = await call.play([{ type: 'tts', text: 'Transferring you now...' }]);
12 await action.wait();
13
14 const result = await call.transfer('support-queue');
15 console.log(`Transfer result: ${JSON.stringify(result)}`);
16});
17
18await client.run();