RelayCall

play_silence

View as MarkdownOpen in Claude

Play silence for duration seconds. A typed convenience over play() that builds the {"type": "silence", "params": {"duration": ...}} media item for you.

Parameters

duration
floatRequired

Seconds of silence to play.

on_completed
Callable[[RelayEvent], Any] | NoneDefaults to None

Callback invoked when the operation reaches a terminal state. Can be a regular function or async coroutine. Keyword-only.

Returns

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

Example

from signalwire.relay import RelayClient
client = RelayClient(
project="your-project-id",
token="your-api-token",
contexts=["default"],
)
@client.on_call
async def handle_call(call):
await call.answer()
await (await call.play_tts("One moment.")).wait()
await (await call.play_silence(2)).wait()
client.run()