playRingtone

View as MarkdownOpen in Claude

Play a named ringtone on the call. A typed convenience over play().

Parameters

name
stringRequired

Ringtone name, a country code such as "us" or "gb".

options
object

Playback options.

options.duration
number

Seconds to play the ringtone.

options.volume
number

Volume adjustment in dB, from -40 to 40.

options.onCompleted
(event: RelayEvent) => void | Promise<void>

Callback invoked when the operation reaches a terminal state.

Returns

Promise<PlayAction> — An action handle with stop(), pause(), resume(), volume(), and wait() methods.

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.playRingtone('us', { duration: 10 });
await action.wait();
});
await client.run();