Originate an outbound leg
Originate a new outbound leg. The type field selects the transport: sip originates a SIP INVITE; whatsapp originates a WhatsApp call through Meta; websocket dials a remote WebSocket endpoint (audio is PCM in either binary or json_base64 framing, with bidirectional text and caller-supplied X-/P- headers).
Request body
Leg type
Destination. For sip legs, a SIP URI (e.g. "sip:alice@example.com"). For whatsapp legs, an E.164 phone number (with or without '+').
Deprecated alias for to (sip legs only). Prefer to.
Caller ID. A bare user-part (e.g. "+15551234567", "alice") sets the user of the SIP From header. A full SIP URI (e.g. "sip:alice@pbx.example.com") sets both the user and the host; otherwise the host comes from the matched trunk's AOR realm, falling back to SIP_DOMAIN.
SIP Privacy header value (e.g. "id", "none")
Seconds to wait for answer; 0 = no timeout
Maximum call duration in seconds after connect. Automatically hung up when reached. 0 or omitted = no limit.
Codec preference order (sip legs only)
Custom headers to include in the outbound INVITE (sip/whatsapp) or the WebSocket upgrade request (websocket)
Room ID to auto-add the leg to once media is ready (early_media or connected). If the room does not exist, it is automatically created.
Route all events for this leg exclusively to this URL instead of global webhooks.
HMAC-SHA256 signing secret for the per-leg webhook.
If false, this leg will not receive DTMF digits broadcast from other legs in the same room. Defaults to true.
Application identifier. Carried through to all events for this leg. Use to filter the WebSocket event stream by app.
If true, emit speaking.started and speaking.stopped events for this leg. If false, suppress them. Omit to use the server default (SPEECH_DETECTION_ENABLED env var, default false).
For sip legs: offer Real-Time Text (ITU-T T.140 over RTP per RFC 4103) alongside audio. For websocket legs: enable the bidirectional text-message channel. Default: false.
WebSocket target URL (ws:// or wss://) for outbound websocket legs. Required when type=websocket.
PCM sample rate for websocket legs. The room's mixer automatically resamples between this and the room rate.
Audio framing for websocket legs. binary ships raw PCM as WebSocket binary frames; json_base64 wraps PCM as {"type":"audio","audio":"<base64>"} text frames (browser-friendly).
On-the-wire PCM sample encoding for websocket legs. v1 only supports s16le.
Response
Leg created
Instance identifier
Unique leg identifier (UUID)
Leg type
Leg state
Room ID if the leg is in a room, empty otherwise
Whether the leg is muted (cannot be heard by others)
Whether the leg is deaf (cannot hear others)
Whether the leg receives DTMF digits broadcast from other legs in the same room. Defaults to true.
Whether the call is on hold (SIP legs only)
Routing role used by the room's audio routing matrix (e.g. "customer", "agent", "supervisor"). Empty string means unroled (full mesh).
Application identifier for event stream filtering.
Deprecated: X-* headers from the inbound INVITE. Only present on sip_inbound legs. Use headers for new code; it carries the same map plus surfaces handshake headers for websocket legs.
Custom protocol headers exposed by the leg's transport — X-/P- headers from a SIP INVITE, the WebSocket upgrade request, or supplied at outbound dial time.