RelayCall

play_ringtone

View as MarkdownOpen in Claude

Play a named ringtone by country code. A typed convenience over play() that builds the {"type": "ringtone", "params": {...}} media item for you.

Parameters

name
strRequired

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

duration
float | NoneDefaults to None

Seconds to play the ringtone. Keyword-only.

volume
float | NoneDefaults to None

Volume adjustment in dB, from -40.0 to 40.0. Keyword-only.

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()
action = await call.play_ringtone("us", duration=10)
await action.wait()
client.run()