Skip to content

Preserve fractional SIP ringing timeouts - #966

Open
Daniel-Kim-Grata wants to merge 1 commit into
livekit:mainfrom
Daniel-Kim-Grata:fix/sip-fractional-ringing-timeout
Open

Daniel-Kim-Grata wants to merge 1 commit into
livekit:mainfrom
Daniel-Kim-Grata:fix/sip-fractional-ringing-timeout

Conversation

@Daniel-Kim-Grata

Copy link
Copy Markdown

Problem

SIP participant creation with wait_until_answered=True and SIP transfers set an HTTP timeout of at least the ringing duration plus two seconds. The calculation drops the nanoseconds field from the protobuf duration. With a 1.75-second ringing window and no caller override, the client sets a 3.0-second timeout instead of 3.75 seconds.

Change

Include the nanoseconds field in the timeout floor. Add tests through both public SIP methods that check the default, a shorter caller timeout, and a longer caller timeout.

Verification

  • Four regression cases failed on the base commit. All six focused cases passed with the fix.
  • Local API suite: 46 passed. The 28 integration tests that require the LiveKit mock server were skipped.
  • Ruff lint and format checks and the Python SDK changeset check passed.

@CLAassistant

CLAassistant commented Nov 27, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@@ -44,7 +44,8 @@ def dial_timeout(user_timeout: Optional[float], request: DialRequest) -> float:
@private
"""
if request.HasField("ringing_timeout"):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-existing, not introduced by this PR, but adjacent: an explicitly set zero ringing_timeout (e.g. ringing_timeout=Duration()) passes HasField("ringing_timeout"), so ring becomes 0.0 and the HTTP timeout floor drops to just RINGING_TIMEOUT_MARGIN (~2s). pin_ringing_timeout also leaves it untouched for the same reason.

If the server treats a zero ringing timeout as "use the default", the phone keeps ringing server-side while the client aborts with asyncio.TimeoutError after ~2s.

Suggestion: treat a set Duration whose total is <= 0 the same as an unset one, i.e. fall back to DEFAULT_RINGING_TIMEOUT (and pin it) in both dial_timeout and pin_ringing_timeout. Fine to handle in a follow-up if you prefer to keep this PR focused.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for flagging this. I’ll keep this PR focused on fractional timeouts and handle the existing explicitly zero duration behavior separately, with tests for both SIP helpers.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants