Stream call media over WebSocket
AsyncAPI specification for the Telnyx Media Streaming WebSocket connection.
Media Streaming forks call media and delivers it to a customer-provided WebSocket URL configured through Call Control using stream_url. Telnyx opens the WebSocket connection, sends lifecycle and media frames, and can receive bidirectional media playback commands from the connected application.
Connection Flow
- Start media streaming with a Call Control command and provide
stream_url. - Telnyx opens a WebSocket connection to the configured
stream_url. - Telnyx sends a
connectedframe, followed by astartframe that identifies the call and media format. - Telnyx sends
mediaframes with base64-encoded RTP payloads for the requested track or tracks. - If bidirectional streaming is enabled, the connected application can send
media,mark, andclearframes back to Telnyx. - Telnyx sends
dtmf,mark,error, andstopframes as applicable.
Bidirectional Media
Bidirectional streaming is enabled through Call Control by setting stream_bidirectional_mode to rtp for RTP payloads, or by sending base64-encoded MP3 media frames for media-file playback. RTP media chunks sent back to Telnyx can contain 20 milliseconds to 30 seconds of audio. MP3 media frames are queued and played in submission order, with a one-message-per-second rate limit.
Ordering
Media frame order is not guaranteed. Use media.chunk, media.timestamp, and sequence_number to order frames when required.
Documentation Index
Fetch the complete documentation index at: https://developers.telnyx.com/llms.txt
Use this file to discover all available pages before exploring further.