improve timeout behavior#738
Conversation
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
| 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) |
There was a problem hiding this comment.
🚩 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.
Was this helpful? React with 👍 or 👎 to provide feedback.
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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