33# Licensed under the MIT License. See License.txt in the project root for
44# license information.
55# --------------------------------------------------------------------------
6- from typing import TYPE_CHECKING , Any , Optional # pylint: disable=unused-import
6+ # pylint: disable=too-many-public-methods
7+ from typing import TYPE_CHECKING , List , Any , Optional # pylint: disable=unused-import
78from azure .core .tracing .decorator import distributed_trace
89from .utils ._utils import CallingServerUtils
910from ._communication_identifier_serializer import serialize_identifier
1011from ._converters import (
1112 AddParticipantRequestConverter ,
13+ GetParticipantRequestConverter ,
1214 RemoveParticipantRequestConverter ,
1315 TransferCallRequestConverter ,
1416 CancelParticipantMediaOperationRequestConverter ,
1517 PlayAudioRequestConverter ,
16- PlayAudioToParticipantRequestConverter
18+ PlayAudioToParticipantRequestConverter ,
19+ AudioRoutingGroupRequestConverter ,
20+ MuteParticipantRequestConverter ,
21+ UnmuteParticipantRequestConverter ,
22+ HoldMeetingAudioRequestConverter ,
23+ ResumeMeetingAudioRequestConverter ,
24+ UpdateAudioRoutingGroupRequestConverter
1725 )
1826from ._generated .models import (
1927 AddParticipantResult ,
2028 CallConnectionProperties ,
2129 PhoneNumberIdentifierModel ,
22- PlayAudioResult
30+ PlayAudioResult ,
31+ AudioRoutingGroupResult ,
32+ CreateAudioRoutingGroupResult ,
33+ CallParticipant ,
34+ AudioRoutingMode
2335 )
2436from ._shared .models import CommunicationIdentifier
2537
@@ -48,6 +60,17 @@ def get_call(
4860 ** kwargs
4961 )
5062
63+ @distributed_trace ()
64+ def delete_call (
65+ self ,
66+ ** kwargs # type: Any
67+ ): # type: (...) -> None
68+
69+ return self ._call_connection_client .delete_call (
70+ call_connection_id = self .call_connection_id ,
71+ ** kwargs
72+ )
73+
5174 @distributed_trace ()
5275 def hang_up (
5376 self ,
@@ -59,6 +82,17 @@ def hang_up(
5982 ** kwargs
6083 )
6184
85+ @distributed_trace ()
86+ def keep_alive (
87+ self ,
88+ ** kwargs # type: Any
89+ ): # type: (...) -> None
90+
91+ return self ._call_connection_client .keep_alive (
92+ call_connection_id = self .call_connection_id ,
93+ ** kwargs
94+ )
95+
6296 @distributed_trace ()
6397 def cancel_all_media_operations (
6498 self ,
@@ -146,6 +180,34 @@ def remove_participant(
146180 ** kwargs
147181 )
148182
183+ @distributed_trace ()
184+ def get_participants (
185+ self ,
186+ ** kwargs # type: Any
187+ ): # type: (...) -> List[CallParticipant]
188+
189+ return self ._call_connection_client .get_participants (
190+ call_connection_id = self .call_connection_id ,
191+ ** kwargs
192+ )
193+
194+ @distributed_trace ()
195+ def get_participant (
196+ self ,
197+ participant , # type: CommunicationIdentifier
198+ ** kwargs # type: Any
199+ ): # type: (...) -> List[CallParticipant]
200+
201+ get_participant_request = GetParticipantRequestConverter .convert (
202+ identifier = serialize_identifier (participant )
203+ )
204+
205+ return self ._call_connection_client .get_participant (
206+ call_connection_id = self .call_connection_id ,
207+ get_participant_request = get_participant_request ,
208+ ** kwargs
209+ )
210+
149211 @distributed_trace ()
150212 def play_audio_to_participant (
151213 self ,
@@ -207,24 +269,192 @@ def cancel_participant_media_operation(
207269 ** kwargs
208270 )
209271
272+ @distributed_trace ()
273+ def mute_participant (
274+ self ,
275+ participant , # type: CommunicationIdentifier
276+ ** kwargs # type: Any
277+ ): # type: (...) -> None
278+
279+ if not participant :
280+ raise ValueError ("participant can not be None" )
281+
282+ mute_participant_request = MuteParticipantRequestConverter .convert (
283+ identifier = serialize_identifier (participant )
284+ )
285+
286+ return self ._call_connection_client .mute_participant (
287+ call_connection_id = self .call_connection_id ,
288+ mute_participant_request = mute_participant_request ,
289+ ** kwargs
290+ )
291+
292+ @distributed_trace ()
293+ def unmute_participant (
294+ self ,
295+ participant , # type: CommunicationIdentifier
296+ ** kwargs # type: Any
297+ ): # type: (...) -> None
298+
299+ if not participant :
300+ raise ValueError ("participant can not be None" )
301+
302+ unmute_participant_request = UnmuteParticipantRequestConverter .convert (
303+ identifier = serialize_identifier (participant )
304+ )
305+
306+ return self ._call_connection_client .unmute_participant (
307+ call_connection_id = self .call_connection_id ,
308+ unmute_participant_request = unmute_participant_request ,
309+ ** kwargs
310+ )
311+
312+ @distributed_trace ()
313+ def hold_participant_meeting_audio (
314+ self ,
315+ participant , # type: CommunicationIdentifier
316+ ** kwargs # type: Any
317+ ): # type: (...) -> None
318+
319+ if not participant :
320+ raise ValueError ("participant can not be None" )
321+
322+ hold_meeting_audio_request = HoldMeetingAudioRequestConverter .convert (
323+ identifier = serialize_identifier (participant )
324+ )
325+
326+ return self ._call_connection_client .hold_participant_meeting_audio (
327+ call_connection_id = self .call_connection_id ,
328+ hold_meeting_audio_request = hold_meeting_audio_request ,
329+ ** kwargs
330+ )
331+
332+ @distributed_trace ()
333+ def resume_participant_meeting_audio (
334+ self ,
335+ participant , # type: CommunicationIdentifier
336+ ** kwargs # type: Any
337+ ): # type: (...) -> None
338+
339+ if not participant :
340+ raise ValueError ("participant can not be None" )
341+
342+ resume_participant_meeting_audio_request = ResumeMeetingAudioRequestConverter .convert (
343+ identifier = serialize_identifier (participant )
344+ )
345+
346+ return self ._call_connection_client .resume_participant_meeting_audio (
347+ call_connection_id = self .call_connection_id ,
348+ resume_meeting_audio_request = resume_participant_meeting_audio_request ,
349+ ** kwargs
350+ )
351+
210352 @distributed_trace ()
211353 def transfer_call (
212354 self ,
213355 target_participant , # type: CommunicationIdentifier
356+ target_call_connection_id , # type: str
214357 user_to_user_information = None , # type: Optional[str]
358+ operation_context = None , # type: str
359+ callback_uri = None , # type: str
215360 ** kwargs # type: Any
216361 ): # type: (...) -> None
217362
218363 if not target_participant :
219364 raise ValueError ("target_participant can not be None" )
365+ if not target_call_connection_id :
366+ raise ValueError ("target_call_connection_id can not be None" )
220367
221368 transfer_call_request = TransferCallRequestConverter .convert (
222369 target_participant = serialize_identifier (target_participant ),
223- user_to_user_information = user_to_user_information
370+ target_call_connection_id = target_call_connection_id ,
371+ user_to_user_information = user_to_user_information ,
372+ operation_context = operation_context ,
373+ callback_uri = callback_uri
224374 )
225375
226376 return self ._call_connection_client .transfer (
227377 call_connection_id = self .call_connection_id ,
228378 transfer_call_request = transfer_call_request ,
229379 ** kwargs
230380 )
381+
382+ @distributed_trace ()
383+ def create_audio_routing_group (
384+ self ,
385+ audio_routing_mode , # type: AudioRoutingMode
386+ targets , # type: List[CommunicationIdentifier]
387+ ** kwargs # type: Any
388+ ): # type: (...) -> CreateAudioRoutingGroupResult
389+
390+ if not audio_routing_mode :
391+ raise ValueError ("audio_routing_mode can not be None" )
392+ if not targets :
393+ raise ValueError ("targets can not be None" )
394+
395+ audio_routing_group_request = AudioRoutingGroupRequestConverter .convert (
396+ audio_routing_mode = audio_routing_mode ,
397+ target_identities = [serialize_identifier (m ) for m in targets ]
398+ )
399+
400+ return self ._call_connection_client .create_audio_routing_group (
401+ call_connection_id = self .call_connection_id ,
402+ audio_routing_group_request = audio_routing_group_request ,
403+ ** kwargs
404+ )
405+
406+ @distributed_trace ()
407+ def get_audio_routing_groups (
408+ self ,
409+ audio_routing_group_id , # type: str
410+ ** kwargs # type: Any
411+ ): # type: (...) -> AudioRoutingGroupResult
412+
413+ if not audio_routing_group_id :
414+ raise ValueError ("audio_routing_group_id can not be None" )
415+
416+ return self ._call_connection_client .get_audio_routing_groups (
417+ call_connection_id = self .call_connection_id ,
418+ audio_routing_group_id = audio_routing_group_id ,
419+ ** kwargs
420+ )
421+
422+ @distributed_trace ()
423+ def delete_audio_routing_group (
424+ self ,
425+ audio_routing_group_id , # type: str
426+ ** kwargs # type: Any
427+ ): # type: (...) -> None
428+
429+ if not audio_routing_group_id :
430+ raise ValueError ("audio_routing_group_id can not be None" )
431+
432+ return self ._call_connection_client .delete_audio_routing_group (
433+ call_connection_id = self .call_connection_id ,
434+ audio_routing_group_id = audio_routing_group_id ,
435+ ** kwargs
436+ )
437+
438+ @distributed_trace ()
439+ def update_audio_routing_group (
440+ self ,
441+ audio_routing_group_id , # type: str
442+ targets , # type: List[CommunicationIdentifier]
443+ ** kwargs # type: Any
444+ ): # type: (...) -> None
445+
446+ if not audio_routing_group_id :
447+ raise ValueError ("audio_routing_group_id can not be None" )
448+ if not targets :
449+ raise ValueError ("targets can not be None" )
450+
451+ update_audio_routing_group_request = UpdateAudioRoutingGroupRequestConverter .convert (
452+ target_identities = [serialize_identifier (m ) for m in targets ]
453+ )
454+
455+ return self ._call_connection_client .update_audio_routing_group (
456+ call_connection_id = self .call_connection_id ,
457+ audio_routing_group_id = audio_routing_group_id ,
458+ update_audio_routing_group_request = update_audio_routing_group_request ,
459+ ** kwargs
460+ )
0 commit comments