volume

View as MarkdownOpen in Claude

Adjust the playback volume.

Parameters

volume
numberRequired

Volume adjustment in dB. Range: -40.0 to 40.0.

Returns

Promise<Record<string, unknown>> — Server acknowledgment.

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(
12 [{ type: 'audio', url: 'https://example.com/hold-music.mp3' }],
13 { loop: 0 },
14 );
15
16 // Increase volume
17 await action.volume(10.0);
18
19 // Decrease volume
20 await action.volume(-5.0);
21});
22
23await client.run();