we are getting a "no SIP session associated with p...
# ask-ai
a
we are getting a "no SIP session associated with participant" when trying to transfer a call to a phone number
t
Thanks for reaching out, Dvir. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! The error "no SIP session associated with participant" pops up when the system can’t find an active SIP session linked to the participant you provided. This usually happens if the participant isn’t a SIP participant or if the
sip_call_id
attribute is missing. To get this sorted out, here are a few things to check: • Use a Valid SIP Participant Identity: Make sure the participant is a SIP participant created through an inbound call or the
CreateSIPParticipant
API. SIP participants typically have an identity starting with
sip_
, like
sip_+15105550123
. • Verify SIP REFER is Enabled: Double-check that your SIP trunk provider supports SIP REFER. For example, if you’re using Twilio, turn on "Enable PSTN Transfer" in your settings. • Confirm the SIP Session is Active: The call needs to be active. If the session is invalid or the call isn’t active, the transfer won’t go through. If you’re still running into trouble, take a look at your logs for messages like "cannot get trunk to update sip participant" to make sure your trunk ID is correct and the destination number is valid. We’re here to help if you need more assistance! Sources: pkg/service/sip.go | protobufs/livekit_sip.proto | pkg/sip/service.go | Agents telephony integration | LiveKit Docs | SIP troubleshooting guide | LiveKit Docs
a
the participant identity should be the local or the remote? transfer_request = proto_sip.TransferSIPParticipantRequest( participant_identity=participant_identity, room_name=userdata.ctx.room.name, transfer_to=transfer_to, play_dialtone=True )
t
Hey there! Just a quick heads-up: the
participant_identity
in
TransferSIPParticipantRequest
should be the identity of the SIP participant who's already connected in the room. In other words, it’s the remote participant from the SIP call that you want to transfer. Make sure this identity matches the SIP participant’s identity, which usually starts with
sip_
, like
sip_+15105550123
. If you keep that in mind, you’ll be all set! Sources: Transferring calls | LiveKit Docs | protobufs/rpc/sip.proto | lib/livekit/sip_service_client.rb | pkg/service/sip.go
a
Are you sure? the docs say local (both doesn't work)
t
Hey there! The
participant_identity
in
TransferSIPParticipantRequest
should actually point to the *remote SIP participant*—that’s the participant connected via SIP in the LiveKit room. The docs confirm this, mentioning it’s the identity of the SIP participant you want to transfer. If you’re finding that neither the local nor remote identities are working, it might mean there’s a hiccup with the SIP session or the participant’s attributes. Make sure the SIP participant has a valid
sip_call_id
attribute and that the SIP session is up and running. If you want, I’m here to help you troubleshoot this further—just let me know! Sources: Transferring calls | LiveKit Docs | livekit-agents/livekit/agents/job.py
g
I am seeing the same error.
t
It looks like the "no SIP session associated with participant" error means that the participant you're trying to transfer doesn’t have an active SIP session at the moment. Let’s walk through some steps together to help you troubleshoot this: 1. Verify Participant Identity: Double-check that the
participant_identity
and
room_name
are accurate, and that the participant is indeed in the specified room. 2. Check Participant Type: Remember, the participant needs to be a SIP participant created using
CreateSIPParticipant
. Participants who aren’t SIP (like WebRTC users) can’t be transferred. 3. Confirm SIP Session is Active: If the SIP call has ended or the participant has left the room, the session context won’t be available. You can use the
GetParticipant
API to check the participant’s attributes, especially looking for
sip.call_id
. 4. Ensure Proper Timing: If you’re trying to transfer right after creating the participant, make sure the SIP session has fully established before you proceed. If you’re still running into issues after these checks, it’s a good idea to look at your logs for more clues and verify that your SIP trunk is set up correctly. Please feel free to reach out if you want me to help you go through any of these steps—I’m here to support you! Sources: pkg/service/sip.go | agent.py | Create and configure a Plivo SIP trunk | LiveKit Docs | SIP troubleshooting guide | LiveKit Docs
Thank you so much for sharing the reference! I’ll take a close look at the example and guide you on how it fits with your implementation. Please bear with me for a moment while I dig into this a bit more.
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!
g
I am refering to this example https://github.com/ShayneP/phone-assistant/blob/main/agent.py Here is the code
Copy code
@function_tool()
    async def transfer_to_customer_service(self, context: RunContext_T) -> str:
        """Transfer the call to the customer service department."""
        room = context.userdata.ctx.room
        identity = room.local_participant.identity
        transfer_number = f"tel:{os.getenv('CUSTOMER_SERVICE_PHONE_NUMBER')}"
        dept_name = "Customer Service"
        context.userdata.selected_department = dept_name
        await self._handle_transfer(identity, transfer_number, dept_name)
        return f"Transferring to {dept_name} department."
It's clear that the participant is local_participant and not remote. This example is mentioned in the livekit doc here. https://docs.livekit.io/sip/transfer-cold/#usage
@adventurous-activity-14752 did this work for you? the call transfer feature
@alert-easter-19258 any idea?