rhythmic-account-68046
08/27/2025, 7:16 AMtall-airline-16756
08/27/2025, 7:16 AMtall-airline-16756
08/27/2025, 7:17 AMcreate_sip_participant.
3. Give the supervisor a quick summary or context of the conversation by sharing the conversation history in a clear, easy-to-understand way.
4. Once the supervisor is ready to take the call, use the MoveParticipant API to bring them into the customer’s room.
5. Finally, stop the hold music, turn the customer’s audio back on, and let them know they’re connected with the supervisor.
This way, the supervisor gets all the info they need before joining, making the whole warm transfer feel smooth and thoughtful. If you want me to walk you through any part or have questions, just let me know—I’m here to help!
Sources: examples/warm-transfer/hold_music.mp3rhythmic-account-68046
08/27/2025, 7:18 AMsync def transfer_call(participant_identity: str, room_name: str) -> None:
async with api.LiveKitAPI() as livekit_api:
transfer_to = 'tel:+14155550100'
# Create transfer request
transfer_request = TransferSIPParticipantRequest(
participant_identity=participant_identity,
room_name=room_name,
transfer_to=transfer_to,
play_dialtone=False
)
logger.debug(f"Transfer request: {transfer_request}")
# Transfer caller
await livekit_api.sip.transfer_sip_participant(transfer_request)
logger.info(f"Successfully transferred participant {participant_identity} to {transfer_to}"
We are doing this at the moment for cold transfer
How can I then pass mesage or context to the transfer_to ?tall-airline-16756
08/27/2025, 7:19 AMtransfer_to participant during a SIP transfer, you can do this easily using the headers field in the TransferSIPParticipantRequest. This lets you add custom SIP headers that get sent along to the destination endpoint in the SIP REFER request.
Here’s a quick example to show you how it works:
transfer_request = TransferSIPParticipantRequest(
participant_identity=participant_identity,
room_name=room_name,
transfer_to=transfer_to,
play_dialtone=False,
headers={
"X-Context-Message": "Caller transferred from Billing queue",
"X-Department": "Support"
}
)
So, these headers like X-Context-Message and X-Department will be sent to the receiving SIP endpoint, which can then understand and use the context you’ve provided.
If you have any questions or want me to walk you through it, just let me know—I’m here to help!
Sources: livekit/livekit_sip.pb.go | livekit-protocol/livekit/protocol/sip.pyi | Transferring calls | LiveKit Docsrhythmic-account-68046
08/27/2025, 7:25 AMtall-airline-16756
08/27/2025, 7:25 AMChatContext from the current session to gather all the messages exchanged between the customer and the agent.
2. Create a Separate Room for the Supervisor: Set up a new room specifically for the SIP call to the supervisor or human agent.
3. Pass the Contextual Summary: Turn the conversation history into a clear, easy-to-read summary and share it with the supervisor. For example:
context_copy = prev_ctx.copy(exclude_empty_message=True, exclude_instructions=True, exclude_function_call=True)
prev_convo = ""
for msg in context_copy.items:
if msg.role == "user":
prev_convo += f"Customer: {msg.text_content}\n"
else:
prev_convo += f"Assistant: {msg.text_content}\n"
4. Initiate the SIP Call: Use create_sip_participant to dial the supervisor and pass along the summary either verbally or through SIP headers.
5. Merge the Supervisor into the Customer's Room: When the supervisor is ready, bring them into the customer’s room with move_participant and let the customer know they’re connected.
This way, the human agent has all the important context before chatting with the customer, making the whole experience smoother and more helpful. Feel free to ask if you want me to walk you through any part of this!
Sources: examples/warm-transfer/README.md | ChatContext | LiveKit Agentsrhythmic-account-68046
08/27/2025, 7:25 AMtall-airline-16756
08/27/2025, 7:25 AM