Call Transfer
Call Transfer
Transfer calls to other destinations using connect() for phone numbers/SIP and swml_transfer() for SWML endpoints. Support for both permanent and temporary transfers.
Call transfer is essential for agents that need to escalate to humans, route to specialized departments, or hand off to other AI agents. The SDK provides multiple transfer mechanisms, each suited to different scenarios.
Understanding the difference between these methods—and when to use each—helps you build agents that route calls efficiently while maintaining a good caller experience.
Choosing a Transfer Method
The SDK offers several ways to transfer calls. Here’s how to choose:
Use connect() when:
- Transferring to a phone number (human agents, call centers)
- Connecting to SIP endpoints on your PBX
- You need caller ID control on the outbound leg
Use swml_transfer() when:
- Handing off to another AI agent
- The destination is a SWML endpoint
- You want the call to continue with different agent logic
Use sip_refer() when:
- Your infrastructure uses SIP REFER for transfers
- Integrating with traditional telephony systems that expect REFER
Transfer Types
Permanent Transfer (final=True)
- Call exits the agent completely
- Caller connected directly to destination
- Agent conversation ends
- Use for: Handoff to human, transfer to another system
Temporary Transfer (final=False)
- Call returns to agent when far end hangs up
- Agent can continue conversation after transfer
- Use for: Conferencing, brief consultations
Basic Phone Transfer
Connect Method Parameters
Permanent vs Temporary Transfer
SIP Transfer
Transfer to SIP endpoints:
Transfer with Caller ID Override
SWML Transfer
Transfer to another SWML endpoint (another agent):
Transfer Flow

Department Transfer Example
Sending SMS During Transfer
Notify the user via SMS before transfer:
Post-Process Transfer
Use post_process=True to have the AI speak before executing the transfer:
Warm vs Cold Transfers
Understanding the difference between warm and cold transfers helps you design better caller experiences.
Cold Transfer (Blind Transfer)
The caller is connected to the destination without any preparation. The destination answers not knowing who’s calling or why.
When to use cold transfers:
- High-volume call centers where speed matters
- After-hours routing to voicemail
- Simple department routing where context isn’t needed
- When the destination has caller ID and can look up the caller
Warm Transfer (Announced Transfer)
The agent announces the transfer and potentially provides context before connecting. In traditional telephony, this means speaking to the destination first. With AI agents, this typically means:
- Informing the caller about the transfer
- Optionally sending context to the destination
- Then executing the transfer
When to use warm transfers:
- Escalations where context improves resolution
- VIP callers who expect personalized service
- Complex issues that need explanation
- When you want to improve first-call resolution
Handling Transfer Failures
Transfers can fail for various reasons: busy lines, no answer, invalid numbers. Plan for these scenarios.
Validating Before Transfer
Check that the destination is valid before attempting:
Fallback Strategies
For temporary transfers (final=False), you can handle what happens when the transfer fails or the far end hangs up:
Transfer Patterns
Escalation to Human
The most common pattern—escalate to a human when the AI can’t help:
Queue-Based Routing
Route to different queues based on caller needs:
Agent-to-Agent Handoff
Transfer between AI agents with different specializations:
Transfer Methods Summary
Best Practices
DO:
- Use post_process=True to announce transfers
- Validate destination numbers before transfer
- Log transfers for tracking and compliance
- Use final=False for consultation/return flows
- Provide clear confirmation to the caller
- Send context to the destination when helpful
- Have fallback options if transfer fails
DON’T:
- Transfer without informing the caller
- Use hard-coded numbers without validation
- Forget to handle transfer failures gracefully
- Use final=True when you need the call to return
- Transfer to unverified or potentially invalid destinations