call_connected

View as Markdown

Direction: Dial → your server. Sent once per connection, immediately after the socket opens, before any audio. Use it to set up per-call state keyed by call_id — or, when reconnect is true, to restore it and resume streaming.

Schema

FieldTypeDescription
typestringAlways "call_connected".
call_idstringDial’s call identifier — the same value as in the connection path. Stable across reconnects. The only call id you receive.
directionstring"inbound" if someone called your Dial number; "outbound" if the call originated from your account.
fromstringCalling phone number, E.164.
tostringCalled phone number, E.164.
instructionstring | nullThe instruction the call was placed/answered with, if any — useful as your model’s system prompt. null if none was set.
languagestring | nullThe call’s primary language, BCP-47 (e.g. en-US). null if unset.
formatsobjectThe audio formats in effect: { "inbound": <format>, "outbound": <format> } — see Audio formats. inbound is what Dial sends you; outbound is what you must send back.
reconnectbooleanAbsent or false on the first connection of a call; true when Dial re-established a dropped socket mid-call. Restore state instead of initializing.

Example

1{
2 "type": "call_connected",
3 "call_id": "call_01HW3X7P5QF6K2YQ9YJ7Q8R5N3",
4 "direction": "inbound",
5 "from": "+14155550123",
6 "to": "+14155559876",
7 "instruction": "Answer billing questions for Acme Corp.",
8 "language": "en-US",
9 "formats": { "inbound": "mulaw_8000", "outbound": "mulaw_8000" }
10}