RelayCall

prompt_audio

View as MarkdownOpen in Claude

Play an audio file as a prompt and collect input. A typed convenience over play_and_collect() that builds the audio media item for you.

Parameters

url
strRequired

URL of the audio file to play as the prompt.

collect
dictRequired

Input collection configuration, in the same format as play_and_collect().

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

CollectAction — An action handle that resolves when input is collected, the operation times out, or an error occurs.

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.prompt_audio(
"https://example.com/menu.mp3",
{"digits": {"max": 1, "digit_timeout": 5}},
)
event = await action.wait()
client.run()