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

1from signalwire.relay import RelayClient
2
3client = RelayClient(
4 project="your-project-id",
5 token="your-api-token",
6 host="your-space.signalwire.com",
7 contexts=["default"],
8)
9
10@client.on_call
11async def handle_call(call):
12 await call.answer()
13 action = await call.play(
14 [{"type": "audio", "url": "https://example.com/hold-music.mp3"}],
15 volume=-5.0,
16 loop=0,
17 )
18
19 # Pause and resume playback
20 await action.pause()
21 await action.resume()
22
23 # Adjust volume
24 await action.volume(10.0)
25
26 # Stop playback
27 await action.stop()
28
29client.run()