Skip to content

Commit 5f50dd0

Browse files
committed
correctly handle whatsapp dial/accept flow
1 parent b848540 commit 5f50dd0

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

livekit-api/livekit/api/connector_service.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
ConnectTwilioCallResponse,
1919
)
2020
from ._service import Service
21-
from ._dial_timeout import dial_timeout, pin_ringing_timeout
21+
from ._dial_timeout import DEFAULT_RINGING_TIMEOUT
2222
from .access_token import VideoGrants
2323

2424
SVC = "Connector"
@@ -119,20 +119,21 @@ async def accept_whatsapp_call(
119119
Args:
120120
request: AcceptWhatsAppCallRequest containing call parameters and SDP
121121
timeout: Optional request timeout in seconds. When the request waits
122-
for an answer (wait_until_answered), it defaults to a longer value
123-
(dialing takes time) and is raised, if needed, to stay above the
124-
request's ringing_timeout.
122+
for an answer (wait_until_answered), it defaults to the standard
123+
ring window; set it above the ringing_timeout passed to
124+
dial_whatsapp_call (the two calls are separate, so the SDK can't
125+
derive it).
125126
126127
Returns:
127128
AcceptWhatsAppCallResponse with the room name
128129
"""
129130
client_timeout: Optional[aiohttp.ClientTimeout] = None
130131
if request.wait_until_answered:
131-
# Waiting for the call to be answered dials a phone, which takes
132-
# longer than a normal request and must outlast ringing. Pin the ring
133-
# window so the timeout doesn't depend on the server's default.
134-
pin_ringing_timeout(request)
135-
client_timeout = aiohttp.ClientTimeout(total=dial_timeout(timeout, request))
132+
# Accept can block until the call is answered, so default to the
133+
# standard ring window; the caller overrides via timeout.
134+
client_timeout = aiohttp.ClientTimeout(
135+
total=timeout if timeout else DEFAULT_RINGING_TIMEOUT
136+
)
136137
elif timeout:
137138
client_timeout = aiohttp.ClientTimeout(total=timeout)
138139

0 commit comments

Comments
 (0)