Repository navigation
Preserve fractional SIP ringing timeouts - #966
Daniel-Kim-Grata wants to merge 1 commit into
Conversation
| @@ -44,7 +44,8 @@ def dial_timeout(user_timeout: Optional[float], request: DialRequest) -> float: | |||
| @private | |||
| """ | |||
| if request.HasField("ringing_timeout"): | |||
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Problem
SIP participant creation with
wait_until_answered=Trueand 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