I am facing an issue with cold transfer using the ...
# ask-ai
a
I am facing an issue with cold transfer using the LiveKit SIP API. My scenario: • A caller joins a LiveKit room via SIP. • I want to transfer this caller from LiveKit to my custom SIP carrier using
transfer_sip_participant
. • I pass the target as: •
sip:14238947522@<carrier-ip>:5060;transport=udp
• The API call succeeds, LiveKit reports
call transferred
, but the call hangs up immediately. • When monitoring with sngrep on the remote server, no new INVITE is generated toward the carrier.
Copy code
transfer_request = proto_sip.TransferSIPParticipantRequest(
    participant_identity=caller_participant_identity,
    room_name=userdata.ctx.room.name,
    transfer_to="sip:14238947522@<carrier-ip>:5060;transport=udp",
    play_dialtone=True
)
res = await userdata.livekit_api.sip.transfer_sip_participant(transfer_request)
t
Thanks for reaching out, Mazhar. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Let's work together to troubleshoot the cold transfer issue you're experiencing with the LiveKit SIP API. Here are some steps to guide you through: 1. First, make sure the call is fully established before you try the transfer. If the call isn’t properly connected, the transfer won’t go through. 2. Double-check that the SIP URI for where you’re transferring the call is correctly formatted and reachable. It should look something like
sip:+15105550100@sip.provider.com
. 3. Take a moment to review your SIP trunk setup with your carrier to ensure it supports call transfers to your intended destination. 4. If you’re using providers like Telnyx or Twilio, confirm that features like SIP REFER are enabled on your account. 5. Use tools like sngrep to watch the transfer process. This helps you see if the REFER request is sent and how the carrier responds. 6. Don’t forget to check the LiveKit SIP service logs for any error messages that pop up during the transfer attempt. If you’re still stuck after these steps, just let me know! I’m here to help with any part of this, and if you can share more about your SIP trunk setup and provider settings, that’d be great too. Sources: SIP troubleshooting guide | LiveKit Docs | pkg/sip/service_test.go | Transferring calls | LiveKit Docs | sipclient.go
a
I am not using Telnyx or Twilio. When I transfer the call to my remote server, it does not show up in sngrep. If I try using
sip:+15105550100@IP+PORT
, I get the error:
Failed to connect live agent sip:+14238947522@IP:5060;transport=udp: TwirpError(code=canceled, message=twirp error unknown: call transfer failed, status=408)
.
t
Hey there! That error
TwirpError(code=canceled, message=twirp error unknown: call transfer failed, status=408)
usually means there was a timeout because the transfer destination didn’t accept the call transfer request, or the system just waited too long for a response. Here are some friendly steps to help you sort it out: 1. Double-check that your SIP URI is formatted correctly and that the destination is reachable. For example, it should look like
sip:+15105550100@IP:PORT
. 2. Take a look at your SIP trunk settings to make sure it allows call transfers to where you want to send them. 3. Make sure your network setup lets SIP REFER messages get through to the destination. Sometimes firewalls or NAT can block these, so it’s good to check. 4. Try testing the transfer destination with a simple SIP client outside of LiveKit to see if it can receive calls properly. 5. Peek at your SIP provider’s documentation for any special steps needed for call transfers, like enabling SIP REFER. If you’re still stuck after trying these, just send over your SIP trunk details and any logs from your SIP provider or remote server. I’m here to help dig into it with you! Sources: SIP troubleshooting guide | LiveKit Docs | pkg/sip/inbound.go | sipclient.go
a
As you can see
Failed to connect live agent sip:+14238947522@X.X.X.X:5060: TwirpError(code=canceled, message=twirp error unknown: call transfer failed, status=408
the sip uri is fine, It's sip to sip transfer no carrier is involved in the middle, I am sending call directly to Asterisk from livekit. The remote asterisk server is accessible i can send call to it from other servers but not from livekit and also it's not reflecting in sngrep
t
Hey there! Since the call isn’t showing up in sngrep, it probably means the SIP REFER request isn’t being created or it’s heading somewhere unexpected. No worries though—here are some friendly steps to help you troubleshoot this: 1. Check the Call State: Make sure the original call is active and showing up in LiveKit’s participant list before you try the transfer. If the call isn’t active, the transfer won’t go through. 2. Look at Network Interfaces: Double-check that sngrep is watching the right network interface where your SIP traffic is flowing. If you have multiple interfaces, the traffic might be on a different one. 3. Review the Transfer Request: Take another look at the
transfer_to
URI format. It should look something like
sip:extension@asterisk-server
or
sip:+1234567890@IP:PORT
. 4. Network Setup: Make sure LiveKit and Asterisk are on the same network segment, or that any NAT/firewall in between is letting SIP traffic pass through smoothly. 5. Check LiveKit Logs: Peek at LiveKit’s logs to see if there are any errors or confirmations related to the transfer. This can tell you if the transfer request is even being sent. 6. Verify Asterisk Configuration: Confirm that your Asterisk server is set up to accept SIP REFER requests from outside sources. If you’re still stuck, no problem! Just share with me: • The exact
transfer_to
URI format you’re using. • A bit about how your network is set up between LiveKit and Asterisk. • Any relevant logs from LiveKit or Asterisk when you try the transfer. Sources: pkg/sip/inbound.go | SIP Integration | livekit/livekit_composite | DeepWiki | SIP troubleshooting guide | LiveKit Docs
a
my transfer_to :
sip:+14238947522@148.251.121.001:5060
the issue is the invite request is not getting generating getting error of
Failed to connect live agent sip:+14238947522@148.251.121.201:5060: TwirpError(code=canceled, message=twirp error unknown: call transfer failed, status=408)
t
Hey there! The issue you're seeing happens because SIP transfers in LiveKit use SIP REFER requests instead of INVITE requests. That error
TwirpError(code=canceled, message=twirp error unknown: call transfer failed, status=408)
usually means the REFER request is either timing out or being rejected by the remote endpoint. Here’s what you can try to get this sorted out: 1. Double-check that the
transfer_to
URI (
sip:+14238947522@148.251.121.001:5060
) is formatted correctly and that it’s reachable. 2. Make sure your Asterisk server is set up to accept and handle SIP REFER requests coming from LiveKit. 3. Look out for any network hiccups—like firewalls or NAT—that might be blocking those SIP REFER messages between LiveKit and Asterisk. 4. Take a peek at the Asterisk logs to see if the REFER request is actually arriving and being processed. If it’s not, the problem might be with network routing or how Asterisk is configured. 5. Also, check the LiveKit logs for any extra info about the transfer attempt. If the REFER request isn’t making it to Asterisk, it’s probably a network setup issue or something with Asterisk’s ability to handle REFER requests. Feel free to reach out if you want a hand walking through any of these steps—I’m here to help! Sources: pkg/sip/service_test.go | SIP troubleshooting guide | LiveKit Docs
a
but when i monitor sngrep on livekit server it doesn't show me any sip REFER request being generated
t
Hey there! If you’re not seeing any SIP REFER requests being generated on the LiveKit server, don’t worry—here are some common reasons why that might be happening and some friendly tips to help you fix it: 1. Transport Configuration: Just a heads up, SIP REFER doesn’t work with TLS. So, if your trunk is set up with TLS, try switching over to UDP or TCP to get those transfers going. 2. Call State: Make sure the call is fully up and running before you try to transfer it. If the call isn’t active yet, the transfer won’t happen. 3. SIP Trunk Provider Settings: Double-check with your SIP trunk provider that they support call transfers and have SIP REFER enabled. Sometimes, they need specific settings turned on for this to work. 4. Network Configuration: Take a look at your network setup—firewalls or NAT might be blocking the SIP signaling between LiveKit and where you’re trying to send the call. 5. Test Outside LiveKit: Try using a simple SIP client to transfer calls to the same destination. This can help figure out if the issue is with LiveKit or something in your network. If you’re still stuck and don’t see those SIP REFER requests, just let us know your transport protocol (UDP/TCP/TLS) and a bit about your SIP trunk setup. We’re here to help you get this sorted! Sources: Secure trunking | LiveKit Docs | Transferring calls | LiveKit Docs | Agents telephony integration | LiveKit Docs | SIP troubleshooting guide | LiveKit Docs | Inbound calls with Twilio Voice | LiveKit Docs
a
Sorry i was talking about sip refer not sip invite plus my remote server is running over UDP. there is no firewall issue,
t
It looks like SIP REFER requests aren’t being generated, so let’s walk through some key areas to check together: 1. Provider Configuration: Make sure SIP REFER is enabled with your SIP trunk provider. Sometimes, providers need specific settings to allow call transfers. 2. Call State: Check that the call is fully established before you try the transfer. SIP REFER requests won’t be generated if the call isn’t active yet. 3. Trunk Permissions: Double-check that your SIP trunk has the right permissions to transfer calls to your desired destination. 4. SIP URI: Take a moment to verify that the
transfer_to
URI is correctly formatted and reachable. 5. Test Outside LiveKit: Try using your SIP provider’s native tools or a simple SIP client to transfer calls to the same destination. This can help pinpoint if the issue is with LiveKit or the network setup. If you’ve gone through these steps and still need help, feel free to share details about your SIP trunk provider and any relevant logs from LiveKit or your SIP provider. We’re here to help you get this sorted out! Sources: SIP troubleshooting guide | LiveKit Docs | Transferring calls | LiveKit Docs | pkg/sip/outbound.go | Secure trunking | LiveKit Docs | Agents telephony integration | LiveKit Docs
a
I am transfering from Livekit sip to vicidial
t
Hey there! When you're transferring from LiveKit SIP to Vicidial, here are some important things to keep in mind and steps that might help you sort things out: 1. Use SIP URI Format: Make sure your
transfer_to
value looks like
sip:extension@vicidial-server
. Try to avoid the
tel:+number
format since Vicidial prefers SIP URIs. 2. IP Authentication: Double-check that your LiveKit server’s IP is whitelisted on the Vicidial server so SIP traffic can flow smoothly. 3. Call State: Make sure the call is fully connected before you try transferring. SIP REFER requests won’t work if the call isn’t active yet. 4. Provider Configuration: Confirm that SIP REFER is turned on with your SIP trunk provider — this is essential for the
transfer_sip_participant
API to do its job right. 5. Monitor NOTIFY Responses: Vicidial needs to send proper NOTIFY responses to confirm the transfer. Take a peek at the LiveKit logs to see if there are any errors related to NOTIFY handling. If you’re still running into trouble, feel free to share the
transfer_to
URI format you’re using along with any relevant logs from LiveKit or Vicidial. I’m here to help you figure this out! Sources: SIP troubleshooting guide | LiveKit Docs | Transferring calls | LiveKit Docs | Secure trunking | LiveKit Docs | Agents telephony integration | LiveKit Docs | test/integration/sip_test.go