From 7d8fb986e5b6308ca7627fd7f3b725aacb551a50 Mon Sep 17 00:00:00 2001 From: 650elx Date: Wed, 13 Mar 2024 23:21:45 +0100 Subject: [PATCH] feat(Voice): additional conference call method --- sinch/domains/voice/__init__.py | 36 ++++++++++++++++++ .../voice/conferences/test_call_conference.py | 37 +++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 tests/e2e/voice/conferences/test_call_conference.py diff --git a/sinch/domains/voice/__init__.py b/sinch/domains/voice/__init__.py index 7cac4d7..5ad3e79 100644 --- a/sinch/domains/voice/__init__.py +++ b/sinch/domains/voice/__init__.py @@ -222,6 +222,42 @@ class Conferences: def __init__(self, sinch): self._sinch = sinch + def call( + self, + destination: Destination, + conference_id: str, + cli: str = None, + conference_dtmf_options: ConferenceDTMFOptions = None, + dtmf: str = None, + conference: str = None, + max_duration: int = None, + enable_ace: bool = None, + enable_dice: bool = None, + enable_pie: bool = None, + locale: str = None, + greeting: str = None, + moh_class: str = None, + custom: str = None, + domain: str = None + ) -> VoiceCalloutResponse: + return self._sinch.voice.callouts.conference( + destination=destination, + conference_id=conference_id, + cli=cli, + conference_dtmf_options=conference_dtmf_options, + dtmf=dtmf, + conference=conference, + max_duration=max_duration, + enable_ace=enable_ace, + enable_dice=enable_dice, + enable_pie=enable_pie, + locale=locale, + greeting=greeting, + moh_class=moh_class, + custom=custom, + domain=domain + ) + def get(self, conference_id: str) -> GetVoiceConferenceResponse: return self._sinch.configuration.transport.request( GetConferenceEndpoint( diff --git a/tests/e2e/voice/conferences/test_call_conference.py b/tests/e2e/voice/conferences/test_call_conference.py new file mode 100644 index 0000000..3be04f1 --- /dev/null +++ b/tests/e2e/voice/conferences/test_call_conference.py @@ -0,0 +1,37 @@ +from sinch.domains.voice.models.callouts.responses import VoiceCalloutResponse + + +def test_conference_call( + sinch_client_sync, + phone_number, + voice_origin_phone_number, + conference_id +): + conference_callout_response = sinch_client_sync.voice.conferences.call( + conference_id=conference_id, + destination={ + "type": "number", + "endpoint": phone_number + }, + locale="en-US", + cli=voice_origin_phone_number + ) + assert isinstance(conference_callout_response, VoiceCalloutResponse) + + +async def test_conference_call_async( + sinch_client_async, + phone_number, + voice_origin_phone_number, + conference_id +): + conference_callout_response = await sinch_client_async.voice.conferences.call( + conference_id=conference_id, + destination={ + "type": "number", + "endpoint": phone_number + }, + locale="en-US", + cli=voice_origin_phone_number + ) + assert isinstance(conference_callout_response, VoiceCalloutResponse) \ No newline at end of file