Skip to content

Commit fd4f2f9

Browse files
committed
allow users to override transfer timeout
1 parent 6761850 commit fd4f2f9

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

livekit-api/livekit/api/sip_service.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -809,16 +809,25 @@ async def create_sip_participant(
809809
)
810810

811811
async def transfer_sip_participant(
812-
self, transfer: TransferSIPParticipantRequest
812+
self,
813+
transfer: TransferSIPParticipantRequest,
814+
*,
815+
timeout: Optional[float] = None,
813816
) -> SIPParticipantInfo:
814817
"""Transfer a SIP participant to a different room.
815818
816819
Args:
817820
transfer: Request containing transfer details
821+
timeout: Optional request timeout in seconds. Transferring dials a
822+
phone, which takes longer than normal, so it defaults to a
823+
longer timeout when unset.
818824
819825
Returns:
820826
Updated SIP participant information
821827
"""
828+
# Transferring a call dials a phone, which takes longer than a normal
829+
# call, so use a longer default unless the user specified a timeout.
830+
client_timeout = aiohttp.ClientTimeout(total=timeout if timeout else SIP_DIAL_TIMEOUT)
822831
return await self._client.request(
823832
SVC,
824833
"TransferSIPParticipant",
@@ -831,8 +840,7 @@ async def transfer_sip_participant(
831840
sip=SIPGrants(call=True),
832841
),
833842
SIPParticipantInfo,
834-
# Transferring a call dials a phone, which takes longer than normal.
835-
timeout=aiohttp.ClientTimeout(total=SIP_DIAL_TIMEOUT),
843+
timeout=client_timeout,
836844
)
837845

838846
def _admin_headers(self) -> dict[str, str]:

0 commit comments

Comments
 (0)