lively-horse-90722
09/23/2025, 12:15 PMtall-airline-16756
09/23/2025, 12:15 PMtall-airline-16756
09/23/2025, 12:16 PMTransferSIPParticipant API, which lets you transfer a call to another phone number or SIP URI.
Here are some important points to keep in mind:
• Both cold and warm transfer workflows are available. With a cold transfer, the agent simply hands off the call and the session ends. Warm transfers take a bit more care, as they involve managing the session to provide context before connecting the caller.
• To get this up and running, you’d use the transfer_sip_participant method, passing parameters like room_name, participant_identity, and transfer_to (which is the destination number or SIP URI).
• There’s also an optional play_dialtone parameter if you want to play a dial tone during the transfer.
Just a quick reminder to make sure SIP REFER is enabled on your SIP trunk provider. And if you’re using Twilio, don’t forget to activate the "Enable PSTN Transfer" setting.
If you’d like, I’m here to help you through the implementation or answer any other questions you might have!
Sources: SIP overview | LiveKit Docs | Agents telephony integration | LiveKit Docs | agent.py | Transferring calls | LiveKit Docs | Agent-assisted warm transfer | LiveKit Docslively-horse-90722
09/23/2025, 12:18 PMtall-airline-16756
09/23/2025, 12:18 PMawait job_ctx.api.sip.transfer_sip_participant(
api.TransferSIPParticipantRequest(
room_name=job_ctx.room.name, # Replace with the name of the room where the call is taking place
participant_identity=participant_identity, # Replace with the identity of the SIP participant to be transferred
transfer_to="tel:+15105550123", # Replace with the destination number or SIP URI
play_dialtone=True # Optional: Set to True to play a dial tone during the transfer
)
)
Just a quick note: the participant_identity is the unique ID for the SIP participant in the room. Usually, this gets assigned when they join, and you can find it in the participant list or session details.
If you're unsure about how to find the participant_identity in your setup, please don't hesitate to ask—I'm here to help!red-state-11941
09/23/2025, 12:31 PMtall-airline-16756
09/23/2025, 12:32 PMtransfer_to URI is correctly formatted (for example, tel:+15105550100) and that it’s reachable.
2. Enable SIP REFER and PSTN Transfer on Twilio: Head over to the Twilio Console, navigate to Elastic SIP Trunking » Manage » Trunks, select your trunk, and make sure Call Transfer (SIP REFER) and Enable PSTN Transfer are turned on. Don’t forget to save your changes!
3. Ensure Trunk Permissions: Check that your trunk has the right permissions to transfer calls to the destination you’re targeting.
4. Test Outside LiveKit (Optional): If you want, you can try verifying SIP REFER functionality directly with Twilio’s API to help pinpoint where the issue might be.
If you’ve gone through these steps and things still aren’t working quite right, please don’t hesitate to reach out—I’m here to help you get this sorted!
Sources: SIP troubleshooting guide | LiveKit Docs | Agents telephony integration | LiveKit Docs | Transferring calls | LiveKit Docsred-state-11941
09/23/2025, 12:54 PMtall-airline-16756
09/23/2025, 12:55 PMsip_number) is either a Twilio-purchased number or a verified outbound caller ID in your Twilio account. You can easily check and verify numbers in the Twilio Console.
2. Enable SIP REFER and PSTN Transfer: Next, head over to the Twilio Console, go to Elastic SIP Trunking » Manage » Trunks, and enable both Call Transfer (SIP REFER) and Enable PSTN Transfer. Don’t forget to save your changes!
3. Set Caller ID in Transfer Requests: When making your transfer request, use a verified number as the sip_number. If the number isn’t verified, you can leave out sip_number so it defaults to the trunk’s inbound number.
4. Use Trunk’s Caller ID: You might want to configure your Twilio trunk to use the trunk’s own number as the caller ID by setting Transfer Caller ID to From Transferor.
5. Validate Destination: Lastly, double-check that the transfer_to URI is properly formatted (for example, tel:+15105550100) and that it’s reachable.
Following these steps should help clear up the issue. If you run into any hiccups or have more questions, please don’t hesitate to reach out—I’m here to help!
Sources: SIP troubleshooting guide | LiveKit Docs | Preserving Caller ID During SIP Transfers in LiveKit Agents | Transferring calls | LiveKit Docs | Agents telephony integration | LiveKit Docs | livekit-protocol/livekit/protocol/sip.pyred-state-11941
09/23/2025, 1:31 PMtall-airline-16756
09/23/2025, 1:32 PMsip_number parameter in your transfer request to the number you originally called. Here’s an example for clarity:
await job_ctx.api.sip.transfer_sip_participant(
api.TransferSIPParticipantRequest(
room_name=job_ctx.room.name,
participant_identity=participant_identity,
transfer_to="tel:+15105550123",
play_dialtone=True,
sip_number="tel:+15105550100" # The number you called
)
)
1. Configure Twilio Trunk: Next, in your Twilio Console, please set the Transfer Caller ID option to From Transferee within your SIP trunk settings. This step ensures the original caller’s number is used as the "From" number during the transfer.
If any part of this feels unclear or you’d like a hand with these steps, don’t hesitate to reach out—I’m here to help!red-state-11941
09/23/2025, 1:32 PMtall-airline-16756
09/23/2025, 1:33 PMsip_number Parameter: When you initiate the transfer, simply leave out the sip_number parameter in your request. This will automatically default the caller ID to the Twilio trunk’s number.
Here’s an example to illustrate:
await job_ctx.api.sip.transfer_sip_participant(
api.TransferSIPParticipantRequest(
room_name=job_ctx.room.name,
participant_identity=participant_identity,
transfer_to="tel:+15105550123",
play_dialtone=True
)
)
This method helps keep everything compliant with Twilio’s policies while ensuring your calls go through just as you need. If you have any questions or need a hand with this, please don’t hesitate to reach out—I’m here to help!