media

View as Markdown

Direction: both. The same frame type carries caller audio to you and your agent’s audio back; each direction uses its configured format (see Audio formats).

Dial → your server (caller audio)

Sent continuously for the life of the call — including silence — in your inbound format, ~20 ms per frame.

FieldTypeDescription
typestringAlways "media".
payloadstringBase64-encoded audio bytes in the inbound format.
seqnumberFrame counter from 1, incremented per frame on this connection. Gaps after a reconnect are expected — audio during the gap is dropped, never replayed.
1{ "type": "media", "payload": "fn5+fn5+fn5+…", "seq": 412 }

Your server → Dial (agent audio)

Send whenever your agent should speak. Chunk size is up to you — Dial buffers and paces playback to the caller. Everything you send queues in order; use clear to flush the queue on barge-in and mark to learn when playback reaches a checkpoint.

FieldTypeDescription
typestringAlways "media".
payloadstringBase64-encoded audio bytes in the outbound format.
1{ "type": "media", "payload": "UklGRiQAAABXQVZF…" }