busy-lunch-15701
10/02/2025, 5:41 AMtall-airline-16756
10/02/2025, 5:41 AMtall-airline-16756
10/02/2025, 5:41 AMwarm_transfer.py file in the LiveKit agents repository. It offers handy tools like transfer_to_human and create_sip_participant for kicking off the handoff, along with a SessionManager class to keep everything running smoothly. There's also another example in telephony/warm_handoff.py that shows how to transfer directly to a phone number using SIP trunking.
If you have any questions or need a hand with a particular use case, please feel free to reach out—I’m here to help!
Sources: docs/index.yaml | Workflows | LiveKit Docs | Tool definition and use | LiveKit Docs | Docs::Telephony | livekit-agents/livekit/agents/voice/agent_session.pybusy-lunch-15701
10/02/2025, 5:43 AMtall-airline-16756
10/02/2025, 5:44 AMSessionManager, which helps coordinate the whole process—placing the caller on hold, dialing the human agent via SIP, and merging everyone into the same WebRTC room. If you'd like, I’m here to walk you through the details or help set this up together!
Sources: Docs::Agents | Docs::Telephony | livekit-agents/livekit/agents/voice/run_result.py | Agents telephony integration | LiveKit Docs | Workflows | LiveKit Docsbusy-lunch-15701
10/02/2025, 5:47 AMbusy-lunch-15701
10/02/2025, 5:47 AMbusy-lunch-15701
10/02/2025, 5:47 AMtall-airline-16756
10/02/2025, 5:48 AMLIVEKIT_URL, LIVEKIT_API_KEY, and LIVEKIT_API_SECRET.
1. Configure SIP Trunking:
◦ Next, set up an outbound SIP trunk to connect to the human agent’s phone or SIP endpoint.
◦ Don’t forget to define the SIP trunk details in your environment variables, like LIVEKIT_SIP_OUTBOUND_TRUNK and LIVEKIT_SUPERVISOR_PHONE_NUMBER.
1. Implement the Warm Transfer Workflow:
◦ Use the SessionManager to handle the caller and human agent sessions smoothly.
◦ Place the caller on hold with the move_participant API.
◦ Dial the human agent using the create_sip_participant API with wait_until_answered=True to ensure they’re ready.
◦ Merge the caller and human agent into the same WebRTC room for a seamless handoff.
◦ Once the transfer is complete, you can disconnect the AI agent.
1. Test the Workflow:
◦ Try simulating a call with the AI agent to see how the handoff to the human agent works in practice.
◦ Make sure the human agent receives the conversation context and can join the WebRTC room without any issues.
If you’d like, I’m here to dive deeper into any of these steps or help you with specific parts of the setup. Just let me know where you’d like to begin—I’m happy to assist!tall-airline-16756
10/02/2025, 5:48 AMLIVEKIT_SIP_OUTBOUND_TRUNK, LIVEKIT_SUPERVISOR_PHONE_NUMBER, LIVEKIT_URL, LIVEKIT_API_KEY, and LIVEKIT_API_SECRET.
1. Implement the warm transfer workflow:
◦ Use the SessionManager to handle the sessions for both the caller and the human agent.
◦ Place the caller on hold by playing background audio or a waiting message to keep them engaged.
◦ Dial the human agent using the create_sip_participant API—this will connect them to a private consultation room.
◦ Make sure to share the conversation context with the human agent, like chat history or a summary, so they’re fully prepared.
◦ Bring the human agent and caller into the same WebRTC room using the move_participant API.
◦ Once the handoff is complete, you can disconnect the AI agent.
1. Test the workflow:
◦ Try simulating a call with the AI agent and walk through the handoff process to ensure everything flows smoothly.
◦ Confirm that the human agent receives the right context and can join the WebRTC room without any issues.
If you’d like, I’m happy to help with any specific steps or provide code examples—just let me know!