11import aiohttp
22from livekit .protocol import sip as proto_sip
33from ._service import Service
4- from .access_token import VideoGrants
4+ from .access_token import VideoGrants , SIPGrants
55
66SVC = "SIP"
77
@@ -19,29 +19,73 @@ async def create_sip_trunk(
1919 SVC ,
2020 "CreateSIPTrunk" ,
2121 create ,
22- self ._auth_header (VideoGrants ()),
22+ self ._auth_header (VideoGrants (), sip = SIPGrants ( admin = True ) ),
2323 proto_sip .SIPTrunkInfo ,
2424 )
2525
26+ async def create_sip_inbound_trunk (
27+ self , create : proto_sip .CreateSIPInboundTrunkRequest
28+ ) -> proto_sip .SIPInboundTrunkInfo :
29+ return await self ._client .request (
30+ SVC ,
31+ "CreateSIPInboundTrunk" ,
32+ create ,
33+ self ._auth_header (VideoGrants (), sip = SIPGrants (admin = True )),
34+ proto_sip .SIPInboundTrunkInfo ,
35+ )
36+
37+ async def create_sip_outbound_trunk (
38+ self , create : proto_sip .CreateSIPOutboundTrunkRequest
39+ ) -> proto_sip .SIPOutboundTrunkInfo :
40+ return await self ._client .request (
41+ SVC ,
42+ "CreateSIPOutboundTrunk" ,
43+ create ,
44+ self ._auth_header (VideoGrants (), sip = SIPGrants (admin = True )),
45+ proto_sip .SIPOutboundTrunkInfo ,
46+ )
47+
2648 async def list_sip_trunk (
2749 self , list : proto_sip .ListSIPTrunkRequest
2850 ) -> proto_sip .ListSIPTrunkResponse :
2951 return await self ._client .request (
3052 SVC ,
3153 "ListSIPTrunk" ,
3254 list ,
33- self ._auth_header (VideoGrants ()),
55+ self ._auth_header (VideoGrants (), sip = SIPGrants ( admin = True ) ),
3456 proto_sip .ListSIPTrunkResponse ,
3557 )
3658
59+ async def list_sip_inbound_trunk (
60+ self , list : proto_sip .ListSIPInboundTrunkRequest
61+ ) -> proto_sip .ListSIPInboundTrunkResponse :
62+ return await self ._client .request (
63+ SVC ,
64+ "ListSIPInboundTrunk" ,
65+ list ,
66+ self ._auth_header (VideoGrants (), sip = SIPGrants (admin = True )),
67+ proto_sip .ListSIPInboundTrunkResponse ,
68+ )
69+
70+ async def list_sip_outbound_trunk (
71+ self , list : proto_sip .ListSIPOutboundTrunkRequest
72+ ) -> proto_sip .ListSIPOutboundTrunkResponse :
73+ return await self ._client .request (
74+ SVC ,
75+ "ListSIPOutboundTrunk" ,
76+ list ,
77+ self ._auth_header (VideoGrants (), sip = SIPGrants (admin = True )),
78+ proto_sip .ListSIPOutboundTrunkResponse ,
79+ )
80+
3781 async def delete_sip_trunk (
3882 self , delete : proto_sip .DeleteSIPTrunkRequest
3983 ) -> proto_sip .SIPTrunkInfo :
4084 return await self ._client .request (
4185 SVC ,
4286 "DeleteSIPTrunk" ,
4387 delete ,
44- self ._auth_header (VideoGrants ()),
88+ self ._auth_header (VideoGrants (), sip = SIPGrants ( admin = True ) ),
4589 proto_sip .SIPTrunkInfo ,
4690 )
4791
@@ -52,7 +96,7 @@ async def create_sip_dispatch_rule(
5296 SVC ,
5397 "CreateSIPDispatchRule" ,
5498 create ,
55- self ._auth_header (VideoGrants ()),
99+ self ._auth_header (VideoGrants (), sip = SIPGrants ( admin = True ) ),
56100 proto_sip .SIPDispatchRuleInfo ,
57101 )
58102
@@ -63,7 +107,7 @@ async def list_sip_dispatch_rule(
63107 SVC ,
64108 "ListSIPDispatchRule" ,
65109 list ,
66- self ._auth_header (VideoGrants ()),
110+ self ._auth_header (VideoGrants (), sip = SIPGrants ( admin = True ) ),
67111 proto_sip .ListSIPDispatchRuleResponse ,
68112 )
69113
@@ -74,7 +118,7 @@ async def delete_sip_dispatch_rule(
74118 SVC ,
75119 "DeleteSIPDispatchRule" ,
76120 delete ,
77- self ._auth_header (VideoGrants ()),
121+ self ._auth_header (VideoGrants (), sip = SIPGrants ( admin = True ) ),
78122 proto_sip .SIPDispatchRuleInfo ,
79123 )
80124
@@ -85,6 +129,6 @@ async def create_sip_participant(
85129 SVC ,
86130 "CreateSIPParticipant" ,
87131 create ,
88- self ._auth_header (VideoGrants ()),
132+ self ._auth_header (VideoGrants (), sip = SIPGrants ( call = True ) ),
89133 proto_sip .SIPParticipantInfo ,
90134 )
0 commit comments