happy-diamond-58115
11/24/2025, 9:00 AMringingTimeout field in sipClient.createSipParticipant?tall-airline-16756
11/24/2025, 9:00 AMtall-airline-16756
11/24/2025, 9:00 AMringingTimeout unreliable. Short answer: yes — ring time can vary, so ringingTimeout cannot guarantee the exact on-device ring duration.
Explanation and practical guidance:
• ringingTimeout sets how long LiveKit will wait for a final response (answer/reject) after sending the INVITE. It prevents indefinite waiting.
• Carriers and endpoint devices control actual on-network/onscreen ringing behavior (some carriers cut off ringing at ~30s, others at ~60s or more; device/voicemail settings can also affect this).
• The effective ring period is the shorter of the carrier/device behavior and your configured ringingTimeout. You cannot force carriers/devices to respect a longer ring via this field.
• For predictable behavior, set ringingTimeout to a value within common carrier limits (commonly 30–60s). LiveKit enforces an upper limit of 80s.
If you want, tell me the timeout you’re considering and the typical regions/carriers you call so I can recommend a practical ringingTimeout value.
Sources: SIP APIs | LiveKit docs | Make outbound calls | LiveKit docshappy-diamond-58115
11/24/2025, 9:03 AMtall-airline-16756
11/24/2025, 9:03 AMsip.callStatus + a fixed duration can be unreliable. A few focused suggestions to improve accuracy:
1. Prefer explicit SIP final responses when available
• If you can access SIP response codes or final event types (e.g., 487 Request Terminated, 486 Busy Here, 480 Temporarily Unavailable, 200 OK), map those to termination reasons instead of inferring from time. Final SIP responses are definitive.
1. Use server-side call lifecycle events (if available)
• Check any LiveKit or SIP gateway events/attributes that indicate call termination reason (e.g., sip.responseCode, sip.terminationReason, or disconnect event metadata). These are more reliable than elapsed time.
1. Combine status + timing as a heuristic (improved):
• Keep your ringingTimeout heuristic, but widen detection and add states:
◦ If callStatus === 'ringing' and callDuration >= RINGING_TIMEOUT_MS → likely TIMEOUT (as you have).
◦ If callStatus === 'ringing' and you later receive a SIP final response (even after timeout), update the reason based on that response.
◦ If callStatus === 'dialing' and no SIP responses arrive within a short network timeout → treat as SIP_ERROR/NO_ROUTE.
1. Track intermediate events and timestamps
• Persist timestamps for when you sent INVITE, first 180/183 provisional response (if seen), and final response. Use those to distinguish slow network vs. carrier-side cutoffs.
1. Add short grace period and re-check on async updates
• Carriers/devices sometimes respond late. After your timeout, mark TIMEOUT but keep listening for a short grace window (e.g., 5–10s). If a final SIP code arrives, override the termination reason.
1. Log and surface SIP codes for edge cases
• When you can’t map a reason, log the SIP response code, sip.callStatus, and timestamps. This helps tune RINGING_TIMEOUT_MS per carrier/region.
1. If you only have sip.callStatus (no SIP codes):
• Use a slightly longer RINGING_TIMEOUT_MS (30–60s depending on region).
• Combine with the grace-window override approach and logging to catch late final responses.
If you’d like, share:
• which attributes/events you do get on disconnect (full disconnectedParticipant.attributes), and
• the regions/carriers where you see incorrect detection.
I can then suggest a concrete mapping or a revised function that merges status, timestamps, and any available SIP codes.