Configure call transfers
Summary
This guide configures named destinations for the built-in transfer tool and confirms any carrier setup needed to use them. It also publishes the policy and reads transfer outcomes. It does not configure SIP trunks; see Connect a SIP trunk.
Facts
Steps
Set CONNECTION_ID to a connection’s id from listTelephonyConnections.
Set AGENT_ID to an agent’s id from listAgents or createAgent.
Set CALL_ID to a call’s id from listCalls after the published agent handles a call.
1. Read the connection’s transfer requirements
Read transfer.open, mechanism, setup_required, setup_confirmed and setup_action.
If setup_required is true, complete the step described by setup_action in your carrier’s dashboard.
For Exotel, this means the flow applets after the Voicebot applet.
Set CONNECTION_ETAG to the connection’s returned revision; the connection response has no ETag header.
2. Confirm the carrier’s transfer flow when required
Skip this request when setup_required is false: a carrier needing no setup step returns invalid_request.
This records confirmation without calling the carrier.
Send confirmed: false to withdraw it after reading the connection again.
Calls on this connection’s numbers offer transfer only after required setup is confirmed.
3. Read the agent draft
Set DRAFT_ETAG to this draft’s ETag header before editing.
It is a different token from CONNECTION_ETAG; do not send one resource’s token to the other.
4. Enable a named destination
Replace the illustrative phone number with a number you control. This sample replaces the entire destination list with one E.164 destination.
Keep the server-generated destination id when editing that destination; omit id to add a new one.
The model sees id, label and when_to_use, but never the target.
The optional handoff_message is spoken before transfer; null uses the default text.
Set DRAFT_ETAG to the updated draft’s ETag header before publication.
5. Publish the policy
Ensure the rest of the draft is ready before publishing; publication freezes the complete draft configuration.
New calls use the published policy; running calls keep their original version. At call time, the carrier and region determine which destinations the transfer tool can offer. A destination that the call cannot use is omitted from the tool.
Rules
- MUST supply at least one destination when transfer is enabled.
- MUST preserve each existing destination’s
idwhen editing it. - MUST include every destination you want to keep when replacing
destinations. - MUST NOT write
destinationsanddestination_numberin the same body. - MUST NOT confirm carrier setup before completing the carrier’s step.
- MUST publish after changing the draft policy to use it on new calls.
destination_number remains supported for a single E.164 destination.
Writing it alone replaces the list with that destination.
On reads, it is an alias of the first E.164 destination, or null when there is none.
Disabling transfer can retain the destinations for later use.
A trunk_extension target contains trunk_id and a 1 to 8 digit extension.
A sip_uri target contains uri, for example sip:support@pbx.example.com.
These targets require eligible SIP trunk numbers; a SIP URI also requires the global region.
Verify
end_reason says why a call ended.
A call that the agent ended, with its end_call tool or its goodbye, reports agent_hangup.
An answered call whose line failed reports line_dropped, and a call that reached a voicemail reports voicemail_detected.
completed means that the call ended and nothing says who ended it.
Keep an end_reason value you do not know.
Inspect transfer_destination_label after a call ends in a transfer: it has a value only when the call ended transferred or transfer_failed.
It identifies the last destination by label, without exposing its number or address.
transfer_duration_ms is the carrier-reported time connected to the destination.
It is null when no transfer connected or when the time has not been reported.
These fields also appear in call list and search results and in webhook payloads containing a Call.