im noticing that sometimes, when making a CreateSI...
# ask-ai
i
im noticing that sometimes, when making a CreateSIPParticipantRequest with wait_until_answered=True, the call is made successfully but the request hangs until the end of the call at which point it times out
t
Thanks for reaching out, Ed. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! Just to clarify, the
CreateSIPParticipantRequest
with
wait_until_answered=True
is supposed to pause only until the call gets answered, not until it ends. So if your request is hanging until the call finishes and then timing out, that’s definitely not what we expect. Here are a few friendly tips to help you troubleshoot: • Make sure the call is actually being answered and that a 200 OK SIP response is being sent. • Take a peek at the SIP participant attributes (like
sip.callStatus
) in the LiveKit dashboard or via the API to see if the call state is updating properly. • Try setting a
timeout
value explicitly (for example, 60 seconds) in your request to keep control over how long it waits. Some common reasons this might happen include SIP signaling hiccups (like missing that 200 OK response), network or SIP trunk setup issues, or maybe some client/server configuration quirks. Checking your server logs or using LiveKit’s monitoring tools can really help pinpoint what’s going on. Sources: packages/livekit-server-sdk/src/SipClient.ts | livekit-api/livekit/api/sip_service.py | Make outbound calls | LiveKit Docs | Agents telephony integration | LiveKit Docs | SIP outbound trunk | LiveKit Docs
i
thats what im trying to say - the request doesnt come back with a response, even though the call connects (i assume during the request) and eventually it times out
t
Hey there! If your request times out even though the call connects, it might be because the timeout value is a bit too short or there could be some signaling hiccups. No worries though—here are a few things you can try: • Try setting a longer
timeout
value in your
CreateSIPParticipant
call to give the participant more time to join. • Make sure
waitUntilAnswered
is set to
true
, which automatically gives you a longer timeout. • Keep an eye on participant events in the room so you can see when the SIP participant actually joins or when
sip.callStatus
changes to
active
. Also, double-check that your SIP trunk is set up correctly and that your authentication details are spot on. If things still aren’t working, taking a look at the server logs during participant creation might shed some light on what’s going on. Hope this helps! Sources: packages/livekit-server-sdk/src/SipClient.ts | Making outbound calls | LiveKit Docs
i
are there any 80 second timeouts related to sip trunk timeouts or calls made from sip trunks?
t
Just to clarify, the 80-second timeout is tied to the default setting for creating a SIP participant using the
livekit-cli
tool. This timeout basically sets how long the system waits for the outbound call to be dialed and answered. It’s a bit different from other SIP-related timeouts, like: • Ringing timeout: This one controls how long to wait for the callee to pick up (usually 3 minutes by default in the SIP service). • Max call duration: This sets the longest allowed time for the whole call session. If your SIP trunk or provider needs a bit more time to connect, no worries—you can easily adjust this timeout when you start the call through the CLI or SDKs. For example, with the Node.js SDK, you can change the default timeout by using the
timeout
option in
CreateSipParticipantOptions
. Feel free to reach out if you want a hand tweaking these settings or if you run into any issues with your SIP trunk setup. I’m here to help! Sources: cmd/lk/sip.go | pkg/sip/participant.go | SIP APIs | LiveKit Docs | packages/livekit-server-sdk/src/SipClient.ts
i
await ctx.api.sip.create_sip_participant( CreateSIPParticipantRequest( room_name=ctx.room.name, sip_trunk_id=trunk.sip_trunk_id, sip_call_to=str(phone_number), participant_identity=str(sip_participant_identity), wait_until_answered=True, ringing_timeout=Duration(seconds=ringing_timeout), ), timeout=ringing_timeout, ) im already changing the timeout (ringing_timeout here is 300) is that the right approach?
t
Setting
ringing_timeout
to 300 seconds in
CreateSIPParticipantRequest
is totally fine! The
ringing_timeout
basically tells the system how long to wait for the callee to pick up, and 300 seconds (that’s 5 minutes) works well if you’re expecting longer response times. Just make sure this timeout fits what you need. For most regular calls, shorter timeouts like 15-30 seconds are pretty typical, but if you’re dealing with something that needs more time, 300 seconds makes sense. If you’re still running into issues after this, just give me a shout and we’ll figure it out together! Sources: SIP APIs | LiveKit Docs | packages/livekit-server-sdk/src/SipClient.ts | cmd/lk/sip.go
i
im trying to say that im setting the timeout to be 300 but still seeing timeouts after 80 seconds
t
Hey there! This issue pops up because the server defaults to an 80-second timeout when
wait_until_answered=True
, even if you've set a longer timeout (like 300 seconds). That happens because the client timeout doesn’t always get passed along to the server as a context deadline. Here’s how you can fix it: • Make sure you set the timeout at the client level, not just in the request parameters. For example, in Python, you’d want to pass the
timeout
parameter directly when you call the method. • Double-check that your SDK version supports proper timeout propagation. SDKs like Node.js and Python let you explicitly set the timeout in the request options. • Take a look at your server logs or debug the timeout propagation to confirm the server is honoring the context deadline. The main thing is to apply the timeout at the transport/context level so the server knows to respect it. If you want, I’m here to help you with how to do this in your specific SDK or environment—just let me know! Sources: pkg/service/sip.go | packages/livekit-server-sdk/src/SipClient.ts | livekit-protocol/livekit/protocol/sip.py | sipclient.go | cmd/lk/sip.go
i
im confused - were already setting the timeout parameter when calling the method:
Copy code
ringing_timeout = 300
await ctx.api.sip.create_sip_participant(
            CreateSIPParticipantRequest(
                room_name=ctx.room.name,
                sip_trunk_id=trunk.sip_trunk_id,
                sip_call_to=str(phone_number),
                participant_identity=str(sip_participant_identity),
                wait_until_answered=True,
                ringing_timeout=Duration(seconds=ringing_timeout),
            ),
            timeout=ringing_timeout,
        )
so why am i still seeing 80 second timeouts?
t
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!