playSilence

View as MarkdownOpen in Claude

Play silence on the call for duration seconds. A typed convenience over play().

Parameters

duration
numberRequired

Seconds of silence.

options
object

Playback options.

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();
await (await call.playTTS('One moment.')).wait();
await (await call.playSilence(2)).wait();
});
await client.run();