hold

View as MarkdownOpen in Claude

Put the call on hold. The remote party hears hold music or silence while the call is held.

Use unhold() to release the call from hold.

This method emits calling.call.hold events. See Call Events for payload details.

Parameters

None.

Returns

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

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 await call.play([{ type: 'tts', text: 'Please hold while I look that up.' }]);
12
13 const result = await call.hold();
14 console.log(`Hold started: ${JSON.stringify(result)}`);
15
16 // Do some processing...
17 await new Promise((resolve) => setTimeout(resolve, 5000));
18
19 // Take the call off hold
20 await call.unhold();
21});
22
23await client.run();