
Prerequisites: Understanding of SIP telephony or your contact center’s routing setup. UI-based handoff configuration (adding destinations, setting SIP headers) does not require code. The
transfer_call function path requires Python — see the comparison table below. You can also find this page in the Developer tab.Use Call Handoffs (UI-based) when you have fixed transfer destinations with straightforward routing. Use
transfer_call (code-based) instead when you need dynamic routing logic, custom SIP headers, or integrations like Zendesk. See the comparison table below for details.Related handoff documentation
- Handoff actions in Managed Topics - Add handoff triggers to Knowledge topics
- Handoff States API guide - Monitor transitions between automated and live agents
- Handoff API reference - Retrieve handoff context for downstream systems
Adding a handoff destination
To create a new handoff destination:- Go to Build > Call handoffs in the sidebar.
- Click Add Handoff.
- Fill in the following details:
- Name: Enter a descriptive name (e.g., “Front desk”).
- Description: Add a note about when to use this handoff (e.g., “When the user needs to speak with an operator”).
- Method: Choose the SIP method to use for call routing. Options include:
- SIP REFER (default) – PolyAI specifies a transfer destination to the client (SBC), then drops from the call.
- SIP INVITE – PolyAI creates a new call with the destination and acts as a bridge between the client SBC and the destination.
- SIP BYE – PolyAI signals that its call leg is over, allowing the client SBC to take the call back over.
- Route: Specify the destination SIP URI or extension (only applies to SIP INVITE and SIP REFER).
- SIP headers: Add optional SIP headers to include metadata or routing instructions.
- Click Add to save the destination.

