melodic-hamburger-67426
08/18/2025, 11:36 AMtall-airline-16756
08/18/2025, 11:36 AMtall-airline-16756
08/18/2025, 11:37 AMmelodic-hamburger-67426
08/18/2025, 11:39 AMtall-airline-16756
08/18/2025, 11:40 AMtransfer_sip_participant
method — it’s what lets you transfer the call to another participant or phone number.
2. Before you kick off the transfer, the agent can have a quick chat with the recipient to see if they’re okay with taking the call.
3. Once the recipient gives the green light, you can use the LiveKit API to make the transfer happen. Here’s an example to get you started:
async def transfer_call(self, participant_identity: str, transfer_to: str):
try:
# Initialize LiveKit API client
livekit_api = api.LiveKitAPI(
url=os.environ.get('LIVEKIT_URL'),
api_key=os.environ.get('LIVEKIT_API_KEY'),
api_secret=os.environ.get('LIVEKIT_API_SECRET')
)
# Create transfer request
transfer_request = proto_sip.TransferSIPParticipantRequest(
participant_identity=participant_identity,
room_name=self.context.room.name,
transfer_to=transfer_to,
play_dialtone=True
)
# Perform transfer
await livekit_api.sip.transfer_sip_participant(transfer_request)
await livekit_api.aclose()
except Exception as e:
print(f"Failed to transfer call: {e}")
Just swap out the placeholders like participant_identity
and transfer_to
with your actual details. And a quick heads-up — make sure your LiveKit API credentials and SIP trunk settings are all set up correctly in your environment variables.
If you hit any snags or want to chat more about this, I’m here to help!