Skip to content

WebSocket Messages

All media-stream traffic is JSON over the WebSocket. Two message types flow in (Teler → your bridge) and three flow out (your bridge → Teler).

The first message on every connection. Contains stream metadata. Use it to correlate the WebSocket with a call_id and to check the audio format Teler is using.

{
"type": "start",
"account_id": "<uuid>",
"call_app_id": "<uuid>",
"call_id": "<uuid>",
"stream_id": "<uuid>",
"message_id": 1,
"data": {
"encoding": "audio/l16",
"sample_rate": 8000,
"channels": 1
}
}
FieldTypeDescription
typestringAlways "start".
account_idUUIDYour Teler account ID.
call_app_idUUIDThe Voice App ID this call belongs to.
call_idUUIDThe active call’s ID. Matches call_id in webhooks.
stream_idUUIDThis media stream’s ID. Use it for correlation.
message_idintegerMonotonic per-stream message counter. start is 1.
data.encodingenumCurrently always "audio/l16".
data.sample_rateintegerCurrently always 8000, even when the Stream flow is configured "16k".
data.channelsintegerAlways 1 (mono).

Repeated for the lifetime of the call. Each message carries one chunk of caller audio, base64-encoded.

{
"type": "audio",
"stream_id": "<uuid>",
"message_id": 2,
"data": {
"audio_b64": "<BASE64_ENCODED_AUDIO_CHUNK>"
}
}
FieldTypeDescription
typestringAlways "audio".
stream_idUUIDSame as in the start message.
message_idintegerMonotonic per-stream counter.
data.audio_b64stringBase64-encoded PCM chunk. Decode → 16-bit linear PCM at the negotiated sample rate.

The duration of each chunk equals the chunk_size from your Stream flow (default 400 ms). At 16 kHz mono, that’s chunk_size_ms × 16 × 2 bytes per chunk after decoding.

Queue an audio chunk for playback into the call.

{
"type": "audio",
"audio_b64": "<BASE64_ENCODED_AUDIO_CHUNK>",
"chunk_id": "123"
}
FieldTypeRequiredDescription
typestringyesAlways "audio".
audio_b64stringyesBase64-encoded 16-bit linear PCM at the negotiated sample rate.
chunk_idstringyesYour identifier for this chunk. Used by interrupt. Must be unique per stream.

Stop playback of a specific queued chunk and any chunks queued after it. Use this to implement barge-in when the caller starts speaking over the agent.

{
"type": "interrupt",
"chunk_id": "123"
}
FieldTypeRequiredDescription
typestringyesAlways "interrupt".
chunk_idstringyesThe chunk_id from the outgoing audio message you want to stop.

Drop all queued audio chunks immediately. Use when the conversation context changes (e.g., the model decides to start over).

{
"type": "clear"
}
FieldTypeRequiredDescription
typestringyesAlways "clear".
EventCause
WebSocket opensTeler connects to your ws_url after a stream Call Flow.
First message inTeler sends start.
Connection close (clean)Caller hangs up, or Teler sends final audio and closes. A stream.completed webhook fires.
Connection close (error)Network failure or your bridge closes. Teler tears down the stream connection. A call.failed webhook may follow only if the underlying call itself fails.