Skip to content

Call Flows

A Call Flow is the JSON your server returns when Teler asks what to do on a call. Teler POSTs a request to your flow URL with call metadata; you respond with a flow describing one action: stream, play, or hangup.

For incoming calls Teler hits the Incoming Call URL on the Voice App. For outgoing calls Teler hits the flow_url you passed to calls.create().

Teler’s request to your flow endpoint:

POST /flow
Content-Type: application/json
{
"call_id": "<uuid>",
"account_id": "<uuid>",
"from_number": "+91XXXXXXXXXX",
"to_number": "+91XXXXXXXXXX",
"direction": "inbound"
}
FieldTypeDescription
call_idUUIDUnique ID for this call. Use it to correlate with webhooks.
account_idUUIDYour Teler account.
from_numberstring (E.164)Calling party.
to_numberstring (E.164)Called party.
directionenum"inbound" or "outbound".

Your endpoint must respond within 5 seconds with 200 OK and a Call Flow body.

The request shape above is the same on both webhook versions (2025-08-01 and 2026-06-01). It is the response below whose available actions depend on the version.

A Call Flow body is a single JSON object with an action field. Teler executes exactly one action per flow request. Availability by webhook version:

Action2025-08-012026-06-01
streamYesYes
playYesYes
hangupYesYes
dialNoYes
say

say is defined in the flow schema but is not yet implemented at runtime; returning it currently fails the call. See API versioning to change the pin on your Voice App or SIP Trunk.

The flow endpoint accepts a single JSON object (one action). Arrays of actions are rejected.

Open a bidirectional WebSocket carrying real-time call audio.

FieldTypeRequiredDefaultConstraints
actionstringyesnoneMust be "stream".
ws_urlstringyesnoneSecure WebSocket URL (wss://).
chunk_sizeintegerno400Audio chunk size in milliseconds. Range: 20 to 2000, and must be divisible by 20.
sample_rateenumno"8k""8k" or "16k".
{
"action": "stream",
"ws_url": "wss://yourdomain.com/media-stream",
"chunk_size": 1000,
"sample_rate": "16k"
}

See Media Streaming for the WebSocket protocol Teler uses on this connection.

Play an audio file into the call, then end.

FieldTypeRequiredConstraints
actionstringyesMust be "play".
media_urlstringyesPublicly reachable HTTPS URL serving an MP3 or WAV file.
{
"action": "play",
"media_url": "https://example.com/media-file.mp3"
}

End the call immediately.

FieldTypeRequiredConstraints
actionstringyesMust be "hangup".
{
"action": "hangup"
}

Originate an outbound leg and bridge it into the current call. Available only on webhook version 2026-06-01. Full schema and examples: dial.

{
"action": "dial",
"to": "+14155550123"
}
ConstraintValue
Status code200 OK
Content-Typeapplication/json
Response time≤ 5 seconds
BodySingle JSON object with one action

If your endpoint times out, returns a non-2xx, or returns invalid JSON, the call ends and a call.failed webhook is delivered.