Skip to content

improve timeout behavior#738

Open
davidzhao wants to merge 5 commits into
mainfrom
dz/enforce-timeouts
Open

improve timeout behavior#738
davidzhao wants to merge 5 commits into
mainfrom
dz/enforce-timeouts

Conversation

@davidzhao

Copy link
Copy Markdown
Member

standard API times out in 10s, and SIP dial APIs defaults to 30

we were not using a timeout correctly, which could affect retry behavior

standard API times out in 10s, and SIP dial APIs defaults to 30

we were not using a timeout correctly, which could affect retry behavior
@davidzhao davidzhao requested a review from a team June 30, 2026 15:08

@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 found 3 potential issues.

Open in Devin Review

Comment thread livekit-api/livekit/api/sip_service.py
Comment thread livekit-api/livekit/api/livekit_api.py
Comment thread livekit-api/livekit/api/sip_service.py Outdated
Comment on lines +791 to +794
elif create.wait_until_answered:
# ensure default timeout isn't too short when using sync mode
if (
self._client._session.timeout
and self._client._session.timeout.total
and self._client._session.timeout.total < 20
):
client_timeout = aiohttp.ClientTimeout(total=20)
# Dialing a phone and waiting for an answer takes longer than a
# normal call, so use a longer default.
client_timeout = aiohttp.ClientTimeout(total=SIP_DIAL_TIMEOUT)

@devin-ai-integration devin-ai-integration Bot Jun 30, 2026

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.

🚩 create_sip_participant now always overrides to 30s for wait_until_answered, ignoring user's custom session timeout

The old code at sip_service.py:787-794 only bumped the timeout to 20s when the session timeout was too short (< 20). A user who passed a custom aiohttp.ClientSession with, say, timeout=aiohttp.ClientTimeout(total=120) would have their 120s timeout honored for wait_until_answered calls. The new code unconditionally sets client_timeout = aiohttp.ClientTimeout(total=SIP_DIAL_TIMEOUT) (30s), meaning the user's custom session timeout is silently overridden downward. Users can work around this by passing timeout=120 directly to create_sip_participant, but the behavioral change may surprise users who relied on session-level timeout inheritance. This is a semantic departure from how the old code worked.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

devin-ai-integration[bot]

This comment was marked as resolved.

davidzhao and others added 3 commits June 30, 2026 17:34
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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.

1 participant