Configuring SIP headers
SIP headers can be used to send additional metadata when making a handoff. To add SIP headers:- Click Add SIP Header in the handoff setup modal.
-
Enter a Header Name (e.g.,
X-Customer-ID).- Custom headers should start with an
X-prefix.
- Custom headers should start with an
-
Enter a Value (e.g.,
abc123). -
You can use variables prefixed with
$in the SIP header values for dynamic data. Example:X-Caller-ID: $caller_id - Repeat as needed for multiple headers.
Default handoff
One handoff destination can be marked as the default. This is the fallback destination used when no specific routing matches — for example, when the caller requests a transfer but no topic or flow step maps to a specific handoff.- The first handoff you create is automatically set as the default.
- To change the default, open the actions menu on a handoff card and select Set as default.
- If the default handoff is deleted, you should assign a new default to avoid unrouted transfers.
Managing handoffs
Once a handoff destination is created, it will appear in the list of destinations. From the actions menu on each card, you can:- Edit — modify the name, description, method, route, or SIP headers
- Duplicate — create a copy of an existing handoff for a similar destination
- Delete — remove the handoff (requires typing the name to confirm)
- Set as default — mark as the fallback handoff destination
Encryption options
When using SIP INVITE, you can choose the transport encryption:| Option | Description |
|---|---|
| TLS/SRTP (default) | Encrypted transport. Use this unless your destination requires unencrypted traffic. |
| UDP/RTP | Unencrypted transport. Some legacy systems require this. |
Integration-level constraints
Your telephony integration (e.g. Twilio, SIP trunk) may impose constraints on handoff configuration. When constraints are active:- The SIP method dropdown may be locked to a specific method (e.g. all handoffs must use SIP REFER)
- The route/phone number field may be hidden if routing is handled by the carrier
- The SIP headers section may be hidden if the integration does not support custom headers
Best practices for call handoffs
- Use clear descriptions — label handoffs with their intended use (e.g. “Billing disputes” not “Team A”)
- Always have a default — ensure one handoff is marked as default so unmatched transfers have a destination
- Test in sandbox — verify handoff destinations route correctly before promoting to Live
- Use SIP headers for context — pass metadata like
X-Customer-IDorX-Reasonso the receiving system can route or display caller context
Handoff reason and utterance
Handoff reason and utterance
Handoff reason and utterance
The built-in handoff template and the
Where it shows up
conv.call_handoff() helper accept two optional, structured fields:| Field | Purpose | Example |
|---|---|---|
reason | Machine-readable code explaining why the call is being escalated (e.g. policy_violation, needs_human, no_availability). Surfaces in Conversation Review and the Conversations API. | policy_violation |
utterance | A short message the agent delivers before transfer begins (spoken for voice, displayed for webchat). Logged alongside the handoff for QA review. | ”Let me transfer you to a specialist who can help.” |
- Flows & KB actions – Selecting builtin-handoff displays Reason and Pre-handoff utterance fields.
- Functions – Call
conv.call_handoff(destination="...", reason="...", utterance="...")to escalate programmatically. - Conversation Review – Both fields appear in the metadata panel for quick troubleshooting.
- Conversations API – Returned inside the
handoffobject for BI dashboards or CRM routing.
- Removes guesswork when diagnosing handoffs — no more relying on LLM summaries alone.
- Enables fine-grained routing rules in telephony or CRM systems.
- Gives QA teams full visibility into the exact wording customers heard.
Using your own Twilio number
If you’re bringing your own Twilio phone number to route calls, follow these steps to integrate it as a handoff destination:-
Connect your Twilio account:
- Ensure your Twilio account is set up and you have the necessary credentials (Account SID, Auth Token).
- Go to Configure > Numbers in the Agent Studio.
- Enter your Twilio credentials to connect your account securely.
-
Assign a Twilio number:
- Choose a number from your Twilio account to use for routing calls.
- If necessary, provision new numbers directly using the Twilio console.
-
Set up routing in Twilio:
- Configure your Twilio number to route calls to your PolyAI agent by setting the Webhook URL in your Twilio console. Example:
- Voice Webhook URL:
https://your-polyai-instance-url/voice/call
- Voice Webhook URL:
- Make sure your webhook supports POST requests and uses the correct authentication methods.
- Configure your Twilio number to route calls to your PolyAI agent by setting the Webhook URL in your Twilio console. Example:
-
Add the Twilio number as a handoff destination:
- In the Call Handoffs section, use the Twilio number as the “Extension / Number” field when creating a new destination.
- Add a description specifying its purpose (e.g., “Route to Twilio-based live agent team”).
If you are using a US-based Twilio number for SMS, you must register for A2P 10DLC to comply with regulatory requirements. See the Twilio handoff guide for more details on Twilio-specific configuration.
Comparison: Call Handoff and the transfer_call function
These two methods serve similar purposes — routing the user to another endpoint — but are mutually exclusive and differ in flexibility and implementation.In the table below, means the feature is supported and — means it is not supported.| Feature | Call Handoff (UI-based) | transfer_call (code-based) |
|---|---|---|
| Ease of setup | UI form | — Requires Python editing |
| Works in flow builder | ||
| Works in Function Editor | — | |
| Dynamic routing logic | — | Full control |
| Supports custom metrics | — | |
| Supports soft-handoff | — | |
| Best for static SIP integration | — | |
| Best for dynamic integrations | — | (e.g. Zendesk) |
transfer_call with conv.write_metric() if you need handoff reason codes for analytics.When to use each method
UseCall Handoff if:- You want a quick setup through Agent Studio with minimal code.
- Your routing needs are straightforward and based on static values.
transfer_call if:- You need to pass dynamic SIP headers (e.g., customer metadata).
- You want to use soft handoffs or log custom handoff metrics.
- You’re integrating with a platform that does not support SIP REFER (e.g. Zendesk).
Need code-based routing? There is a
transfer_call Python function for dynamic handoff logic, custom SIP headers, and integrations like Zendesk. Switch to Full docs in the top navigation to compare both methods.Related pages
Handoff States API
Monitor transitions between automated and live agents.
Handoff API reference
Retrieve handoff context programmatically.
Twilio handoff
Twilio-specific handoff configuration.

