-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SIP services. Support SIP DTMF in RTC.
- Loading branch information
Showing
38 changed files
with
1,293 additions
and
860 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import aiohttp | ||
from livekit.protocol import sip as proto_sip | ||
from ._service import Service | ||
from .access_token import VideoGrants | ||
|
||
SVC = "SIP" | ||
|
||
|
||
class SipService(Service): | ||
def __init__( | ||
self, session: aiohttp.ClientSession, url: str, api_key: str, api_secret: str | ||
): | ||
super().__init__(session, url, api_key, api_secret) | ||
|
||
async def create_sip_trunk( | ||
self, create: proto_sip.CreateSipTrunkRequest | ||
) -> proto_sip.SipTrunkInfo: | ||
return await self._client.request( | ||
SVC, | ||
"CreateSIPTrunk", | ||
create, | ||
self._auth_header(VideoGrants()), | ||
proto_sip.SipTrunkInfo, | ||
) | ||
|
||
async def list_sip_trunk( | ||
self, list: proto_sip.ListSipTrunkRequest | ||
) -> proto_sip.ListSipTrunkResponse: | ||
return await self._client.request( | ||
SVC, | ||
"ListSIPTrunk", | ||
list, | ||
self._auth_header(VideoGrants()), | ||
proto_sip.ListSipTrunkResponse, | ||
) | ||
|
||
async def delete_sip_trunk( | ||
self, delete: proto_sip.DeleteSipTrunkRequest | ||
) -> proto_sip.SipTrunkInfo: | ||
return await self._client.request( | ||
SVC, | ||
"DeleteSIPTrunk", | ||
delete, | ||
self._auth_header(VideoGrants()), | ||
proto_sip.SipTrunkInfo, | ||
) | ||
|
||
async def create_sip_dispatch_rule( | ||
self, create: proto_sip.CreateSipDispatchRuleRequest | ||
) -> proto_sip.SipDispatchRuleInfo: | ||
return await self._client.request( | ||
SVC, | ||
"CreateSIPDispatchRule", | ||
create, | ||
self._auth_header(VideoGrants()), | ||
proto_sip.SipDispatchRuleInfo, | ||
) | ||
|
||
async def list_sip_dispatch_rule( | ||
self, list: proto_sip.ListSipDispatchRuleRequest | ||
) -> proto_sip.ListSipDispatchRuleResponse: | ||
return await self._client.request( | ||
SVC, | ||
"ListSIPDispatchRule", | ||
list, | ||
self._auth_header(VideoGrants()), | ||
proto_sip.ListSipDispatchRuleResponse, | ||
) | ||
|
||
async def delete_sip_dispatch_rule( | ||
self, delete: proto_sip.DeleteSipDispatchRuleRequest | ||
) -> proto_sip.SipDispatchRuleInfo: | ||
return await self._client.request( | ||
SVC, | ||
"DeleteSIPDispatchRule", | ||
delete, | ||
self._auth_header(VideoGrants()), | ||
proto_sip.SipDispatchRuleInfo, | ||
) | ||
|
||
async def create_sip_participant( | ||
self, create: proto_sip.CreateSipParticipantRequest | ||
) -> proto_sip.SipParticipantInfo: | ||
return await self._client.request( | ||
SVC, | ||
"CreateSIPParticipant", | ||
create, | ||
self._auth_header(VideoGrants()), | ||
proto_sip.SipParticipantInfo, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.