dry-branch-55698
05/12/2025, 9:32 PMtall-airline-16756
05/12/2025, 9:32 PMtall-airline-16756
05/12/2025, 9:32 PMtransfer_sip_participant
API to transfer the call to another number. For example:
@function_tool()
async def transfer_call(self, ctx: RunContext):
transfer_to = "+15105550123";
participant_identity = "+15105550123";
await ctx.session.generate_reply(
instructions="Inform the user that you're transferring them to a different agent."
);
job_ctx = get_job_context();
try:
await job_ctx.api.sip.transfer_sip_participant(
api.TransferSIPParticipantRequest(
room_name=job_ctx.room.name,
participant_identity=participant_identity,
transfer_to=f"tel:{transfer_to}",
)
);
except Exception as e:
print(f"error transferring call: {e}");
1. After the transfer is complete, delete the room to end the agent's session. For example:
# Add a callback to handle the transfer completion
def on_sip_transfer_done(f: asyncio.Future):
if f.exception():
logger.error(f"Error transferring SIP participant: {f.exception()}");
else:
<http://logger.info|logger.info>("SIP participant transferred");
ctx.delete_room(); # This removes the agent from the call
# Perform the transfer and add the callback
ctx.transfer_sip_participant(participant, "tel:+15551234567").add_done_callback(
on_sip_transfer_done
);
This process ensures a "cold" transfer, where the agent hands off the call to another party and then ends its session after the transfer is complete.
Sources: Agents telephony integration | LiveKit Docs | Tree View: | dse-workbenchdry-branch-55698
05/12/2025, 9:33 PMtall-airline-16756
05/12/2025, 9:33 PMtransfer_sip_participant
API.
If you need further assistance or specific implementation details for warm transfers, I recommend reaching out to your technical team or consulting the API documentation for additional guidance.