Connect
Overview
The <Connect>
verb is used within a <Dial>
verb to establish a connection between the inbound caller and an outbound destination. This can be a phone number, SIP URI, or client identifier. It allows you to specify timeouts, custom ringback tones, and enables recording of the connected call segment.
Use this verb in scenarios like call forwarding, warm transfers, or routing calls dynamically to an agent or endpoint.
Syntax
<Connect to="destination"
timeout="seconds"
ringback="url"
record="true|false"
recording_url="url" />
Attributes
Attribute | Type | Required | Default | Description |
---|---|---|---|---|
to | string | ✔️ | — | Destination to connect to: E.164 phone number, SIP URI, or client ID. |
timeout | integer | ❌ | 30 | Maximum seconds to wait before giving up on connection. |
ringback | URI | ❌ | — | URL to audio file played while connecting. |
record | boolean | ❌ | false | Whether to record the bridged call. |
recording_url | URI | ❌ | — | Webhook URL for recording metadata POST after the call ends. |
Example
<Response>
<Dial caller="18005551234">
<Connect to="sip:alice@example.com"
timeout="25"
ringback="https://example.com/audio/ring.mp3"
record="true"
recording_url="https://example.com/api/recordings" />
</Dial>
</Response>
Behavior
- Bridges the inbound call with the specified
to
destination. - Ringback audio plays to the caller while dialing (if provided).
- If the destination answers, the call is bridged.
- If
record="true"
, Telnyx begins recording the connected segment, and posts metadata to therecording_url
after the call ends. - If the connection times out or fails, TeXML will continue processing within
<Dial>
(e.g., another<Connect>
verb or fallback<Say>
/<Hangup>
). - Can be used multiple times in
<Dial>
for sequential attempts (hunt group behavior).
Error handling
- If
to
is invalid or unreachable, the call fails over to the next verb in<Dial>
. - If
record="true"
is set butrecording_url
is missing, the call proceeds but no metadata is delivered. - If
ringback
is unreachable or malformed, no tone is played, but the call continues.
Notes
- Can only be used inside
<Dial>
. - Recording behavior is subject to applicable laws and regional consent regulations.