RelayActions

PlayAction

View as MarkdownOpen in Claude

Returned from call.play(). Tracks an active audio playback operation. Terminal states: finished, error.

Inherits all properties and methods from the base Action interface (control_id, is_done, completed, result, wait()).

Properties

No additional properties beyond the base Action interface.

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(
[{"type": "audio", "params": {"url": "https://example.com/hold-music.mp3"}}],
volume=-5.0,
loop=0,
)
# Pause and resume playback
await action.pause()
await action.resume()
# Adjust volume
await action.volume(10.0)
# Stop playback
await action.stop()
client.run()