Single Media Streams WebSocket session. All frames are JSON-encoded text
frames carrying an `event` discriminator. The session begins with
`connected`, then `start`, followed by a continuous stream of `media`
frames and optional `dtmf` / `mark` frames, terminated by `stop`.
In bidirectional mode (``), the customer server may
additionally send `media`, `mark`, and `clear` frames b
Frames sent FROM the customer server TO Twilio. Only valid in
bidirectional Media Streams (``).
subscribe
receiveFromTwilio
Frames sent FROM Twilio TO the customer server.
Messages
outboundMedia
Base64-encoded mulaw/8000 audio sent from the customer server to Twilio
for playback on the call. Bidirectional Media Streams only.
Content-Type: application/json
outboundMark
Sent after one or more outbound `media` frames. Twilio will echo the
mark back to the customer with the same `mark.name` once the preceding
audio has finished playing. Bidirectional Media Streams only
Content-Type: application/json
clear
Interrupts and discards any audio that Twilio has buffered for
playback. Bidirectional Media Streams only.
Content-Type: application/json
connected
First frame sent by Twilio when the WebSocket opens.
Content-Type: application/json
start
Sent once at stream initiation with stream metadata.
Sent when a DTMF digit is detected on the inbound track. Bidirectional
Media Streams only.
Content-Type: application/json
mark
Echoed back to the customer server when a previously sent outbound
audio buffer with a matching `mark.name` has finished playing.
Bidirectional Media Streams only.
Content-Type: application/json
stop
Sent once when the stream terminates.
Content-Type: application/json
About AsyncAPI
The AsyncAPI specification describes event-driven APIs the way OpenAPI describes request/response APIs. A channel is the named pipe — a webhook URL, a Kafka topic, a WebSocket route, an MQTT subject — that producers and consumers publish or subscribe to. Each channel carries one or more messages with structured payloads, and an operation declares whether a given party sends or receives on that channel.
Discovery needs no key. Ratings and market analysis are Pro.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. See our Privacy Policy and
Terms.