Skip to content

Commit 2b76ffe

Browse files
committed
add transfer_sip_participant
1 parent c3d8a9e commit 2b76ffe

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

livekit-api/livekit/api/_service.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ def __init__(
1818
self.api_secret = api_secret
1919

2020
def _auth_header(
21-
self, grants: VideoGrants, sip: SIPGrants | None = None
21+
self, grants: VideoGrants | None, sip: SIPGrants | None = None
2222
) -> Dict[str, str]:
23-
tok = AccessToken(self.api_key, self.api_secret).with_grants(grants)
23+
tok = AccessToken(self.api_key, self.api_secret)
24+
if grants:
25+
tok.with_grants(grants)
2426
if sip is not None:
25-
tok = tok.with_sip_grants(sip)
27+
tok.with_sip_grants(sip)
2628

2729
token = tok.to_jwt()
2830

livekit-api/livekit/api/sip_service.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,20 @@ async def create_sip_participant(
132132
self._auth_header(VideoGrants(), sip=SIPGrants(call=True)),
133133
proto_sip.SIPParticipantInfo,
134134
)
135+
136+
async def transfer_sip_participant(
137+
self, transfer: proto_sip.TransferSIPParticipantRequest
138+
) -> proto_sip.SIPParticipantInfo:
139+
return await self._client.request(
140+
SVC,
141+
"TransferSIPParticipant",
142+
transfer,
143+
self._auth_header(
144+
VideoGrants(
145+
room_admin=True,
146+
room=transfer.room_name,
147+
),
148+
sip=SIPGrants(call=True),
149+
),
150+
proto_sip.SIPParticipantInfo,
151+
)

0 commit comments

Comments
 (0)