kind-iron-94532
08/11/2025, 1:53 AMtall-airline-16756
08/11/2025, 1:53 AMtall-airline-16756
08/11/2025, 1:54 AMTransferSIPParticipant
API. It helps you transfer a SIP participant to another endpoint using the SIP REFER method. Here’s a quick rundown on how to get it done:
• Use the TransferSIPParticipant
API with parameters like transfer_to
(the target number or SIP URI), participant_identity
(who you want to transfer), room_name
(the room’s name), and play_dialtone
(an optional boolean if you want a dial tone during the transfer).
Here’s a simple example in Python to help you visualize it:
import os
from livekit import api
async def transfer_call(participant_identity, transfer_to, room_name):
livekit_url = os.getenv('LIVEKIT_URL')
api_key = os.getenv('LIVEKIT_API_KEY')
api_secret = os.getenv('LIVEKIT_API_SECRET')
livekit_api = api.LiveKitAPI(
url=livekit_url,
api_key=api_key,
api_secret=api_secret
)
transfer_request = api.TransferSIPParticipantRequest(
room_name=room_name,
participant_identity=participant_identity,
transfer_to=transfer_to,
play_dialtone=True
)
await livekit_api.sip.transfer_sip_participant(transfer_request)
Just a heads-up: make sure call transfers are enabled on your SIP trunk. For instance, if you’re using Twilio, you’ll want to turn on both "Call Transfer" and "PSTN Transfer" modes.
As for warm transfers, there isn’t clear info available right now on how to do that with LiveKit. But if that’s something you need, just let me know—I’m here to help you figure it out!