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, hangup or dial.

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

Teler’s request to your flow endpoint:

POST /flow
Content-Type: application/json

The field set is identical on both webhook versions, but the call_id and account_id formats depend on the pin of the owning Voice App / SIP Trunk. Parse them accordingly.

{
"call_id": "cs_01H...",
"account_id": "acc_01H...",
"from_number": "+91XXXXXXXXXX",
"to_number": "+91XXXXXXXXXX",
"direction": "inbound"
}

call_id and account_id are prefixed, resource-typed IDs (cs_…, acc_…). The call_id here matches the call_id in 2026-06-01 webhooks for the same call.

FieldTypeDescription
call_idUUID (2025-08-01) / prefixed ID cs_… (2026-06-01)Unique ID for this call. Use it to correlate with webhooks — the format matches the webhooks fired on the same pin.
account_idUUID (2025-08-01) / prefixed ID acc_… (2026-06-01)Your Teler account.
from_numberstring (E.164)Calling party.
to_numberstring (E.164)Called party.
directionenum"inbound" or "outbound" (same values on both versions).

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

The call_id and account_id formats above depend on the webhook version pinned to the owning resource; see API versioning for the full identifier scheme. The response below also depends on the version — its available actions differ.

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

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
actionstringyesmust be providedMust be "stream".
ws_urlstringyesmust be providedSecure 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.

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.