diff --git a/sdk/communication/azure-communication-callingserver/README.md b/sdk/communication/azure-communication-callingserver/README.md index 411e0f7486aa..7bce093d06d9 100644 --- a/sdk/communication/azure-communication-callingserver/README.md +++ b/sdk/communication/azure-communication-callingserver/README.md @@ -122,12 +122,12 @@ from azure.communication.callingserver import ( ) play_audio_result = await call_connection_async.play_audio( - audio_file_uri="", + audio_url="", play_audio_options=PlayAudioOptions"<...>")) ) ``` -- `audio_file_uri`: The uri of the audio file. +- `audio_url`: The uri of the audio file. - `play_audio_options`: The playAudio options. ### Cancel all media operations in the call connection @@ -164,7 +164,7 @@ call_connection = await callingserver_client.join_call( - `call_locator`: The callLocator contains the call id. - `source`: The source identity which join the call. -- `play_audio_options`: The joinCall options. +- `join_call_options`: The joinCall options. ### Add participant with calllocator to the server call Once the call is establised, the `add_participant` method can be invoked: @@ -217,13 +217,13 @@ from azure.communication.callingserver import ( call_locator = ServerCallLocator("") play_audio_result = await callingserver_client.play_audio( call_locator=call_locator, - audio_file_uri="", + audio_url="", play_audio_options=PlayAudioOptions"<...>")) ) ``` - `call_locator`: The callLocator contains the call id. -- `audio_file_uri`: The uri of the audio file. +- `audio_url`: The uri of the audio file. - `play_audio_options`: The playAudio options. ### Cancel media operations with calllocator in the server call @@ -241,7 +241,7 @@ cancel_all_media_operations_result = await call_connection_async.cancel_media_op ) ``` -- `audio_file_uri`: The callLocator contains the call id. +- `call_locator`: The callLocator contains the call id. - `media_operation_id`: The operationId of the media operation to cancel. diff --git a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/__init__.py b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/__init__.py index 1fd8ce6cd145..9aa08ba587b6 100644 --- a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/__init__.py +++ b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/__init__.py @@ -9,19 +9,14 @@ from ._call_connection import CallConnection from ._callingserver_client import CallingServerClient from ._generated.models import (AudioRoutingMode, AddParticipantResult, CallConnectionProperties, - CallRejectReason, CreateCallRequest, PhoneNumberIdentifierModel, - PlayAudioRequest, PlayAudioResult, CallParticipant, + CallRejectReason, PlayAudioResult, CallParticipant, CallMediaType, CallingEventSubscriptionType, CallingOperationStatus, CallConnectionStateChangedEvent, ToneReceivedEvent, ToneInfo, - PlayAudioResultEvent, CommunicationIdentifierModel, - CommunicationUserIdentifierModel, AddParticipantResultEvent, + PlayAudioResultEvent, AddParticipantResultEvent, CallConnectionState, ToneValue, AnswerCallResult, AudioRoutingGroupResult, - CreateAudioRoutingGroupResult) + CreateAudioRoutingGroupResult, TransferCallResult) from ._models import ( - CreateCallOptions, - JoinCallOptions, - PlayAudioOptions, CallLocator, GroupCallLocator, ServerCallLocator, @@ -39,16 +34,10 @@ 'CallingServerClient', 'CommunicationIdentifier', 'CommunicationUserIdentifier', - 'CreateCallOptions', - 'CreateCallRequest', 'CallingEventSubscriptionType', - 'JoinCallOptions', 'CallMediaType', 'CallingOperationStatus', 'PhoneNumberIdentifier', - 'PhoneNumberIdentifierModel', - 'PlayAudioOptions', - 'PlayAudioRequest', 'PlayAudioResult', 'CallLocator', 'GroupCallLocator', @@ -57,14 +46,13 @@ 'ToneReceivedEvent', 'ToneInfo', 'PlayAudioResultEvent', - 'CommunicationIdentifierModel', - 'CommunicationUserIdentifierModel', 'AddParticipantResultEvent', 'CallConnectionState', 'ToneValue', 'CallingServerEventType', 'AnswerCallResult', 'AudioRoutingGroupResult', - 'CreateAudioRoutingGroupResult' + 'CreateAudioRoutingGroupResult', + 'TransferCallResult' ] __version__ = VERSION diff --git a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_call_connection.py b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_call_connection.py index b735c23b91ad..9363e987a3eb 100644 --- a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_call_connection.py +++ b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_call_connection.py @@ -4,9 +4,8 @@ # license information. # -------------------------------------------------------------------------- # pylint: disable=too-many-public-methods -from typing import TYPE_CHECKING, List, Any, Optional # pylint: disable=unused-import +from typing import TYPE_CHECKING, List, Any # pylint: disable=unused-import from azure.core.tracing.decorator import distributed_trace -from .utils._utils import CallingServerUtils from ._communication_identifier_serializer import serialize_identifier from ._converters import ( AddParticipantRequestConverter, @@ -30,6 +29,7 @@ PlayAudioResult, AudioRoutingGroupResult, CreateAudioRoutingGroupResult, + TransferCallResult, CallParticipant, AudioRoutingMode ) @@ -37,13 +37,21 @@ if TYPE_CHECKING: from ._generated.operations import CallConnectionsOperations - from ._models import PlayAudioOptions class CallConnection(object): + """An client to interact with the AzureCommunicationService Callingserver gateway. + + This client provides operations on top of a established call connection. + + :param str call_connection_id: + The id of this call connection. + :param CallConnectionsOperations call_connection_client: + The call connection client. + """ def __init__( self, call_connection_id, # type: str - call_connection_client # type: CallConnectionsOperations + call_connection_client, # type: CallConnectionsOperations ): # type: (...) -> None self.call_connection_id = call_connection_id @@ -54,7 +62,12 @@ def get_call( self, **kwargs # type: Any ): # type: (...) -> CallConnectionProperties + """Get CallConnectionProperties of this CallConnection. + :return: CallConnectionProperties + :rtype: ~azure.communication.callingserver.CallConnectionProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ return self._call_connection_client.get_call( call_connection_id=self.call_connection_id, **kwargs @@ -65,7 +78,13 @@ def delete_call( self, **kwargs # type: Any ): # type: (...) -> None + """Terminates the conversation for all participants in the call. + + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ return self._call_connection_client.delete_call( call_connection_id=self.call_connection_id, **kwargs @@ -76,7 +95,13 @@ def hang_up( self, **kwargs # type: Any ): # type: (...) -> None + """Hangup the call. + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + + """ return self._call_connection_client.hangup_call( call_connection_id=self.call_connection_id, **kwargs @@ -87,7 +112,13 @@ def keep_alive( self, **kwargs # type: Any ): # type: (...) -> None + """Keep the call alive. + + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ return self._call_connection_client.keep_alive( call_connection_id=self.call_connection_id, **kwargs @@ -98,7 +129,13 @@ def cancel_all_media_operations( self, **kwargs # type: Any ): # type: (...) -> None + """Cancels all the currently active and pending PlayAudio operations in the call. + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + + """ return self._call_connection_client.cancel_all_media_operations( call_connection_id=self.call_connection_id, **kwargs @@ -107,31 +144,47 @@ def cancel_all_media_operations( @distributed_trace() def play_audio( self, - audio_file_uri, # type: str - play_audio_options, # type: PlayAudioOptions + audio_url, # type: str + is_looped=False, # type: bool **kwargs # type: Any ): # type: (...) -> PlayAudioResult - - if not audio_file_uri: - raise ValueError("audio_file_uri can not be None") - - if not CallingServerUtils.is_valid_url(audio_file_uri): - raise ValueError("audio_file_uri is invalid") - - if not play_audio_options: - raise ValueError("options can not be None") - - if not play_audio_options.audio_file_id: - raise ValueError("audio_file_id can not be None") - - if not CallingServerUtils.is_valid_url(play_audio_options.callback_uri): - raise ValueError("callback_uri is invalid") - - play_audio_request = PlayAudioRequestConverter.convert(audio_file_uri, play_audio_options) + """Play audio in the call. + + :param audio_url: Required. The media resource uri of the play audio request. + Currently only Wave file (.wav) format audio prompts are supported. + More specifically, the audio content in the wave file must be mono (single-channel), + 16-bit samples with a 16,000 (16KHz) sampling rate. + :type audio_url: str + :param is_looped: The flag indicating whether audio file needs to be played in loop or + not. + :type is_looped: bool + :keyword operation_context: The value to identify context of the operation. + :paramtype operation_context: str + :keyword audio_file_id: An id for the media in the AudioFileUri, using which we cache the media + resource. + :paramtype audio_file_id: str + :keyword callback_uri: The callback Uri to receive PlayAudio status notifications. + :paramtype callback_uri: str + :return: PlayAudioResult + :rtype: ~azure.communication.callingserver.PlayAudioResult + :raises: ~azure.core.exceptions.HttpResponseError + + """ + operation_context = kwargs.pop("operation_context", None) + audio_file_id = kwargs.pop("audio_file_id", None) + callback_uri = kwargs.pop("callback_uri", None) + + play_audio_request = PlayAudioRequestConverter.convert( + audio_url=audio_url, + loop=is_looped, + operation_context=operation_context, + audio_file_id=audio_file_id, + callback_uri=callback_uri + ) return self._call_connection_client.play_audio( call_connection_id=self.call_connection_id, - request=play_audio_request, + play_audio_request=play_audio_request, **kwargs ) @@ -139,13 +192,23 @@ def play_audio( def add_participant( self, participant, # type: CommunicationIdentifier - alternate_caller_id=None, # type: Optional[str] - operation_context=None, # type: Optional[str] **kwargs # type: Any ): # type: (...) -> AddParticipantResult - - if not participant: - raise ValueError("participant can not be None") + """Add participant to the call connection. + + :param participant: Required. The participant identity. + :type participant: ~azure.communication.callingserver.models.CommunicationIdentifier + :keyword alternate_caller_id: The alternate caller id. + :paramtype alternate_caller_id: str + :keyword operation_context: The operation context. + :paramtype operation_context: str + :return: AddParticipantResult + :rtype: ~azure.communication.callingserver.AddParticipantResult + :raises: ~azure.core.exceptions.HttpResponseError + + """ + alternate_caller_id = kwargs.pop("alternate_caller_id", None) + operation_context = kwargs.pop("operation_context", None) alternate_caller_id = (None if alternate_caller_id is None @@ -169,7 +232,15 @@ def remove_participant( participant, # type: CommunicationIdentifier **kwargs # type: Any ): # type: (...) -> None + """Remove participant from the call using identifier. + + :param participant: Required. The identifier of the participant to be removed from the call. + :type participant: ~azure.communication.callingserver.models.CommunicationIdentifier + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ remove_participant_request = RemoveParticipantRequestConverter.convert( identifier=serialize_identifier(participant) ) @@ -181,11 +252,17 @@ def remove_participant( ) @distributed_trace() - def get_participants( + def list_participants( self, **kwargs # type: Any ): # type: (...) -> List[CallParticipant] + """Get participants from a call. + + :return: List[CallParticipant] + :rtype: List[~azure.communication.callingserver.models.CallParticipant] + :raises: ~azure.core.exceptions.HttpResponseError + """ return self._call_connection_client.get_participants( call_connection_id=self.call_connection_id, **kwargs @@ -197,7 +274,15 @@ def get_participant( participant, # type: CommunicationIdentifier **kwargs # type: Any ): # type: (...) -> List[CallParticipant] + """Get participant from the call using identifier. + :param participant: Required. The identifier of the target participant. + :type participant: ~azure.communication.callingserver.models.CommunicationIdentifier + :return: List[CallParticipant] + :rtype: List[~azure.communication.callingserver.models.CallParticipant] + :raises: ~azure.core.exceptions.HttpResponseError + + """ get_participant_request = GetParticipantRequestConverter.convert( identifier=serialize_identifier(participant) ) @@ -212,30 +297,45 @@ def get_participant( def play_audio_to_participant( self, participant, # type: CommunicationIdentifier - audio_file_uri, # type: str - play_audio_options, # type: PlayAudioOptions + audio_url, # type: str + is_looped=False, # type: bool **kwargs # type: Any ): # type: (...) -> PlayAudioResult - - if not participant: - raise ValueError("participant can not be None") - - if not audio_file_uri: - raise ValueError("audio_file_uri can not be None") - - if not CallingServerUtils.is_valid_url(audio_file_uri): - raise ValueError("audio_file_uri is invalid") - - if not play_audio_options: - raise ValueError("play_audio_options can not be None") - - if not CallingServerUtils.is_valid_url(play_audio_options.callback_uri): - raise ValueError("callback_uri is invalid") + """Play audio to a participant. + + :param participant: Required. The media resource uri of the play audio request. + :type participant: str + :param audio_url: Required. The media resource uri of the play audio request. + Currently only Wave file (.wav) format audio prompts are supported. + More specifically, the audio content in the wave file must be mono (single-channel), + 16-bit samples with a 16,000 (16KHz) sampling rate. + :type audio_url: str + :param is_looped: The flag indicating whether audio file needs to be played in loop or + not. + :type is_looped: bool + :keyword operation_context: The value to identify context of the operation. + :paramtype operation_context: str + :keyword audio_file_id: An id for the media in the AudioFileUri, using which we cache the media + resource. + :paramtype audio_file_id: str + :keyword callback_uri: The callback Uri to receive PlayAudio status notifications. + :paramtype callback_uri: str + :return: PlayAudioResult + :rtype: ~azure.communication.callingserver.PlayAudioResult + :raises: ~azure.core.exceptions.HttpResponseError + + """ + operation_context = kwargs.pop("operation_context", None) + audio_file_id = kwargs.pop("audio_file_id", None) + callback_uri = kwargs.pop("callback_uri", None) play_audio_to_participant_request = PlayAudioToParticipantRequestConverter.convert( identifier=serialize_identifier(participant), - audio_file_uri=audio_file_uri, - play_audio_options=play_audio_options + audio_url=audio_url, + loop=is_looped, + operation_context=operation_context, + audio_file_id=audio_file_id, + callback_uri=callback_uri ) return self._call_connection_client.participant_play_audio( @@ -251,13 +351,17 @@ def cancel_participant_media_operation( media_operation_id, # type: str **kwargs # type: Any ): # type: (...) -> None + """Cancel media operation for a participant. - if not participant: - raise ValueError("participant can not be None") - - if not media_operation_id: - raise ValueError("media_operation_id can not be None") + :param participant: Required. The identifier of the participant. + :type participant: ~azure.communication.callingserver.models.CommunicationIdentifier + :param media_operation_id: Required. The operationId of the media operation to cancel. + :type media_operation_id: str + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ cancel_media_operation_request = CancelParticipantMediaOperationRequestConverter.convert( identifier=serialize_identifier(participant), media_operation_id=media_operation_id @@ -275,10 +379,15 @@ def mute_participant( participant, # type: CommunicationIdentifier **kwargs # type: Any ): # type: (...) -> None + """Mutes the participant. - if not participant: - raise ValueError("participant can not be None") + :param participant: Required. The identifier of the participant to be muted in the call. + :type participant: ~azure.communication.callingserver.models.CommunicationIdentifier + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ mute_participant_request = MuteParticipantRequestConverter.convert( identifier=serialize_identifier(participant) ) @@ -295,10 +404,15 @@ def unmute_participant( participant, # type: CommunicationIdentifier **kwargs # type: Any ): # type: (...) -> None + """Unmute participant in the call. - if not participant: - raise ValueError("participant can not be None") + :param participant: Required. The identifier of the participant to be unmute in the call. + :type participant: ~azure.communication.callingserver.models.CommunicationIdentifier + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ unmute_participant_request = UnmuteParticipantRequestConverter.convert( identifier=serialize_identifier(participant) ) @@ -315,10 +429,16 @@ def hold_participant_meeting_audio( participant, # type: CommunicationIdentifier **kwargs # type: Any ): # type: (...) -> None + """Removes the participant from the meeting's default audio mix so the participant + does not hear anything from the meeting and cannot add audio into the meeting. - if not participant: - raise ValueError("participant can not be None") + :param participant: Required. The identifier of the participant. + :type participant: ~azure.communication.callingserver.models.CommunicationIdentifier + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ hold_meeting_audio_request = HoldMeetingAudioRequestConverter.convert( identifier=serialize_identifier(participant) ) @@ -335,10 +455,16 @@ def resume_participant_meeting_audio( participant, # type: CommunicationIdentifier **kwargs # type: Any ): # type: (...) -> None + """Adds the participant back into the meeting's default audio mix so the participant + begins to hear everything from the meeting and can add audio into the meeting. - if not participant: - raise ValueError("participant can not be None") + :param participant: Required. The identifier of the participant. + :type participant: ~azure.communication.callingserver.models.CommunicationIdentifier + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ resume_participant_meeting_audio_request = ResumeMeetingAudioRequestConverter.convert( identifier=serialize_identifier(participant) ) @@ -350,27 +476,44 @@ def resume_participant_meeting_audio( ) @distributed_trace() - def transfer_call( + def transfer( self, target_participant, # type: CommunicationIdentifier target_call_connection_id, # type: str - user_to_user_information=None, # type: Optional[str] - operation_context=None, # type: str - callback_uri=None, # type: str **kwargs # type: Any - ): # type: (...) -> None + ): # type: (...) -> TransferCallResult + """Transfer the call. + + :param target_participant: Required. The target participant. + :type target_participant: ~azure.communication.callingserver.models.CommunicationIdentifier + :param target_call_connection_id: The target call connection id to transfer to. + :type target_call_connection_id: str + :keyword alternate_caller_id: The alternate identity of the transferor if transferring to a pstn + number. + :paramtype alternate_caller_id: str + :keyword user_to_user_information: The user to user information. + :paramtype user_to_user_information: str + :keyword operation_context: The operation context. + :paramtype operation_context: str + :return: TransferCallResult + :rtype: ~azure.communication.callingserver.TransferCallResult + :raises: ~azure.core.exceptions.HttpResponseError + + """ + alternate_caller_id = kwargs.pop("alternate_caller_id", None) + user_to_user_information = kwargs.pop("user_to_user_information", None) + operation_context = kwargs.pop("operation_context", None) - if not target_participant: - raise ValueError("target_participant can not be None") - if not target_call_connection_id: - raise ValueError("target_call_connection_id can not be None") + alternate_caller_id = (None + if alternate_caller_id is None + else PhoneNumberIdentifierModel(value=alternate_caller_id)) transfer_call_request = TransferCallRequestConverter.convert( target_participant=serialize_identifier(target_participant), target_call_connection_id=target_call_connection_id, + alternate_caller_id=alternate_caller_id, user_to_user_information=user_to_user_information, - operation_context=operation_context, - callback_uri=callback_uri + operation_context=operation_context ) return self._call_connection_client.transfer( @@ -386,12 +529,19 @@ def create_audio_routing_group( targets, # type: List[CommunicationIdentifier] **kwargs # type: Any ): # type: (...) -> CreateAudioRoutingGroupResult - - if not audio_routing_mode: - raise ValueError("audio_routing_mode can not be None") - if not targets: - raise ValueError("targets can not be None") - + """Create audio routing group in a call. + + :param audio_routing_mode: Required. The audio routing mode. Possible values include: + "oneToOne", "multicast". + :type audio_routing_mode: str or ~azure.communication.callingserver.models.AudioRoutingMode + :param targets: Required. The target identities that would be receivers in the audio routing + group. + :type targets: list[~azure.communication.callingserver.models.CommunicationIdentifier] + :return: CreateAudioRoutingGroupResult + :rtype: ~azure.communication.callingserver.models.CreateAudioRoutingGroupResult + :raises: ~azure.core.exceptions.HttpResponseError + + """ audio_routing_group_request = AudioRoutingGroupRequestConverter.convert( audio_routing_mode=audio_routing_mode, target_identities=[serialize_identifier(m) for m in targets] @@ -404,15 +554,20 @@ def create_audio_routing_group( ) @distributed_trace() - def get_audio_routing_groups( + def list_audio_routing_groups( self, audio_routing_group_id, # type: str **kwargs # type: Any ): # type: (...) -> AudioRoutingGroupResult + """List audio routing group in a call. - if not audio_routing_group_id: - raise ValueError("audio_routing_group_id can not be None") + :param audio_routing_group_id: Required. The audio routing group id. + :type audio_routing_group_id: str + :return: AudioRoutingGroupResult + :rtype: ~azure.communication.callingserver.models.AudioRoutingGroupResult + :raises: ~azure.core.exceptions.HttpResponseError + """ return self._call_connection_client.get_audio_routing_groups( call_connection_id=self.call_connection_id, audio_routing_group_id=audio_routing_group_id, @@ -425,10 +580,15 @@ def delete_audio_routing_group( audio_routing_group_id, # type: str **kwargs # type: Any ): # type: (...) -> None + """Delete audio routing group from a call. - if not audio_routing_group_id: - raise ValueError("audio_routing_group_id can not be None") + :param audio_routing_group_id: Required. The audio routing group id. + :type audio_routing_group_id: str + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ return self._call_connection_client.delete_audio_routing_group( call_connection_id=self.call_connection_id, audio_routing_group_id=audio_routing_group_id, @@ -442,12 +602,18 @@ def update_audio_routing_group( targets, # type: List[CommunicationIdentifier] **kwargs # type: Any ): # type: (...) -> None - - if not audio_routing_group_id: - raise ValueError("audio_routing_group_id can not be None") - if not targets: - raise ValueError("targets can not be None") - + """Update audio routing group. + + :param audio_routing_group_id: Required. The audio routing group id. + :type audio_routing_group_id: str + :param targets: Required. The target identities that would be receivers in the audio routing + group. + :type targets: list[~azure.communication.callingserver.models.CommunicationIdentifier] + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + + """ update_audio_routing_group_request = UpdateAudioRoutingGroupRequestConverter.convert( target_identities=[serialize_identifier(m) for m in targets] ) diff --git a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_callingserver_client.py b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_callingserver_client.py index d472ead87f17..cdccfb9aeaa1 100644 --- a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_callingserver_client.py +++ b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_callingserver_client.py @@ -4,7 +4,7 @@ # license information. # -------------------------------------------------------------------------- # pylint: disable=too-many-public-methods -from typing import TYPE_CHECKING, Any, List, Optional # pylint: disable=unused-import +from typing import TYPE_CHECKING, Any, List # pylint: disable=unused-import from azure.core.tracing.decorator import distributed_trace from azure.core.pipeline.transport import HttpResponse from azure.core.exceptions import ( @@ -28,14 +28,10 @@ CallRecordingProperties, StartCallRecordingWithCallLocatorRequest, StartCallRecordingResult, - RecordingContentType, - RecordingChannelType, - RecordingFormatType, CallParticipant, CallMediaType, CallingEventSubscriptionType, - AnswerCallResult, - CallRejectReason + AnswerCallResult ) from ._shared.models import CommunicationIdentifier @@ -52,11 +48,7 @@ CancelMediaOperationWithCallLocatorRequestConverter, CancelParticipantMediaOperationWithCallLocatorRequestConverter, GetAllParticipantsWithCallLocatorRequestConverter, - GetParticipantWithCallLocatorRequestConverter, - MuteParticipantWithCallLocatorRequestConverter, - UnmuteParticipantWithCallLocatorRequestConverter, - HoldMeetingAudioWithCallLocatorRequestConverter, - ResumeMeetingAudioWithCallLocatorRequestConverter + GetParticipantWithCallLocatorRequestConverter ) from ._shared.utils import get_authentication_policy, get_host_header_policy, parse_connection_str from ._version import SDK_MONIKER @@ -64,9 +56,6 @@ if TYPE_CHECKING: from azure.core.credentials import TokenCredential from ._models import ( - CreateCallOptions, - JoinCallOptions, - PlayAudioOptions, ParallelDownloadOptions, CallLocator ) @@ -143,58 +132,72 @@ def from_connection_string( def get_call_connection( self, - call_connection_id # type: str + call_connection_id, # type: str + **kwargs # type: Any ): # type: (...) -> CallConnection """Initializes a new instance of CallConnection. :param str call_connection_id: - The thread id for the ChatThreadClient instance. + The call connection id for the CallConnection instance. :returns: Instance of CallConnection. - :rtype: ~azure.communication..callingserver.CallConnection + :rtype: ~azure.communication.callingserver.CallConnection """ + if not call_connection_id: raise ValueError("call_connection_id can not be None") - return CallConnection(call_connection_id, self._call_connection_client) + return CallConnection( + call_connection_id, + self._call_connection_client, + **kwargs + ) @distributed_trace() def create_call_connection( self, source, # type: CommunicationIdentifier targets, # type: List[CommunicationIdentifier] - options, # type: CreateCallOptions + callback_uri, # type: str + requested_media_types, # type: List[CallMediaType] + requested_call_events, # type: List[CallingEventSubscriptionType] **kwargs # type: Any ): # type: (...) -> CallConnection """Create an outgoing call from source to target identities. - :param CommunicationIdentifier source: - The source identity. - :param List[CommunicationIdentifier] targets: - The target identities. - :param CreateCallOptions options: - The call options. - :returns: CallConnection for a successful creating callConnection request. + :param source: Required. The source identity. + :type source: CommunicationIdentifier + :param targets: The target identities. + :type targets: list[~azure.communication.callingserver.models.CommunicationIdentifier] + :param callback_uri: The callback uri. + :type callback_uri: str + :param requested_media_types: The requested modalities. + :type requested_media_types: list[str or + ~azure.communication.callingserver.models.CallMediaType] + :param requested_call_events: The requested call events to subscribe to. + :type requested_call_events: list[str or + ~azure.communication.callingserver.models.CallingEventSubscriptionType] + :keyword alternate_Caller_Id: The alternate caller id. + :paramtype alternate_Caller_Id: str + :keyword subject: The subject. + :paramtype subject: str + :return: CallConnection :rtype: ~azure.communication.callingserver.CallConnection - """ - if not source: - raise ValueError("source can not be None") - - if not targets: - raise ValueError("targets can not be None or empty") + :raises: ~azure.core.exceptions.HttpResponseError - if not options: - raise ValueError("options can not be None") + """ + alternate_Caller_Id = kwargs.pop("alternate_Caller_Id", None) + subject = kwargs.pop("subject", None) request = CreateCallRequest( source=serialize_identifier(source), targets=[serialize_identifier(m) for m in targets], - callback_uri=options.callback_uri, - requested_media_types=options.requested_media_types, - requested_call_events=options.requested_call_events, + callback_uri=callback_uri, + requested_media_types=requested_media_types, + requested_call_events=requested_call_events, alternate_caller_id=(None - if options.alternate_Caller_Id is None - else PhoneNumberIdentifierModel(value=options.alternate_Caller_Id.properties['value'])), - subject=options.subject + if alternate_Caller_Id is None + else PhoneNumberIdentifierModel(value=alternate_Caller_Id)), + subject=subject ) create_call_response = self._call_connection_client.create_call( @@ -209,32 +212,44 @@ def join_call( self, call_locator, # type: CallLocator source, # type: CommunicationIdentifier - call_options, # type: JoinCallOptions + callback_uri, # type: str + requested_media_types, # type: List[CallMediaType] + requested_call_events, # type: List[CallingEventSubscriptionType] **kwargs # type: Any ): # type: (...) -> CallConnection """Join the call using call_locator. - :param CallLocator call_locator: - The callLocator. - :param CommunicationIdentifier targets: - The source identity. - :param JoinCallOptions options: - The call Options. - :returns: CallConnection for a successful join request. + :param call_locator: Required. The call locator. + :type call_locator: ~azure.communication.callingserver.models.CallLocator + :param source: Required. The source identity. + :type source: CommunicationIdentifier + :param targets: The target identities. + :type targets: list[~azure.communication.callingserver.models.CommunicationIdentifier] + :param callback_uri: The callback uri. + :type callback_uri: str + :param requested_media_types: The requested modalities. + :type requested_media_types: list[str or + ~azure.communication.callingserver.models.CallMediaType] + :param requested_call_events: The requested call events to subscribe to. + :type requested_call_events: list[str or + ~azure.communication.callingserver.models.CallingEventSubscriptionType] + :keyword subject: The subject. + :paramtype subject: str + :return: CallConnection :rtype: ~azure.communication.callingserver.CallConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ - if not call_locator: - raise ValueError("call_locator can not be None") - if not source: - raise ValueError("source can not be None") - if not call_options: - raise ValueError("call_options can not be None") + subject = kwargs.pop("subject", None) join_call_request = JoinCallRequestConverter.convert( call_locator=serialize_call_locator(call_locator), source=serialize_identifier(source), - join_call_options=call_options - ) + callback_uri=callback_uri, + requested_media_types=requested_media_types, + requested_call_events=requested_call_events, + subject=subject + ) join_call_response = self._server_call_client.join_call( call_request=join_call_request, @@ -250,14 +265,28 @@ def join_call( def answer_call( self, incoming_call_context, # type: str - callback_uri=None, # type: str - requested_media_types=None, # type: List[CallMediaType] - requested_call_events=None, # type: List[CallingEventSubscriptionType] **kwargs # type: Any ): # type: (...) -> AnswerCallResult + """Answer the call. + + :param incoming_call_context: Required. The context associated with the call. + :type incoming_call_context: str + :keyword callback_uri: The callback uri. + :paramtype callback_uri: str + :keyword requested_media_types: The requested modalities. + :paramtype requested_media_types: list[str or + ~azure.communication.callingserver.models.CallMediaType] + :keyword requested_call_events: The requested call events to subscribe to. + :paramtype requested_call_events: list[str or + ~azure.communication.callingserver.models.CallingEventSubscriptionType] + :return: AnswerCallResult + :rtype: ~azure.communication.callingserver.AnswerCallResult + :raises: ~azure.core.exceptions.HttpResponseError - if not incoming_call_context: - raise ValueError("incoming_call_context can not be None") + """ + callback_uri = kwargs.pop("callback_uri", None) + requested_media_types = kwargs.pop("requested_media_types", None) + requested_call_events = kwargs.pop("requested_call_events", None) answer_call_request = AnswerCallRequestConverter.convert( incoming_call_context=incoming_call_context, @@ -275,13 +304,23 @@ def answer_call( def reject_call( self, incoming_call_context, # type: str - call_reject_reason=None, # type: CallRejectReason - callback_uri=None, # type: str **kwargs # type: Any ): # type: (...) -> None + """Answer the call. + + :param incoming_call_context: Required. The context associated with the call. + :type incoming_call_context: str + :keyword call_reject_reason: The rejection reason. Possible values include: "none", "busy", + "forbidden". + :paramtype call_reject_reason: str or ~azure.communication.callingserver.models.CallRejectReason + :keyword callback_uri: The callback uri. + :paramtype callback_uri: str + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError - if not incoming_call_context: - raise ValueError("incoming_call_context can not be None") + """ + call_reject_reason = kwargs.pop("call_reject_reason", None) + callback_uri = kwargs.pop("callback_uri", None) reject_call_request = RejectCallRequestConverter.convert( incoming_call_context=incoming_call_context, @@ -299,13 +338,25 @@ def redirect_call( self, incoming_call_context, # type: str targets, # type: List[CommunicationIdentifier] - callback_uri=None, # type: str - timeout_in_seconds=None, # type: int **kwargs # type: Any ): # type: (...) -> None + """Redirect the call. + + :param incoming_call_context: Required. The call locator. + :type incoming_call_context: ~azure.communication.callingserver.models.CallLocator + :param targets: Required. The identifier of the participant to be removed from the call. + :type targets: ~azure.communication.callingserver.models.CommunicationIdentifier + :keyword callback_uri: The alternate caller id. + :paramtype callback_uri: str + :keyword timeout_in_seconds: The alternate caller id. + :paramtype timeout_in_seconds: int + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError - if not incoming_call_context: - raise ValueError("incoming_call_context can not be None") + """ + callback_uri = kwargs.pop("callback_uri", None) + timeout_in_seconds = kwargs.pop("timeout_in_seconds", None) redirect_call_request = RedirectCallRequestConverter.convert( incoming_call_context=incoming_call_context, @@ -323,26 +374,45 @@ def redirect_call( def play_audio( self, call_locator, # type: CallLocator - audio_file_uri, # type: str - play_audio_options, # type: PlayAudioOptions + audio_url, # type: str + is_looped=False, # type: bool **kwargs # type: Any ): # type: (...) -> PlayAudioResult + """Redirect the call. + + :param call_locator: Required. The call locator. + :type call_locator: ~azure.communication.callingserver.models.CallLocator + :param audio_url: Required. The media resource uri of the play audio request. + Currently only Wave file (.wav) format audio prompts are supported. + More specifically, the audio content in the wave file must be mono (single-channel), + 16-bit samples with a 16,000 (16KHz) sampling rate. + :type audio_url: str + :param is_looped: The flag indicating whether audio file needs to be played in loop or + not. + :type is_looped: bool + :keyword operation_context: The value to identify context of the operation. + :paramtype operation_context: str + :keyword audio_file_id: An id for the media in the AudioFileUri, using which we cache the media + resource. + :paramtype audio_file_id: str + :keyword callback_uri: The callback Uri to receive PlayAudio status notifications. + :paramtype callback_uri: str + :return: PlayAudioResult + :rtype: ~azure.communication.callingserver.PlayAudioResult + :raises: ~azure.core.exceptions.HttpResponseError - if not call_locator: - raise ValueError("call_locator can not be None") - if not audio_file_uri: - raise ValueError("audio_file_uri can not be None") - if not CallingServerUtils.is_valid_url(audio_file_uri): - raise ValueError("audio_file_uri is invalid") - if not play_audio_options: - raise ValueError("options can not be None") - if not CallingServerUtils.is_valid_url(play_audio_options.callback_uri): - raise ValueError("callback_uri is invalid") + """ + operation_context = kwargs.pop("operation_context", None) + audio_file_id = kwargs.pop("audio_file_id", None) + callback_uri = kwargs.pop("callback_uri", None) play_audio_request = PlayAudioWithCallLocatorRequestConverter.convert( call_locator=serialize_call_locator(call_locator), - audio_file_uri=audio_file_uri, - play_audio_options=play_audio_options + audio_url=audio_url, + loop=is_looped, + operation_context=operation_context, + audio_file_id=audio_file_id, + callback_uri=callback_uri ) return self._server_call_client.play_audio( @@ -355,29 +425,47 @@ def play_audio_to_participant( self, call_locator, # type: CallLocator participant, # type: CommunicationIdentifier - audio_file_uri, # type: str - play_audio_options, # type: PlayAudioOptions + audio_url, # type: str + is_looped: bool = False, **kwargs # type: Any ): # type: (...) -> PlayAudioResult + """Redirect the call. + + :param call_locator: Required. The call locator. + :type call_locator: ~azure.communication.callingserver.models.CallLocator + :param participant: Required. The identifier of the play audio target participant. + :type participant: ~azure.communication.callingserver.models.CommunicationIdentifier + :param audio_url: Required. The media resource uri of the play audio request. + Currently only Wave file (.wav) format audio prompts are supported. + More specifically, the audio content in the wave file must be mono (single-channel), + 16-bit samples with a 16,000 (16KHz) sampling rate. + :type audio_url: str + :param is_looped: The flag indicating whether audio file needs to be played in loop or + not. + :type is_looped: bool + :keyword operation_context: The value to identify context of the operation. + :paramtype operation_context: str + :keyword audio_file_id: An id for the media in the AudioFileUri, using which we cache the media + resource. + :paramtype audio_file_id: str + :keyword callback_uri: The callback Uri to receive PlayAudio status notifications. + :paramtype callback_uri: str + :return: PlayAudioResult + :rtype: ~azure.communication.callingserver.PlayAudioResult + :raises: ~azure.core.exceptions.HttpResponseError - if not call_locator: - raise ValueError("call_locator can not be None") - if not participant: - raise ValueError("participant can not be None") - if not audio_file_uri: - raise ValueError("audio_file_uri can not be None") - if not CallingServerUtils.is_valid_url(audio_file_uri): - raise ValueError("audio_file_uri is invalid") - if not play_audio_options: - raise ValueError("play_audio_options can not be None") - if not CallingServerUtils.is_valid_url(play_audio_options.callback_uri): - raise ValueError("callback_uri is invalid") - + """ + operation_context = kwargs.pop("operation_context", None) + audio_file_id = kwargs.pop("audio_file_id", None) + callback_uri = kwargs.pop("callback_uri", None) play_audio_to_participant_request = PlayAudioToParticipantWithCallLocatorRequestConverter.convert( call_locator=serialize_call_locator(call_locator), identifier=serialize_identifier(participant), - audio_file_uri=audio_file_uri, - play_audio_options=play_audio_options + audio_url=audio_url, + loop=is_looped, + operation_context=operation_context, + audio_file_id=audio_file_id, + callback_uri=callback_uri ) return self._server_call_client.participant_play_audio( @@ -391,15 +479,27 @@ def add_participant( # pylint: disable=too-many-arguments call_locator, # type: CallLocator participant, # type: CommunicationIdentifier callback_uri, # type: str - alternate_caller_id=None, # type: Optional[str] - operation_context=None, # type: Optional[str] **kwargs # type: Any ): # type: (...) -> AddParticipantResult + """Add a participant to the call. + + :param call_locator: Required. The call locator. + :type call_locator: ~azure.communication.callingserver.models.CallLocator + :param participant: Required. The participant to be added to the call. + :type participant: ~azure.communication.callingserver.models.CommunicationIdentifier + :param callback_uri: Required. The callback URI. + :type callback_uri: str + :keyword alternate_caller_id: The alternate caller id. + :paramtype alternate_caller_id: str + :keyword operation_context: The operation context. + :paramtype operation_context: str + :return: AddParticipantResult + :rtype: ~azure.communication.callingserver.AddParticipantResult + :raises: ~azure.core.exceptions.HttpResponseError - if not call_locator: - raise ValueError("call_locator can not be None") - if not participant: - raise ValueError("participant can not be None") + """ + alternate_caller_id = kwargs.pop("alternate_caller_id", None) + operation_context = kwargs.pop("operation_context", None) alternate_caller_id = (None if alternate_caller_id is None @@ -425,12 +525,17 @@ def remove_participant( participant, # type: CommunicationIdentifier **kwargs # type: Any ): # type: (...) -> None + """Remove participant from the call using identifier. - if not call_locator: - raise ValueError("call_locator can not be None") - if not participant: - raise ValueError("participant can not be None") + :param call_locator: Required. The call locator. + :type call_locator: ~azure.communication.callingserver.models.CallLocator + :param participant: Required. The identifier of the participant to be removed from the call. + :type participant: ~azure.communication.callingserver.models.CommunicationIdentifier + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ remove_participant_with_call_locator_request = RemoveParticipantWithCallLocatorRequestConverter.convert( serialize_call_locator(call_locator), serialize_identifier(participant) @@ -442,12 +547,20 @@ def remove_participant( ) @distributed_trace() - def get_participants( + def list_participants( self, call_locator, # type: CallLocator **kwargs # type: Any ): # type: (...) -> List[CallParticipant] + """Get participants from a server call. + :param call_locator: Required. The call locator. + :type call_locator: ~azure.communication.callingserver.models.CallLocator + :return: List[CallParticipant] + :rtype: List[~azure.communication.callingserver.models.CallParticipant] + :raises: ~azure.core.exceptions.HttpResponseError + + """ get_all_participants_with_call_locator_request = GetAllParticipantsWithCallLocatorRequestConverter.convert( serialize_call_locator(call_locator) ) @@ -464,7 +577,17 @@ def get_participant( participant, # type: CommunicationIdentifier **kwargs # type: Any ): # type: (...) -> List[CallParticipant] + """Get participant from the call using identifier. + :param call_locator: Required. The call locator. + :type call_locator: ~azure.communication.callingserver.models.CallLocator + :param participant: Required. The identifier of the target participant. + :type participant: ~azure.communication.callingserver.models.CommunicationIdentifier + :return: list of CallParticipant + :rtype: List[~azure.communication.callingserver.models.CallParticipant] + :raises: ~azure.core.exceptions.HttpResponseError + + """ get_participant_with_call_locator_request = GetParticipantWithCallLocatorRequestConverter.convert( serialize_call_locator(call_locator), serialize_identifier(participant) @@ -475,48 +598,6 @@ def get_participant( **kwargs ) - @distributed_trace() - def mute_participant( - self, - call_locator, # type: CallLocator - participant, # type: CommunicationIdentifier - **kwargs # type: Any - ): # type: (...) -> None - - if not participant: - raise ValueError("participant can not be None") - - mute_participant_with_call_locator_request = MuteParticipantWithCallLocatorRequestConverter.convert( - serialize_call_locator(call_locator), - serialize_identifier(participant) - ) - - return self._server_call_client.mute_participant( - mute_participant_with_call_locator_request=mute_participant_with_call_locator_request, - **kwargs - ) - - @distributed_trace() - def unmute_participant( - self, - call_locator, # type: CallLocator - participant, # type: CommunicationIdentifier - **kwargs # type: Any - ): # type: (...) -> None - - if not participant: - raise ValueError("participant can not be None") - - unmute_participant_with_call_locator_request = UnmuteParticipantWithCallLocatorRequestConverter.convert( - serialize_call_locator(call_locator), - serialize_identifier(participant) - ) - - return self._server_call_client.unmute_participant( - unmute_participant_with_call_locator_request=unmute_participant_with_call_locator_request, - **kwargs - ) - @distributed_trace() def cancel_media_operation( self, @@ -524,12 +605,17 @@ def cancel_media_operation( media_operation_id, # type: str **kwargs # type: Any ): # type: (...) -> None + """Cancel media operation. - if not call_locator: - raise ValueError("call_locator can not be None") - if not media_operation_id: - raise ValueError("media_operation_id can not be None") + :param call_locator: Required. The call locator. + :type call_locator: ~azure.communication.callingserver.models.CallLocator + :param media_operation_id: Required. The operationId of the media operation to cancel. + :type media_operation_id: str + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ cancel_media_operation_request = CancelMediaOperationWithCallLocatorRequestConverter.convert( serialize_call_locator(call_locator), media_operation_id=media_operation_id @@ -548,14 +634,19 @@ def cancel_participant_media_operation( media_operation_id, # type: str **kwargs # type: Any ): # type: (...) -> None + """Cancel media operation for a participant. + + :param call_locator: Required. The call locator. + :type call_locator: ~azure.communication.callingserver.models.CallLocator + :param participant: Required. The identifier of the participant. + :type participant: ~azure.communication.callingserver.models.CommunicationIdentifier + :param media_operation_id: Required. The operationId of the media operation to cancel. + :type media_operation_id: str + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError - if not call_locator: - raise ValueError("call_locator can not be None") - if not participant: - raise ValueError("participant can not be None") - if not media_operation_id: - raise ValueError("media_operation_id can not be None") - + """ cancel_participant_media_operation_request = \ CancelParticipantMediaOperationWithCallLocatorRequestConverter.convert( serialize_call_locator(call_locator), @@ -568,58 +659,39 @@ def cancel_participant_media_operation( **kwargs ) - @distributed_trace() - def hold_participant_meeting_audio( - self, - call_locator, # type: CallLocator - participant, # type: CommunicationIdentifier - **kwargs # type: Any - ): # type: (...) -> None - - if not participant: - raise ValueError("participant can not be None") - - hold_meeting_audio_with_call_locator_request = HoldMeetingAudioWithCallLocatorRequestConverter.convert( - serialize_call_locator(call_locator), - serialize_identifier(participant) - ) - - return self._server_call_client.hold_participant_meeting_audio( - hold_meeting_audio_with_call_locator_request=hold_meeting_audio_with_call_locator_request, - **kwargs - ) - - @distributed_trace() - def resume_participant_meeting_audio( - self, - call_locator, # type: CallLocator - participant, # type: CommunicationIdentifier - **kwargs # type: Any - ): # type: (...) -> None - - if not participant: - raise ValueError("participant can not be None") - - resume_meeting_audio_with_call_locator_request = ResumeMeetingAudioWithCallLocatorRequestConverter.convert( - serialize_call_locator(call_locator), - serialize_identifier(participant) - ) - - return self._server_call_client.resume_participant_meeting_audio( - resume_meeting_audio_with_call_locator_request=resume_meeting_audio_with_call_locator_request, - **kwargs - ) - @distributed_trace() def start_recording( # pylint: disable=too-many-arguments self, call_locator, # type: CallLocator recording_state_callback_uri, # type: str - recording_content_type=None, # type: Optional[RecordingContentType] - recording_channel_type=None, # type: Optional[RecordingChannelType] - recording_format_type=None, # type: Optional[RecordingFormatType] **kwargs # type: Any ): # type: (...) -> StartCallRecordingResult + """Start recording the call. + + :param call_locator: Required. The call locator. + :type call_locator: ~azure.communication.callingserver.models.CallLocator + :param recording_state_callback_uri: Required. The uri to send notifications to. + :type recording_state_callback_uri: str + :keyword recording_content_type: The content type of call recording. Possible values include: + "audio", "audioVideo". + :paramtype recording_content_type: str or + ~azure.communication.callingserver.models.RecordingContentType + :keyword recording_channel_type: The channel type of call recording. Possible values include: + "mixed", "unmixed". + :paramtype recording_channel_type: str or + ~azure.communication.callingserver.models.RecordingChannelType + :keyword recording_format_type: The format type of call recording. Possible values include: "wav", + "mp3", "mp4". + :paramtype recording_format_type: str or + ~azure.communication.callingserver.models.RecordingFormatType + :return: StartCallRecordingResult + :rtype: ~azure.communication.callingserver.StartCallRecordingResult + :raises: ~azure.core.exceptions.HttpResponseError + + """ + recording_content_type = kwargs.pop("recording_content_type", None) + recording_channel_type = kwargs.pop("recording_channel_type", None) + recording_format_type = kwargs.pop("recording_format_type", None) start_call_recording_with_calllocator_request = StartCallRecordingWithCallLocatorRequest( call_locator=serialize_call_locator(call_locator), @@ -641,7 +713,15 @@ def pause_recording( recording_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpResponse + """Pause recording the call. + + :param recording_id: Required. The recording id. + :type recording_id: str + :return: The response of the operation. + :rtype: ~azure.core.rest.HttpResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ return self._server_call_client.pause_recording( recording_id=recording_id, **kwargs @@ -653,7 +733,15 @@ def resume_recording( recording_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpResponse + """Resume recording the call. + :param recording_id: Required. The recording id. + :type recording_id: str + :return: The response of the operation. + :rtype: ~azure.core.rest.HttpResponse + :raises: ~azure.core.exceptions.HttpResponseError + + """ return self._server_call_client.resume_recording( recording_id=recording_id, **kwargs @@ -665,7 +753,15 @@ def stop_recording( recording_id, # type: str **kwargs # type: Any ): # type: (...) -> HttpResponse + """Stop recording the call. + :param recording_id: Required. The recording id. + :type recording_id: str + :return: The response of the operation. + :rtype: ~azure.core.rest.HttpResponse + :raises: ~azure.core.exceptions.HttpResponseError + + """ return self._server_call_client.stop_recording( recording_id=recording_id, **kwargs @@ -677,7 +773,15 @@ def get_recording_properities( recording_id, # type: str **kwargs # type: Any ): # type: (...) -> CallRecordingProperties + """Get recording properities. + :param recording_id: Required. The recording id. + :type recording_id: str + :return: CallRecordingProperties + :rtype: ~azure.communication.callingserver.CallRecordingProperties + :raises: ~azure.core.exceptions.HttpResponseError + + """ return self._server_call_client.get_recording_properties( recording_id=recording_id, **kwargs @@ -687,24 +791,26 @@ def get_recording_properities( def download( self, content_url, # type: str - start_range=None, # type: int - end_range=None, # type: int - parallel_download_options=None, # type: ParallelDownloadOptions **kwargs # type: Any ): # type: (...) -> ContentStreamDownloader """Download using content url. - :param str content_url: - The content url. - :returns: ContentStreamDownloader for a successful download request. - :rtype: ~ContentStreamDownloader - """ - if not content_url: - raise ValueError("content_url can not be None") - - if not CallingServerUtils.is_valid_url(content_url): - raise ValueError("content_url is invalid") + :param content_url: Required. The content url. + :type content_url: str + :keyword start_range: Http range where download start. + :paramtype start_range: int + :keyword end_range: Http range where download end. + :paramtype end_range: int + :keyword parallel_download_options: The options for parallel download. + :paramtype parallel_download_options: ~azure.communication.callingserver.models.ParallelDownloadOptions + :return: ContentStreamDownloader + :rtype: ~azure.communication.callingserver.ContentStreamDownloader + :raises: ~azure.core.exceptions.HttpResponseError + """ + start_range = kwargs.pop("start_range", None) + end_range = kwargs.pop("end_range", None) + parallel_download_options = kwargs.pop("parallel_download_options", None) # pylint:disable=protected-access content_downloader = ContentDownloader( self._callingserver_service_client._client, @@ -727,8 +833,16 @@ def delete_recording( self, content_delete_url, # type: str **kwargs # type: Any - ): # type: (...) -> HttpResponse + """Delete recording. + + :param content_delete_url: Required. The content delete url. + :type content_delete_url: str + :return: The response of the operation. + :rtype: ~azure.core.rest.HttpResponse + :raises: ~azure.core.exceptions.HttpResponseError + + """ # pylint: disable=protected-access if not content_delete_url: raise ValueError("content_delete_url can not be None") diff --git a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_communication_call_locator_serializer.py b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_communication_call_locator_serializer.py index 144f951f48fd..1ab3674c91e4 100644 --- a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_communication_call_locator_serializer.py +++ b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_communication_call_locator_serializer.py @@ -26,12 +26,11 @@ def serialize_call_locator(call_locator): :return: CallLocatorModel """ try: + request_model = {'kind': call_locator.kind} if call_locator.kind and call_locator.kind == CallLocatorKind.GROUP_CALL_LOCATOR: - request_model = {'group_call_id': call_locator.id} - request_model['kind'] = call_locator.kind + request_model['group_call_id'] = call_locator.id elif call_locator.kind and call_locator.kind == CallLocatorKind.SERVER_CALL_LOCATOR: - request_model = {'server_call_id': call_locator.id} - request_model['kind'] = call_locator.kind + request_model['server_call_id'] = call_locator.id return request_model except AttributeError: raise TypeError("Unsupported call locator type " + call_locator.__class__.__name__) diff --git a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_converters/__init__.py b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_converters/__init__.py index 9a4ae83316e1..5a438ac8b017 100644 --- a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_converters/__init__.py +++ b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_converters/__init__.py @@ -23,11 +23,7 @@ AudioRoutingGroupRequestConverter, UpdateAudioRoutingGroupRequestConverter, GetAllParticipantsWithCallLocatorRequestConverter, - GetParticipantWithCallLocatorRequestConverter, - MuteParticipantWithCallLocatorRequestConverter, - UnmuteParticipantWithCallLocatorRequestConverter, - HoldMeetingAudioWithCallLocatorRequestConverter, - ResumeMeetingAudioWithCallLocatorRequestConverter + GetParticipantWithCallLocatorRequestConverter ) __all__ = [ @@ -55,9 +51,5 @@ 'AudioRoutingGroupRequestConverter', 'UpdateAudioRoutingGroupRequestConverter', 'GetAllParticipantsWithCallLocatorRequestConverter', - 'GetParticipantWithCallLocatorRequestConverter', - 'MuteParticipantWithCallLocatorRequestConverter', - 'UnmuteParticipantWithCallLocatorRequestConverter', - 'HoldMeetingAudioWithCallLocatorRequestConverter', - 'ResumeMeetingAudioWithCallLocatorRequestConverter' + 'GetParticipantWithCallLocatorRequestConverter' ] diff --git a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_converters/_converter.py b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_converters/_converter.py index e85f4399bec9..3f4a63551e00 100644 --- a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_converters/_converter.py +++ b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_converters/_converter.py @@ -4,7 +4,6 @@ # license information. # ------------------------------------------------------------------------- from typing import List -from .._models import JoinCallOptions, PlayAudioOptions from .._generated.models import ( CallMediaType, AudioRoutingMode, @@ -36,11 +35,7 @@ ResumeMeetingAudioRequest, UpdateAudioRoutingGroupRequest, GetAllParticipantsWithCallLocatorRequest, - GetParticipantWithCallLocatorRequest, - MuteParticipantWithCallLocatorRequest, - UnmuteParticipantWithCallLocatorRequest, - HoldMeetingAudioWithCallLocatorRequest, - ResumeMeetingAudioWithCallLocatorRequest + GetParticipantWithCallLocatorRequest ) class JoinCallRequestConverter(object): @@ -48,23 +43,24 @@ class JoinCallRequestConverter(object): def convert( call_locator, # type: CallLocatorModel source, # type: CommunicationIdentifierModel - join_call_options # type: JoinCallOptions + callback_uri=None, # type: str + requested_media_types=None, # type: List[CallMediaType] + requested_call_events=None, # type: List[CallingEventSubscriptionType] + subject=None, # type: str ): # type: (...) -> JoinCallRequest if not call_locator: raise ValueError("call_locator can not be None") if not source: raise ValueError("source can not be None") - if not join_call_options: - raise ValueError("join_call_options can not be None") return JoinCallRequest( call_locator=call_locator, source=source, - callback_uri=join_call_options.callback_uri, - requested_media_types=join_call_options.requested_media_types, - requested_call_events=join_call_options.requested_call_events, - subject=join_call_options.subject + callback_uri=callback_uri, + requested_media_types=requested_media_types, + requested_call_events=requested_call_events, + subject=subject ) class AnswerCallRequestConverter(object): @@ -127,67 +123,70 @@ def convert( class PlayAudioRequestConverter(object): @staticmethod def convert( - audio_file_uri, # type: str - play_audio_options # type: PlayAudioOptions + audio_url, # type: str + loop, # type: bool + operation_context, # type: str + audio_file_id, # type: str + callback_uri # type: str ): # type: (...) -> PlayAudioRequest - if not audio_file_uri: - raise ValueError("audio_file_uri can not be None") - if not play_audio_options: - raise ValueError("playaudio_options can not be None") + if not audio_url: + raise ValueError("audio_url can not be None") return PlayAudioRequest( - audio_file_uri=audio_file_uri, - loop=play_audio_options.loop, - operation_context=play_audio_options, - audio_file_id=play_audio_options.audio_file_id, - callback_uri=play_audio_options.callback_uri + audio_file_uri=audio_url, + loop=loop, + operation_context=operation_context, + audio_file_id=audio_file_id, + callback_uri=callback_uri ) class PlayAudioWithCallLocatorRequestConverter(object): @staticmethod def convert( call_locator, # type: CallLocatorModel - audio_file_uri, # type: str - play_audio_options # type: PlayAudioOptions + audio_url, # type: str + loop, # type: bool + operation_context, # type: str + audio_file_id, # type: str + callback_uri # type: str ): # type: (...) -> PlayAudioWithCallLocatorRequest if not call_locator: raise ValueError("call_locator can not be None") - if not audio_file_uri: - raise ValueError("audio_file_uri can not be None") - if not play_audio_options: - raise ValueError("play_audio_options can not be None") + if not audio_url: + raise ValueError("audio_url can not be None") return PlayAudioWithCallLocatorRequest( call_locator=call_locator, - audio_file_uri=audio_file_uri, - loop=play_audio_options.loop, - operation_context=play_audio_options.operation_context, - audio_file_id=play_audio_options.audio_file_id, - callback_uri=play_audio_options.callback_uri + audio_file_uri=audio_url, + loop=loop, + operation_context=operation_context, + audio_file_id=audio_file_id, + callback_uri=callback_uri ) class PlayAudioToParticipantRequestConverter(object): @staticmethod def convert( identifier, # type: CommunicationIdentifierModel - audio_file_uri, # type: str - play_audio_options # type: PlayAudioOptions + audio_url, # type: str + loop, # type: bool + operation_context, # type: str + audio_file_id, # type: str + callback_uri # type: str ): # type: (...) -> PlayAudioToParticipantRequest - if not audio_file_uri: - raise ValueError("audio_file_uri can not be None") - if not play_audio_options: - raise ValueError("playaudio_options can not be None") + if not audio_url: + raise ValueError("audio_url can not be None") return PlayAudioToParticipantRequest( identifier=identifier, - audio_file_uri=audio_file_uri, - loop=play_audio_options.loop, - operation_context=play_audio_options, - audio_file_id=play_audio_options.audio_file_id, - callback_uri=play_audio_options.callback_uri + audio_file_uri=audio_url, + loop=loop, + operation_context=operation_context, + audio_file_id=audio_file_id, + callback_uri=callback_uri ) class PlayAudioToParticipantWithCallLocatorRequestConverter(object): @@ -195,25 +194,26 @@ class PlayAudioToParticipantWithCallLocatorRequestConverter(object): def convert( call_locator, # type: CallLocatorModel identifier, # type: CommunicationIdentifierModel - audio_file_uri, # type: str - play_audio_options # type: PlayAudioOptions + audio_url, # type: str + loop, # type: bool + operation_context, # type: str + audio_file_id, # type: str + callback_uri # type: str ): # type: (...) -> PlayAudioToParticipantWithCallLocatorRequest if not call_locator: raise ValueError("call_locator can not be None") - if not audio_file_uri: - raise ValueError("audio_file_uri can not be None") - if not play_audio_options: - raise ValueError("playaudio_options can not be None") + if not audio_url: + raise ValueError("audio_url can not be None") return PlayAudioToParticipantWithCallLocatorRequest( call_locator=call_locator, identifier=identifier, - audio_file_uri=audio_file_uri, - loop=play_audio_options.loop, - operation_context=play_audio_options, - audio_file_id=play_audio_options.audio_file_id, - callback_uri=play_audio_options.callback_uri + audio_file_uri=audio_url, + loop=loop, + operation_context=operation_context, + audio_file_id=audio_file_id, + callback_uri=callback_uri ) class AddParticipantRequestConverter(object): @@ -252,12 +252,10 @@ def convert( return AddParticipantWithCallLocatorRequest( call_locator=call_locator, - add_participant_request=AddParticipantRequestConverter.convert( - alternate_caller_id=alternate_caller_id, - participant=participant, - operation_context=operation_context, - callback_uri=callback_uri - ) + alternate_caller_id=alternate_caller_id, + participant=participant, + operation_context=operation_context, + callback_uri=callback_uri ) class GetParticipantRequestConverter(object): @@ -333,40 +331,6 @@ def convert( identifier=identifier ) -class MuteParticipantWithCallLocatorRequestConverter(object): - @staticmethod - def convert( - call_locator, # type: CallLocatorModel - identifier # type: CommunicationIdentifierModel - ): # type: (...) -> RemoveParticipantWithCallLocatorRequest - - if not call_locator: - raise ValueError("call_locator can not be None") - if not identifier: - raise ValueError("identifier can not be None") - - return MuteParticipantWithCallLocatorRequest( - call_locator=call_locator, - identifier=identifier - ) - -class UnmuteParticipantWithCallLocatorRequestConverter(object): - @staticmethod - def convert( - call_locator, # type: CallLocatorModel - identifier # type: CommunicationIdentifierModel - ): # type: (...) -> UnmuteParticipantWithCallLocatorRequest - - if not call_locator: - raise ValueError("call_locator can not be None") - if not identifier: - raise ValueError("identifier can not be None") - - return UnmuteParticipantWithCallLocatorRequest( - call_locator=call_locator, - identifier=identifier - ) - class CancelMediaOperationWithCallLocatorRequestConverter(object): @staticmethod def convert( @@ -427,9 +391,9 @@ class TransferCallRequestConverter(object): def convert( target_participant, # type: CommunicationIdentifierModel target_call_connection_id, # type: str + alternate_caller_id=None, # type: PhoneNumberIdentifierModel user_to_user_information=None, # type: str - operation_context=None, # type: str - callback_uri=None, # type: str + operation_context=None # type: str ): # type: (...) -> TransferCallRequest if not target_participant: @@ -438,9 +402,9 @@ def convert( return TransferCallRequest( target_participant=target_participant, target_call_connection_id=target_call_connection_id, + alternate_caller_id=alternate_caller_id, user_to_user_information=user_to_user_information, - operation_context=operation_context, - callback_uri=callback_uri + operation_context=operation_context ) class MuteParticipantRequestConverter(object): @@ -495,40 +459,6 @@ def convert( identifier=identifier ) -class HoldMeetingAudioWithCallLocatorRequestConverter(object): - @staticmethod - def convert( - call_locator, # type: CallLocatorModel - identifier # type: CommunicationIdentifierModel - ): # type: (...) -> HoldMeetingAudioWithCallLocatorRequest - - if not call_locator: - raise ValueError("call_locator can not be None") - if not identifier: - raise ValueError("identifier can not be None") - - return HoldMeetingAudioWithCallLocatorRequest( - call_locator=call_locator, - identifier=identifier - ) - -class ResumeMeetingAudioWithCallLocatorRequestConverter(object): - @staticmethod - def convert( - call_locator, # type: CallLocatorModel - identifier # type: CommunicationIdentifierModel - ): # type: (...) -> ResumeMeetingAudioWithCallLocatorRequest - - if not identifier: - raise ValueError("identifier can not be None") - if not identifier: - raise ValueError("identifier can not be None") - - return ResumeMeetingAudioWithCallLocatorRequest( - call_locator=call_locator, - identifier=identifier - ) - class AudioRoutingGroupRequestConverter(object): @staticmethod def convert( diff --git a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/_azure_communication_calling_server_service.py b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/_azure_communication_calling_server_service.py index 4161cd98b75d..9eaa42f76028 100644 --- a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/_azure_communication_calling_server_service.py +++ b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/_azure_communication_calling_server_service.py @@ -32,6 +32,9 @@ class AzureCommunicationCallingServerService(object): :vartype server_calls: azure.communication.callingserver.operations.ServerCallsOperations :param endpoint: The endpoint of the Azure Communication resource. :type endpoint: str + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -41,7 +44,7 @@ def __init__( ): # type: (...) -> None _base_url = '{endpoint}' - self._config = AzureCommunicationCallingServerServiceConfiguration(endpoint, **kwargs) + self._config = AzureCommunicationCallingServerServiceConfiguration(endpoint=endpoint, **kwargs) self._client = PipelineClient(base_url=_base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} diff --git a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/_configuration.py b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/_configuration.py index f117ca57a4ba..693ced99d3db 100644 --- a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/_configuration.py +++ b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/_configuration.py @@ -25,6 +25,8 @@ class AzureCommunicationCallingServerServiceConfiguration(Configuration): :param endpoint: The endpoint of the Azure Communication resource. :type endpoint: str + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that overriding this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -33,12 +35,14 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None + super(AzureCommunicationCallingServerServiceConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") - super(AzureCommunicationCallingServerServiceConfiguration, self).__init__(**kwargs) self.endpoint = endpoint - self.api_version = "2021-11-15-preview" + self.api_version = api_version kwargs.setdefault('sdk_moniker', 'azurecommunicationcallingserverservice/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/aio/__init__.py b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/aio/__init__.py index 7a0b6c0ded27..80a4f9a2c95c 100644 --- a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/aio/__init__.py +++ b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/aio/__init__.py @@ -8,3 +8,9 @@ from ._azure_communication_calling_server_service import AzureCommunicationCallingServerService __all__ = ['AzureCommunicationCallingServerService'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/aio/_azure_communication_calling_server_service.py b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/aio/_azure_communication_calling_server_service.py index 3218d0509b8d..339f513e93a0 100644 --- a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/aio/_azure_communication_calling_server_service.py +++ b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/aio/_azure_communication_calling_server_service.py @@ -27,6 +27,9 @@ class AzureCommunicationCallingServerService: :vartype server_calls: azure.communication.callingserver.aio.operations.ServerCallsOperations :param endpoint: The endpoint of the Azure Communication resource. :type endpoint: str + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -35,7 +38,7 @@ def __init__( **kwargs: Any ) -> None: _base_url = '{endpoint}' - self._config = AzureCommunicationCallingServerServiceConfiguration(endpoint, **kwargs) + self._config = AzureCommunicationCallingServerServiceConfiguration(endpoint=endpoint, **kwargs) self._client = AsyncPipelineClient(base_url=_base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} diff --git a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/aio/_configuration.py b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/aio/_configuration.py index e9f4f5b486a4..65b969940b29 100644 --- a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/aio/_configuration.py +++ b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/aio/_configuration.py @@ -21,6 +21,8 @@ class AzureCommunicationCallingServerServiceConfiguration(Configuration): :param endpoint: The endpoint of the Azure Communication resource. :type endpoint: str + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that overriding this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -28,12 +30,14 @@ def __init__( endpoint: str, **kwargs: Any ) -> None: + super(AzureCommunicationCallingServerServiceConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") - super(AzureCommunicationCallingServerServiceConfiguration, self).__init__(**kwargs) self.endpoint = endpoint - self.api_version = "2021-11-15-preview" + self.api_version = api_version kwargs.setdefault('sdk_moniker', 'azurecommunicationcallingserverservice/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/aio/operations/_call_connections_operations.py b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/aio/operations/_call_connections_operations.py index e47da39f0bc7..9cc8f752f70c 100644 --- a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/aio/operations/_call_connections_operations.py +++ b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/aio/operations/_call_connections_operations.py @@ -18,7 +18,6 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._call_connections_operations import build_add_participant_request, build_cancel_all_media_operations_request, build_cancel_participant_media_operation_request, build_create_audio_routing_group_request, build_create_call_request, build_delete_audio_routing_group_request, build_delete_call_request, build_get_audio_routing_groups_request, build_get_call_request, build_get_participant_request, build_get_participants_request, build_hangup_call_request, build_hold_participant_meeting_audio_request, build_keep_alive_request, build_mute_participant_request, build_participant_play_audio_request, build_play_audio_request, build_remove_participant_request, build_resume_participant_meeting_audio_request, build_transfer_request, build_unmute_participant_request, build_update_audio_routing_group_request - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -59,6 +58,9 @@ async def get_audio_routing_groups( :type call_connection_id: str :param audio_routing_group_id: The audio routing group id. :type audio_routing_group_id: str + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AudioRoutingGroupResult, or the result of cls(response) :rtype: ~azure.communication.callingserver.models.AudioRoutingGroupResult @@ -75,10 +77,13 @@ async def get_audio_routing_groups( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + request = build_get_audio_routing_groups_request( call_connection_id=call_connection_id, audio_routing_group_id=audio_routing_group_id, + api_version=api_version, template_url=self.get_audio_routing_groups.metadata['url'], ) request = _convert_request(request) @@ -119,6 +124,9 @@ async def delete_audio_routing_group( :type call_connection_id: str :param audio_routing_group_id: The audio routing group id. :type audio_routing_group_id: str + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -135,10 +143,13 @@ async def delete_audio_routing_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + request = build_delete_audio_routing_group_request( call_connection_id=call_connection_id, audio_routing_group_id=audio_routing_group_id, + api_version=api_version, template_url=self.delete_audio_routing_group.metadata['url'], ) request = _convert_request(request) @@ -179,6 +190,9 @@ async def update_audio_routing_group( :param update_audio_routing_group_request: The update audio routing group request. :type update_audio_routing_group_request: ~azure.communication.callingserver.models.UpdateAudioRoutingGroupRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -195,6 +209,7 @@ async def update_audio_routing_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(update_audio_routing_group_request, 'UpdateAudioRoutingGroupRequest') @@ -202,6 +217,7 @@ async def update_audio_routing_group( request = build_update_audio_routing_group_request( call_connection_id=call_connection_id, audio_routing_group_id=audio_routing_group_id, + api_version=api_version, content_type=content_type, json=json, template_url=self.update_audio_routing_group.metadata['url'], @@ -237,6 +253,9 @@ async def create_call( :param call_request: Create call request. :type call_request: ~azure.communication.callingserver.models.CreateCallRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CreateCallResult, or the result of cls(response) :rtype: ~azure.communication.callingserver.models.CreateCallResult @@ -253,11 +272,13 @@ async def create_call( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(call_request, 'CreateCallRequest') request = build_create_call_request( + api_version=api_version, content_type=content_type, json=json, template_url=self.create_call.metadata['url'], @@ -297,6 +318,9 @@ async def get_call( :param call_connection_id: The call connection id. :type call_connection_id: str + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CallConnectionProperties, or the result of cls(response) :rtype: ~azure.communication.callingserver.models.CallConnectionProperties @@ -313,9 +337,12 @@ async def get_call( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + request = build_get_call_request( call_connection_id=call_connection_id, + api_version=api_version, template_url=self.get_call.metadata['url'], ) request = _convert_request(request) @@ -353,6 +380,9 @@ async def delete_call( :param call_connection_id: The call connection id. :type call_connection_id: str + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -369,9 +399,12 @@ async def delete_call( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + request = build_delete_call_request( call_connection_id=call_connection_id, + api_version=api_version, template_url=self.delete_call.metadata['url'], ) request = _convert_request(request) @@ -405,6 +438,9 @@ async def hangup_call( :param call_connection_id: The call connection id. :type call_connection_id: str + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -421,9 +457,12 @@ async def hangup_call( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + request = build_hangup_call_request( call_connection_id=call_connection_id, + api_version=api_version, template_url=self.hangup_call.metadata['url'], ) request = _convert_request(request) @@ -449,7 +488,7 @@ async def hangup_call( async def play_audio( self, call_connection_id: str, - request: "_models.PlayAudioRequest", + play_audio_request: "_models.PlayAudioRequest", **kwargs: Any ) -> "_models.PlayAudioResult": """Play audio in the call. @@ -458,8 +497,11 @@ async def play_audio( :param call_connection_id: The call connection id. :type call_connection_id: str - :param request: Play audio request. - :type request: ~azure.communication.callingserver.models.PlayAudioRequest + :param play_audio_request: The play audio request. + :type play_audio_request: ~azure.communication.callingserver.models.PlayAudioRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PlayAudioResult, or the result of cls(response) :rtype: ~azure.communication.callingserver.models.PlayAudioResult @@ -476,12 +518,14 @@ async def play_audio( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - json = self._serialize.body(request, 'PlayAudioRequest') + json = self._serialize.body(play_audio_request, 'PlayAudioRequest') request = build_play_audio_request( call_connection_id=call_connection_id, + api_version=api_version, content_type=content_type, json=json, template_url=self.play_audio.metadata['url'], @@ -521,6 +565,9 @@ async def cancel_all_media_operations( :param call_connection_id: The call connection id. :type call_connection_id: str + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -537,9 +584,12 @@ async def cancel_all_media_operations( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + request = build_cancel_all_media_operations_request( call_connection_id=call_connection_id, + api_version=api_version, template_url=self.cancel_all_media_operations.metadata['url'], ) request = _convert_request(request) @@ -573,6 +623,9 @@ async def keep_alive( :param call_connection_id: The call connection id. :type call_connection_id: str + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -589,9 +642,12 @@ async def keep_alive( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + request = build_keep_alive_request( call_connection_id=call_connection_id, + api_version=api_version, template_url=self.keep_alive.metadata['url'], ) request = _convert_request(request) @@ -619,7 +675,7 @@ async def transfer( call_connection_id: str, transfer_call_request: "_models.TransferCallRequest", **kwargs: Any - ) -> None: + ) -> "_models.TransferCallResult": """Transfer the call to a participant or to another call. Transfer the call to a participant or to another call. @@ -628,12 +684,15 @@ async def transfer( :type call_connection_id: str :param transfer_call_request: The transfer call request. :type transfer_call_request: ~azure.communication.callingserver.models.TransferCallRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None + :return: TransferCallResult, or the result of cls(response) + :rtype: ~azure.communication.callingserver.models.TransferCallResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TransferCallResult"] error_map = { 409: ResourceExistsError, 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), @@ -644,12 +703,14 @@ async def transfer( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(transfer_call_request, 'TransferCallRequest') request = build_transfer_request( call_connection_id=call_connection_id, + api_version=api_version, content_type=content_type, json=json, template_url=self.transfer.metadata['url'], @@ -667,8 +728,12 @@ async def transfer( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) + deserialized = self._deserialize('TransferCallResult', pipeline_response) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) + + return deserialized transfer.metadata = {'url': '/calling/callConnections/{callConnectionId}/:transfer'} # type: ignore @@ -689,6 +754,9 @@ async def create_audio_routing_group( :param audio_routing_group_request: The audio routing group request. :type audio_routing_group_request: ~azure.communication.callingserver.models.AudioRoutingGroupRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CreateAudioRoutingGroupResult, or the result of cls(response) :rtype: ~azure.communication.callingserver.models.CreateAudioRoutingGroupResult @@ -705,12 +773,14 @@ async def create_audio_routing_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(audio_routing_group_request, 'AudioRoutingGroupRequest') request = build_create_audio_routing_group_request( call_connection_id=call_connection_id, + api_version=api_version, content_type=content_type, json=json, template_url=self.create_audio_routing_group.metadata['url'], @@ -750,6 +820,9 @@ async def get_participants( :param call_connection_id: The call connection id. :type call_connection_id: str + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of CallParticipant, or the result of cls(response) :rtype: list[~azure.communication.callingserver.models.CallParticipant] @@ -766,9 +839,12 @@ async def get_participants( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + request = build_get_participants_request( call_connection_id=call_connection_id, + api_version=api_version, template_url=self.get_participants.metadata['url'], ) request = _convert_request(request) @@ -809,6 +885,9 @@ async def add_participant( :type call_connection_id: str :param add_participant_request: Add participant request. :type add_participant_request: ~azure.communication.callingserver.models.AddParticipantRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AddParticipantResult, or the result of cls(response) :rtype: ~azure.communication.callingserver.models.AddParticipantResult @@ -825,12 +904,14 @@ async def add_participant( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(add_participant_request, 'AddParticipantRequest') request = build_add_participant_request( call_connection_id=call_connection_id, + api_version=api_version, content_type=content_type, json=json, template_url=self.add_participant.metadata['url'], @@ -875,6 +956,9 @@ async def remove_participant( call. :type remove_participant_request: ~azure.communication.callingserver.models.RemoveParticipantRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -891,12 +975,14 @@ async def remove_participant( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(remove_participant_request, 'RemoveParticipantRequest') request = build_remove_participant_request( call_connection_id=call_connection_id, + api_version=api_version, content_type=content_type, json=json, template_url=self.remove_participant.metadata['url'], @@ -935,6 +1021,9 @@ async def get_participant( :type call_connection_id: str :param get_participant_request: The identifier of the participant to get from the call. :type get_participant_request: ~azure.communication.callingserver.models.GetParticipantRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of CallParticipant, or the result of cls(response) :rtype: list[~azure.communication.callingserver.models.CallParticipant] @@ -951,12 +1040,14 @@ async def get_participant( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(get_participant_request, 'GetParticipantRequest') request = build_get_participant_request( call_connection_id=call_connection_id, + api_version=api_version, content_type=content_type, json=json, template_url=self.get_participant.metadata['url'], @@ -1000,6 +1091,9 @@ async def participant_play_audio( :param play_audio_to_participant_request: The play audio to participant request. :type play_audio_to_participant_request: ~azure.communication.callingserver.models.PlayAudioToParticipantRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PlayAudioResult, or the result of cls(response) :rtype: ~azure.communication.callingserver.models.PlayAudioResult @@ -1016,12 +1110,14 @@ async def participant_play_audio( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(play_audio_to_participant_request, 'PlayAudioToParticipantRequest') request = build_participant_play_audio_request( call_connection_id=call_connection_id, + api_version=api_version, content_type=content_type, json=json, template_url=self.participant_play_audio.metadata['url'], @@ -1065,6 +1161,9 @@ async def cancel_participant_media_operation( :param cancel_media_operation_request: The cancel media operation for participant request. :type cancel_media_operation_request: ~azure.communication.callingserver.models.CancelParticipantMediaOperationRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1081,12 +1180,14 @@ async def cancel_participant_media_operation( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(cancel_media_operation_request, 'CancelParticipantMediaOperationRequest') request = build_cancel_participant_media_operation_request( call_connection_id=call_connection_id, + api_version=api_version, content_type=content_type, json=json, template_url=self.cancel_participant_media_operation.metadata['url'], @@ -1126,6 +1227,9 @@ async def mute_participant( :param mute_participant_request: The identifier of the participant to mute in the call. :type mute_participant_request: ~azure.communication.callingserver.models.MuteParticipantRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1142,12 +1246,14 @@ async def mute_participant( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(mute_participant_request, 'MuteParticipantRequest') request = build_mute_participant_request( call_connection_id=call_connection_id, + api_version=api_version, content_type=content_type, json=json, template_url=self.mute_participant.metadata['url'], @@ -1187,6 +1293,9 @@ async def unmute_participant( :param unmute_participant_request: The identifier of the participant to unmute in the call. :type unmute_participant_request: ~azure.communication.callingserver.models.UnmuteParticipantRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1203,12 +1312,14 @@ async def unmute_participant( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(unmute_participant_request, 'UnmuteParticipantRequest') request = build_unmute_participant_request( call_connection_id=call_connection_id, + api_version=api_version, content_type=content_type, json=json, template_url=self.unmute_participant.metadata['url'], @@ -1249,6 +1360,9 @@ async def hold_participant_meeting_audio( participant. :type hold_meeting_audio_request: ~azure.communication.callingserver.models.HoldMeetingAudioRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1265,12 +1379,14 @@ async def hold_participant_meeting_audio( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(hold_meeting_audio_request, 'HoldMeetingAudioRequest') request = build_hold_participant_meeting_audio_request( call_connection_id=call_connection_id, + api_version=api_version, content_type=content_type, json=json, template_url=self.hold_participant_meeting_audio.metadata['url'], @@ -1311,6 +1427,9 @@ async def resume_participant_meeting_audio( participant. :type resume_meeting_audio_request: ~azure.communication.callingserver.models.ResumeMeetingAudioRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1327,12 +1446,14 @@ async def resume_participant_meeting_audio( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(resume_meeting_audio_request, 'ResumeMeetingAudioRequest') request = build_resume_participant_meeting_audio_request( call_connection_id=call_connection_id, + api_version=api_version, content_type=content_type, json=json, template_url=self.resume_participant_meeting_audio.metadata['url'], diff --git a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/aio/operations/_server_calls_operations.py b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/aio/operations/_server_calls_operations.py index 54ad6a610fdc..29fad3409aca 100644 --- a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/aio/operations/_server_calls_operations.py +++ b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/aio/operations/_server_calls_operations.py @@ -17,8 +17,7 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._server_calls_operations import build_add_participant_request, build_answer_call_request, build_cancel_media_operation_request, build_cancel_participant_media_operation_request, build_get_participant_request, build_get_participants_request, build_get_recording_properties_request, build_hold_participant_meeting_audio_request, build_join_call_request, build_mute_participant_request, build_participant_play_audio_request, build_pause_recording_request, build_play_audio_request, build_redirect_call_request, build_reject_call_request, build_remove_participant_request, build_resume_participant_meeting_audio_request, build_resume_recording_request, build_start_recording_request, build_stop_recording_request, build_unmute_participant_request - +from ...operations._server_calls_operations import build_add_participant_request, build_answer_call_request, build_cancel_media_operation_request, build_cancel_participant_media_operation_request, build_get_participant_request, build_get_participants_request, build_get_recording_properties_request, build_join_call_request, build_participant_play_audio_request, build_pause_recording_request, build_play_audio_request, build_redirect_call_request, build_reject_call_request, build_remove_participant_request, build_resume_recording_request, build_start_recording_request, build_stop_recording_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,6 +57,9 @@ async def get_participants( participants. :type get_all_participants_with_call_locator_request: ~azure.communication.callingserver.models.GetAllParticipantsWithCallLocatorRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of CallParticipant, or the result of cls(response) :rtype: list[~azure.communication.callingserver.models.CallParticipant] @@ -74,11 +76,13 @@ async def get_participants( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(get_all_participants_with_call_locator_request, 'GetAllParticipantsWithCallLocatorRequest') request = build_get_participants_request( + api_version=api_version, content_type=content_type, json=json, template_url=self.get_participants.metadata['url'], @@ -120,6 +124,9 @@ async def add_participant( locator. :type add_participant_with_call_locator_request: ~azure.communication.callingserver.models.AddParticipantWithCallLocatorRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AddParticipantResult, or the result of cls(response) :rtype: ~azure.communication.callingserver.models.AddParticipantResult @@ -136,11 +143,13 @@ async def add_participant( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(add_participant_with_call_locator_request, 'AddParticipantWithCallLocatorRequest') request = build_add_participant_request( + api_version=api_version, content_type=content_type, json=json, template_url=self.add_participant.metadata['url'], @@ -182,6 +191,9 @@ async def remove_participant( removed from the call. :type remove_participant_with_call_locator_request: ~azure.communication.callingserver.models.RemoveParticipantWithCallLocatorRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -198,11 +210,13 @@ async def remove_participant( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(remove_participant_with_call_locator_request, 'RemoveParticipantWithCallLocatorRequest') request = build_remove_participant_request( + api_version=api_version, content_type=content_type, json=json, template_url=self.remove_participant.metadata['url'], @@ -239,6 +253,9 @@ async def get_participant( :param get_participant_with_call_locator_request: The get participant request. :type get_participant_with_call_locator_request: ~azure.communication.callingserver.models.GetParticipantWithCallLocatorRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of CallParticipant, or the result of cls(response) :rtype: list[~azure.communication.callingserver.models.CallParticipant] @@ -255,11 +272,13 @@ async def get_participant( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(get_participant_with_call_locator_request, 'GetParticipantWithCallLocatorRequest') request = build_get_participant_request( + api_version=api_version, content_type=content_type, json=json, template_url=self.get_participant.metadata['url'], @@ -300,6 +319,9 @@ async def participant_play_audio( :param play_audio_to_participant_request: The play audio to participant request. :type play_audio_to_participant_request: ~azure.communication.callingserver.models.PlayAudioToParticipantWithCallLocatorRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PlayAudioResult, or the result of cls(response) :rtype: ~azure.communication.callingserver.models.PlayAudioResult @@ -316,11 +338,13 @@ async def participant_play_audio( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(play_audio_to_participant_request, 'PlayAudioToParticipantWithCallLocatorRequest') request = build_participant_play_audio_request( + api_version=api_version, content_type=content_type, json=json, template_url=self.participant_play_audio.metadata['url'], @@ -362,6 +386,9 @@ async def cancel_participant_media_operation( request. :type cancel_participant_media_operation_request: ~azure.communication.callingserver.models.CancelParticipantMediaOperationWithCallLocatorRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -378,11 +405,13 @@ async def cancel_participant_media_operation( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(cancel_participant_media_operation_request, 'CancelParticipantMediaOperationWithCallLocatorRequest') request = build_cancel_participant_media_operation_request( + api_version=api_version, content_type=content_type, json=json, template_url=self.cancel_participant_media_operation.metadata['url'], @@ -406,238 +435,6 @@ async def cancel_participant_media_operation( cancel_participant_media_operation.metadata = {'url': '/calling/participants:cancelMediaOperation'} # type: ignore - @distributed_trace_async - async def mute_participant( - self, - mute_participant_with_call_locator_request: "_models.MuteParticipantWithCallLocatorRequest", - **kwargs: Any - ) -> None: - """Mute participant in the call. - - Mute participant in the call. - - :param mute_participant_with_call_locator_request: The identifier of the participant to mute in - the call. - :type mute_participant_with_call_locator_request: - ~azure.communication.callingserver.models.MuteParticipantWithCallLocatorRequest - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 409: ResourceExistsError, - 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 401: lambda response: ClientAuthenticationError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 403: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - json = self._serialize.body(mute_participant_with_call_locator_request, 'MuteParticipantWithCallLocatorRequest') - - request = build_mute_participant_request( - content_type=content_type, - json=json, - template_url=self.mute_participant.metadata['url'], - ) - request = _convert_request(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) - - mute_participant.metadata = {'url': '/calling/participants:mute'} # type: ignore - - - @distributed_trace_async - async def unmute_participant( - self, - unmute_participant_with_call_locator_request: "_models.UnmuteParticipantWithCallLocatorRequest", - **kwargs: Any - ) -> None: - """Unmute participant in the call. - - Unmute participant in the call. - - :param unmute_participant_with_call_locator_request: The identifier of the participant to - unmute in the call. - :type unmute_participant_with_call_locator_request: - ~azure.communication.callingserver.models.UnmuteParticipantWithCallLocatorRequest - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 409: ResourceExistsError, - 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 401: lambda response: ClientAuthenticationError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 403: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - json = self._serialize.body(unmute_participant_with_call_locator_request, 'UnmuteParticipantWithCallLocatorRequest') - - request = build_unmute_participant_request( - content_type=content_type, - json=json, - template_url=self.unmute_participant.metadata['url'], - ) - request = _convert_request(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) - - unmute_participant.metadata = {'url': '/calling/participants:unmute'} # type: ignore - - - @distributed_trace_async - async def hold_participant_meeting_audio( - self, - hold_meeting_audio_with_call_locator_request: "_models.HoldMeetingAudioWithCallLocatorRequest", - **kwargs: Any - ) -> None: - """Hold meeting audio of a participant in the call. - - Hold meeting audio of a participant in the call. - - :param hold_meeting_audio_with_call_locator_request: The request payload for holding meeting - audio for a participant. - :type hold_meeting_audio_with_call_locator_request: - ~azure.communication.callingserver.models.HoldMeetingAudioWithCallLocatorRequest - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 409: ResourceExistsError, - 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 401: lambda response: ClientAuthenticationError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 403: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - json = self._serialize.body(hold_meeting_audio_with_call_locator_request, 'HoldMeetingAudioWithCallLocatorRequest') - - request = build_hold_participant_meeting_audio_request( - content_type=content_type, - json=json, - template_url=self.hold_participant_meeting_audio.metadata['url'], - ) - request = _convert_request(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) - - hold_participant_meeting_audio.metadata = {'url': '/calling/participants:holdMeetingAudio'} # type: ignore - - - @distributed_trace_async - async def resume_participant_meeting_audio( - self, - resume_meeting_audio_with_call_locator_request: "_models.ResumeMeetingAudioWithCallLocatorRequest", - **kwargs: Any - ) -> None: - """Resume meeting audio of a participant in the call. - - Resume meeting audio of a participant in the call. - - :param resume_meeting_audio_with_call_locator_request: The request payload for resuming meeting - audio for a participant. - :type resume_meeting_audio_with_call_locator_request: - ~azure.communication.callingserver.models.ResumeMeetingAudioWithCallLocatorRequest - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 409: ResourceExistsError, - 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 401: lambda response: ClientAuthenticationError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 403: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - json = self._serialize.body(resume_meeting_audio_with_call_locator_request, 'ResumeMeetingAudioWithCallLocatorRequest') - - request = build_resume_participant_meeting_audio_request( - content_type=content_type, - json=json, - template_url=self.resume_participant_meeting_audio.metadata['url'], - ) - request = _convert_request(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) - - resume_participant_meeting_audio.metadata = {'url': '/calling/participants:resumeMeetingAudio'} # type: ignore - - @distributed_trace_async async def start_recording( self, @@ -652,6 +449,9 @@ async def start_recording( request. :type start_call_recording_with_call_locator_request: ~azure.communication.callingserver.models.StartCallRecordingWithCallLocatorRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StartCallRecordingResult, or the result of cls(response) :rtype: ~azure.communication.callingserver.models.StartCallRecordingResult @@ -668,11 +468,13 @@ async def start_recording( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(start_call_recording_with_call_locator_request, 'StartCallRecordingWithCallLocatorRequest') request = build_start_recording_request( + api_version=api_version, content_type=content_type, json=json, template_url=self.start_recording.metadata['url'], @@ -712,6 +514,9 @@ async def get_recording_properties( :param recording_id: The recording id. :type recording_id: str + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CallRecordingProperties, or the result of cls(response) :rtype: ~azure.communication.callingserver.models.CallRecordingProperties @@ -728,9 +533,12 @@ async def get_recording_properties( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + request = build_get_recording_properties_request( recording_id=recording_id, + api_version=api_version, template_url=self.get_recording_properties.metadata['url'], ) request = _convert_request(request) @@ -768,6 +576,9 @@ async def stop_recording( :param recording_id: The recording id. :type recording_id: str + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -784,9 +595,12 @@ async def stop_recording( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + request = build_stop_recording_request( recording_id=recording_id, + api_version=api_version, template_url=self.stop_recording.metadata['url'], ) request = _convert_request(request) @@ -820,6 +634,9 @@ async def pause_recording( :param recording_id: The recording id. :type recording_id: str + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -836,9 +653,12 @@ async def pause_recording( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + request = build_pause_recording_request( recording_id=recording_id, + api_version=api_version, template_url=self.pause_recording.metadata['url'], ) request = _convert_request(request) @@ -872,6 +692,9 @@ async def resume_recording( :param recording_id: The recording id. :type recording_id: str + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -888,9 +711,12 @@ async def resume_recording( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + request = build_resume_recording_request( recording_id=recording_id, + api_version=api_version, template_url=self.resume_recording.metadata['url'], ) request = _convert_request(request) @@ -924,6 +750,9 @@ async def join_call( :param call_request: The join call request. :type call_request: ~azure.communication.callingserver.models.JoinCallRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: JoinCallResult, or the result of cls(response) :rtype: ~azure.communication.callingserver.models.JoinCallResult @@ -940,11 +769,13 @@ async def join_call( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(call_request, 'JoinCallRequest') request = build_join_call_request( + api_version=api_version, content_type=content_type, json=json, template_url=self.join_call.metadata['url'], @@ -985,6 +816,9 @@ async def play_audio( :param play_audio_request: Play audio request. :type play_audio_request: ~azure.communication.callingserver.models.PlayAudioWithCallLocatorRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PlayAudioResult, or the result of cls(response) :rtype: ~azure.communication.callingserver.models.PlayAudioResult @@ -1001,11 +835,13 @@ async def play_audio( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(play_audio_request, 'PlayAudioWithCallLocatorRequest') request = build_play_audio_request( + api_version=api_version, content_type=content_type, json=json, template_url=self.play_audio.metadata['url'], @@ -1046,6 +882,9 @@ async def cancel_media_operation( :param cancel_media_operation_request: The cancel media operation request. :type cancel_media_operation_request: ~azure.communication.callingserver.models.CancelMediaOperationWithCallLocatorRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1062,11 +901,13 @@ async def cancel_media_operation( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(cancel_media_operation_request, 'CancelMediaOperationWithCallLocatorRequest') request = build_cancel_media_operation_request( + api_version=api_version, content_type=content_type, json=json, template_url=self.cancel_media_operation.metadata['url'], @@ -1102,6 +943,9 @@ async def answer_call( :param answer_call_request: The answer call request. :type answer_call_request: ~azure.communication.callingserver.models.AnswerCallRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AnswerCallResult, or the result of cls(response) :rtype: ~azure.communication.callingserver.models.AnswerCallResult @@ -1118,11 +962,13 @@ async def answer_call( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(answer_call_request, 'AnswerCallRequest') request = build_answer_call_request( + api_version=api_version, content_type=content_type, json=json, template_url=self.answer_call.metadata['url'], @@ -1136,7 +982,7 @@ async def answer_call( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1162,6 +1008,9 @@ async def reject_call( :param reject_call_request: The reject call request. :type reject_call_request: ~azure.communication.callingserver.models.RejectCallRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1178,11 +1027,13 @@ async def reject_call( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(reject_call_request, 'RejectCallRequest') request = build_reject_call_request( + api_version=api_version, content_type=content_type, json=json, template_url=self.reject_call.metadata['url'], @@ -1218,6 +1069,9 @@ async def redirect_call( :param redirect_call_request: The redirect call request. :type redirect_call_request: ~azure.communication.callingserver.models.RedirectCallRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1234,11 +1088,13 @@ async def redirect_call( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(redirect_call_request, 'RedirectCallRequest') request = build_redirect_call_request( + api_version=api_version, content_type=content_type, json=json, template_url=self.redirect_call.metadata['url'], diff --git a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/models/__init__.py b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/models/__init__.py index 3241d5cd5137..031c7185fa15 100644 --- a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/models/__init__.py +++ b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/models/__init__.py @@ -36,12 +36,10 @@ from ._models_py3 import GetParticipantRequest from ._models_py3 import GetParticipantWithCallLocatorRequest from ._models_py3 import HoldMeetingAudioRequest - from ._models_py3 import HoldMeetingAudioWithCallLocatorRequest from ._models_py3 import JoinCallRequest from ._models_py3 import JoinCallResult from ._models_py3 import MicrosoftTeamsUserIdentifierModel from ._models_py3 import MuteParticipantRequest - from ._models_py3 import MuteParticipantWithCallLocatorRequest from ._models_py3 import ParticipantsUpdatedEvent from ._models_py3 import PhoneNumberIdentifierModel from ._models_py3 import PlayAudioRequest @@ -55,14 +53,14 @@ from ._models_py3 import RemoveParticipantRequest from ._models_py3 import RemoveParticipantWithCallLocatorRequest from ._models_py3 import ResumeMeetingAudioRequest - from ._models_py3 import ResumeMeetingAudioWithCallLocatorRequest from ._models_py3 import StartCallRecordingResult from ._models_py3 import StartCallRecordingWithCallLocatorRequest from ._models_py3 import ToneInfo from ._models_py3 import ToneReceivedEvent from ._models_py3 import TransferCallRequest + from ._models_py3 import TransferCallResult + from ._models_py3 import TransferCallResultEvent from ._models_py3 import UnmuteParticipantRequest - from ._models_py3 import UnmuteParticipantWithCallLocatorRequest from ._models_py3 import UpdateAudioRoutingGroupRequest except (SyntaxError, ImportError): from ._models import AddParticipantRequest # type: ignore @@ -94,12 +92,10 @@ from ._models import GetParticipantRequest # type: ignore from ._models import GetParticipantWithCallLocatorRequest # type: ignore from ._models import HoldMeetingAudioRequest # type: ignore - from ._models import HoldMeetingAudioWithCallLocatorRequest # type: ignore from ._models import JoinCallRequest # type: ignore from ._models import JoinCallResult # type: ignore from ._models import MicrosoftTeamsUserIdentifierModel # type: ignore from ._models import MuteParticipantRequest # type: ignore - from ._models import MuteParticipantWithCallLocatorRequest # type: ignore from ._models import ParticipantsUpdatedEvent # type: ignore from ._models import PhoneNumberIdentifierModel # type: ignore from ._models import PlayAudioRequest # type: ignore @@ -113,14 +109,14 @@ from ._models import RemoveParticipantRequest # type: ignore from ._models import RemoveParticipantWithCallLocatorRequest # type: ignore from ._models import ResumeMeetingAudioRequest # type: ignore - from ._models import ResumeMeetingAudioWithCallLocatorRequest # type: ignore from ._models import StartCallRecordingResult # type: ignore from ._models import StartCallRecordingWithCallLocatorRequest # type: ignore from ._models import ToneInfo # type: ignore from ._models import ToneReceivedEvent # type: ignore from ._models import TransferCallRequest # type: ignore + from ._models import TransferCallResult # type: ignore + from ._models import TransferCallResultEvent # type: ignore from ._models import UnmuteParticipantRequest # type: ignore - from ._models import UnmuteParticipantWithCallLocatorRequest # type: ignore from ._models import UpdateAudioRoutingGroupRequest # type: ignore from ._azure_communication_calling_server_service_enums import ( @@ -169,12 +165,10 @@ 'GetParticipantRequest', 'GetParticipantWithCallLocatorRequest', 'HoldMeetingAudioRequest', - 'HoldMeetingAudioWithCallLocatorRequest', 'JoinCallRequest', 'JoinCallResult', 'MicrosoftTeamsUserIdentifierModel', 'MuteParticipantRequest', - 'MuteParticipantWithCallLocatorRequest', 'ParticipantsUpdatedEvent', 'PhoneNumberIdentifierModel', 'PlayAudioRequest', @@ -188,14 +182,14 @@ 'RemoveParticipantRequest', 'RemoveParticipantWithCallLocatorRequest', 'ResumeMeetingAudioRequest', - 'ResumeMeetingAudioWithCallLocatorRequest', 'StartCallRecordingResult', 'StartCallRecordingWithCallLocatorRequest', 'ToneInfo', 'ToneReceivedEvent', 'TransferCallRequest', + 'TransferCallResult', + 'TransferCallResultEvent', 'UnmuteParticipantRequest', - 'UnmuteParticipantWithCallLocatorRequest', 'UpdateAudioRoutingGroupRequest', 'AudioRoutingMode', 'CallConnectionState', diff --git a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/models/_azure_communication_calling_server_service_enums.py b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/models/_azure_communication_calling_server_service_enums.py index d166cc0c0a05..cd0c757fd70e 100644 --- a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/models/_azure_communication_calling_server_service_enums.py +++ b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/models/_azure_communication_calling_server_service_enums.py @@ -79,21 +79,21 @@ class CommunicationCloudEnvironmentModel(with_metaclass(CaseInsensitiveEnumMeta, GCCH = "gcch" class RecordingChannelType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Channel type of call recording. + """The channel type of call recording. """ MIXED = "mixed" UNMIXED = "unmixed" class RecordingContentType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Content type of call recording. + """The content type of call recording. """ AUDIO = "audio" AUDIO_VIDEO = "audioVideo" class RecordingFormatType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Format type of call recording. + """The format type of call recording. """ WAV = "wav" diff --git a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/models/_models.py b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/models/_models.py index 2e8737cac511..58889a4b8d6c 100644 --- a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/models/_models.py +++ b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/models/_models.py @@ -13,10 +13,12 @@ class AddParticipantRequest(msrest.serialization.Model): """The add participant request. + All required parameters must be populated in order to send to Azure. + :ivar alternate_caller_id: The alternate identity of source participant. :vartype alternate_caller_id: ~azure.communication.callingserver.models.PhoneNumberIdentifierModel - :ivar participant: The participant to be added to the call. + :ivar participant: Required. The participant to be added to the call. :vartype participant: ~azure.communication.callingserver.models.CommunicationIdentifierModel :ivar operation_context: The operation context. :vartype operation_context: str @@ -24,6 +26,10 @@ class AddParticipantRequest(msrest.serialization.Model): :vartype callback_uri: str """ + _validation = { + 'participant': {'required': True}, + } + _attribute_map = { 'alternate_caller_id': {'key': 'alternateCallerId', 'type': 'PhoneNumberIdentifierModel'}, 'participant': {'key': 'participant', 'type': 'CommunicationIdentifierModel'}, @@ -39,7 +45,7 @@ def __init__( :keyword alternate_caller_id: The alternate identity of source participant. :paramtype alternate_caller_id: ~azure.communication.callingserver.models.PhoneNumberIdentifierModel - :keyword participant: The participant to be added to the call. + :keyword participant: Required. The participant to be added to the call. :paramtype participant: ~azure.communication.callingserver.models.CommunicationIdentifierModel :keyword operation_context: The operation context. :paramtype operation_context: str @@ -48,7 +54,7 @@ def __init__( """ super(AddParticipantRequest, self).__init__(**kwargs) self.alternate_caller_id = kwargs.get('alternate_caller_id', None) - self.participant = kwargs.get('participant', None) + self.participant = kwargs['participant'] self.operation_context = kwargs.get('operation_context', None) self.callback_uri = kwargs.get('callback_uri', None) @@ -77,7 +83,7 @@ def __init__( class AddParticipantResultEvent(msrest.serialization.Model): - """AddParticipantResultEvent. + """The add participant result event. All required parameters must be populated in order to send to Azure. @@ -129,7 +135,7 @@ class AddParticipantWithCallLocatorRequest(msrest.serialization.Model): :ivar alternate_caller_id: The alternate identity of source participant. :vartype alternate_caller_id: ~azure.communication.callingserver.models.PhoneNumberIdentifierModel - :ivar participant: The participant to be added to the call. + :ivar participant: Required. The participant to be added to the call. :vartype participant: ~azure.communication.callingserver.models.CommunicationIdentifierModel :ivar operation_context: The operation context. :vartype operation_context: str @@ -139,6 +145,7 @@ class AddParticipantWithCallLocatorRequest(msrest.serialization.Model): _validation = { 'call_locator': {'required': True}, + 'participant': {'required': True}, } _attribute_map = { @@ -159,7 +166,7 @@ def __init__( :keyword alternate_caller_id: The alternate identity of source participant. :paramtype alternate_caller_id: ~azure.communication.callingserver.models.PhoneNumberIdentifierModel - :keyword participant: The participant to be added to the call. + :keyword participant: Required. The participant to be added to the call. :paramtype participant: ~azure.communication.callingserver.models.CommunicationIdentifierModel :keyword operation_context: The operation context. :paramtype operation_context: str @@ -169,7 +176,7 @@ def __init__( super(AddParticipantWithCallLocatorRequest, self).__init__(**kwargs) self.call_locator = kwargs['call_locator'] self.alternate_caller_id = kwargs.get('alternate_caller_id', None) - self.participant = kwargs.get('participant', None) + self.participant = kwargs['participant'] self.operation_context = kwargs.get('operation_context', None) self.callback_uri = kwargs.get('callback_uri', None) @@ -179,9 +186,9 @@ class AnswerCallRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar incoming_call_context: The context associated with the call. + :ivar incoming_call_context: Required. The context associated with the call. :vartype incoming_call_context: str - :ivar callback_uri: Required. The callback uri. + :ivar callback_uri: The callback uri. :vartype callback_uri: str :ivar requested_media_types: The requested modalities. :vartype requested_media_types: list[str or @@ -192,7 +199,7 @@ class AnswerCallRequest(msrest.serialization.Model): """ _validation = { - 'callback_uri': {'required': True}, + 'incoming_call_context': {'required': True}, } _attribute_map = { @@ -207,9 +214,9 @@ def __init__( **kwargs ): """ - :keyword incoming_call_context: The context associated with the call. + :keyword incoming_call_context: Required. The context associated with the call. :paramtype incoming_call_context: str - :keyword callback_uri: Required. The callback uri. + :keyword callback_uri: The callback uri. :paramtype callback_uri: str :keyword requested_media_types: The requested modalities. :paramtype requested_media_types: list[str or @@ -219,8 +226,8 @@ def __init__( ~azure.communication.callingserver.models.CallingEventSubscriptionType] """ super(AnswerCallRequest, self).__init__(**kwargs) - self.incoming_call_context = kwargs.get('incoming_call_context', None) - self.callback_uri = kwargs['callback_uri'] + self.incoming_call_context = kwargs['incoming_call_context'] + self.callback_uri = kwargs.get('callback_uri', None) self.requested_media_types = kwargs.get('requested_media_types', None) self.requested_call_events = kwargs.get('requested_call_events', None) @@ -1180,42 +1187,6 @@ def __init__( self.identifier = kwargs['identifier'] -class HoldMeetingAudioWithCallLocatorRequest(msrest.serialization.Model): - """The request payload for holding meeting audio for a participant. - - All required parameters must be populated in order to send to Azure. - - :ivar call_locator: Required. The call locator. - :vartype call_locator: ~azure.communication.callingserver.models.CallLocatorModel - :ivar identifier: Required. The identifier of the participant. - :vartype identifier: ~azure.communication.callingserver.models.CommunicationIdentifierModel - """ - - _validation = { - 'call_locator': {'required': True}, - 'identifier': {'required': True}, - } - - _attribute_map = { - 'call_locator': {'key': 'callLocator', 'type': 'CallLocatorModel'}, - 'identifier': {'key': 'identifier', 'type': 'CommunicationIdentifierModel'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword call_locator: Required. The call locator. - :paramtype call_locator: ~azure.communication.callingserver.models.CallLocatorModel - :keyword identifier: Required. The identifier of the participant. - :paramtype identifier: ~azure.communication.callingserver.models.CommunicationIdentifierModel - """ - super(HoldMeetingAudioWithCallLocatorRequest, self).__init__(**kwargs) - self.call_locator = kwargs['call_locator'] - self.identifier = kwargs['identifier'] - - class JoinCallRequest(msrest.serialization.Model): """The request payload for join call. @@ -1359,6 +1330,8 @@ class MuteParticipantRequest(msrest.serialization.Model): :ivar identifier: Required. The identifier of the participant to be muted in the call. :vartype identifier: ~azure.communication.callingserver.models.CommunicationIdentifierModel + :ivar operation_context: The operation context. + :vartype operation_context: str """ _validation = { @@ -1367,6 +1340,7 @@ class MuteParticipantRequest(msrest.serialization.Model): _attribute_map = { 'identifier': {'key': 'identifier', 'type': 'CommunicationIdentifierModel'}, + 'operation_context': {'key': 'operationContext', 'type': 'str'}, } def __init__( @@ -1376,45 +1350,12 @@ def __init__( """ :keyword identifier: Required. The identifier of the participant to be muted in the call. :paramtype identifier: ~azure.communication.callingserver.models.CommunicationIdentifierModel + :keyword operation_context: The operation context. + :paramtype operation_context: str """ super(MuteParticipantRequest, self).__init__(**kwargs) self.identifier = kwargs['identifier'] - - -class MuteParticipantWithCallLocatorRequest(msrest.serialization.Model): - """The request payload for muting any participant using call locator. - - All required parameters must be populated in order to send to Azure. - - :ivar call_locator: Required. The call locator. - :vartype call_locator: ~azure.communication.callingserver.models.CallLocatorModel - :ivar identifier: Required. The identifier of the participant to be muted in the call. - :vartype identifier: ~azure.communication.callingserver.models.CommunicationIdentifierModel - """ - - _validation = { - 'call_locator': {'required': True}, - 'identifier': {'required': True}, - } - - _attribute_map = { - 'call_locator': {'key': 'callLocator', 'type': 'CallLocatorModel'}, - 'identifier': {'key': 'identifier', 'type': 'CommunicationIdentifierModel'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword call_locator: Required. The call locator. - :paramtype call_locator: ~azure.communication.callingserver.models.CallLocatorModel - :keyword identifier: Required. The identifier of the participant to be muted in the call. - :paramtype identifier: ~azure.communication.callingserver.models.CommunicationIdentifierModel - """ - super(MuteParticipantWithCallLocatorRequest, self).__init__(**kwargs) - self.call_locator = kwargs['call_locator'] - self.identifier = kwargs['identifier'] + self.operation_context = kwargs.get('operation_context', None) class ParticipantsUpdatedEvent(msrest.serialization.Model): @@ -2034,42 +1975,6 @@ def __init__( self.identifier = kwargs['identifier'] -class ResumeMeetingAudioWithCallLocatorRequest(msrest.serialization.Model): - """The request payload for resuming meeting audio for a participant. - - All required parameters must be populated in order to send to Azure. - - :ivar call_locator: Required. The call locator. - :vartype call_locator: ~azure.communication.callingserver.models.CallLocatorModel - :ivar identifier: Required. The identifier of the participant. - :vartype identifier: ~azure.communication.callingserver.models.CommunicationIdentifierModel - """ - - _validation = { - 'call_locator': {'required': True}, - 'identifier': {'required': True}, - } - - _attribute_map = { - 'call_locator': {'key': 'callLocator', 'type': 'CallLocatorModel'}, - 'identifier': {'key': 'identifier', 'type': 'CommunicationIdentifierModel'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword call_locator: Required. The call locator. - :paramtype call_locator: ~azure.communication.callingserver.models.CallLocatorModel - :keyword identifier: Required. The identifier of the participant. - :paramtype identifier: ~azure.communication.callingserver.models.CommunicationIdentifierModel - """ - super(ResumeMeetingAudioWithCallLocatorRequest, self).__init__(**kwargs) - self.call_locator = kwargs['call_locator'] - self.identifier = kwargs['identifier'] - - class StartCallRecordingResult(msrest.serialization.Model): """The response payload of start call recording operation. @@ -2102,15 +2007,15 @@ class StartCallRecordingWithCallLocatorRequest(msrest.serialization.Model): :vartype call_locator: ~azure.communication.callingserver.models.CallLocatorModel :ivar recording_state_callback_uri: The uri to send notifications to. :vartype recording_state_callback_uri: str - :ivar recording_content_type: Content type of call recording. Possible values include: "audio", - "audioVideo". + :ivar recording_content_type: The content type of call recording. Possible values include: + "audio", "audioVideo". :vartype recording_content_type: str or ~azure.communication.callingserver.models.RecordingContentType - :ivar recording_channel_type: Channel type of call recording. Possible values include: "mixed", - "unmixed". + :ivar recording_channel_type: The channel type of call recording. Possible values include: + "mixed", "unmixed". :vartype recording_channel_type: str or ~azure.communication.callingserver.models.RecordingChannelType - :ivar recording_format_type: Format type of call recording. Possible values include: "wav", + :ivar recording_format_type: The format type of call recording. Possible values include: "wav", "mp3", "mp4". :vartype recording_format_type: str or ~azure.communication.callingserver.models.RecordingFormatType @@ -2137,16 +2042,16 @@ def __init__( :paramtype call_locator: ~azure.communication.callingserver.models.CallLocatorModel :keyword recording_state_callback_uri: The uri to send notifications to. :paramtype recording_state_callback_uri: str - :keyword recording_content_type: Content type of call recording. Possible values include: + :keyword recording_content_type: The content type of call recording. Possible values include: "audio", "audioVideo". :paramtype recording_content_type: str or ~azure.communication.callingserver.models.RecordingContentType - :keyword recording_channel_type: Channel type of call recording. Possible values include: + :keyword recording_channel_type: The channel type of call recording. Possible values include: "mixed", "unmixed". :paramtype recording_channel_type: str or ~azure.communication.callingserver.models.RecordingChannelType - :keyword recording_format_type: Format type of call recording. Possible values include: "wav", - "mp3", "mp4". + :keyword recording_format_type: The format type of call recording. Possible values include: + "wav", "mp3", "mp4". :paramtype recording_format_type: str or ~azure.communication.callingserver.models.RecordingFormatType """ @@ -2244,20 +2149,22 @@ class TransferCallRequest(msrest.serialization.Model): :ivar target_call_connection_id: The call connection id to replace the current call with. This parameter should be used for consultative transfer. :vartype target_call_connection_id: str + :ivar alternate_caller_id: The alternate identity of the transferor if transferring to a pstn + number. + :vartype alternate_caller_id: + ~azure.communication.callingserver.models.PhoneNumberIdentifierModel :ivar user_to_user_information: The user to user information. :vartype user_to_user_information: str :ivar operation_context: The operation context. :vartype operation_context: str - :ivar callback_uri: The callback URI. - :vartype callback_uri: str """ _attribute_map = { 'target_participant': {'key': 'targetParticipant', 'type': 'CommunicationIdentifierModel'}, 'target_call_connection_id': {'key': 'targetCallConnectionId', 'type': 'str'}, + 'alternate_caller_id': {'key': 'alternateCallerId', 'type': 'PhoneNumberIdentifierModel'}, 'user_to_user_information': {'key': 'userToUserInformation', 'type': 'str'}, 'operation_context': {'key': 'operationContext', 'type': 'str'}, - 'callback_uri': {'key': 'callbackUri', 'type': 'str'}, } def __init__( @@ -2271,36 +2178,48 @@ def __init__( :keyword target_call_connection_id: The call connection id to replace the current call with. This parameter should be used for consultative transfer. :paramtype target_call_connection_id: str + :keyword alternate_caller_id: The alternate identity of the transferor if transferring to a + pstn number. + :paramtype alternate_caller_id: + ~azure.communication.callingserver.models.PhoneNumberIdentifierModel :keyword user_to_user_information: The user to user information. :paramtype user_to_user_information: str :keyword operation_context: The operation context. :paramtype operation_context: str - :keyword callback_uri: The callback URI. - :paramtype callback_uri: str """ super(TransferCallRequest, self).__init__(**kwargs) self.target_participant = kwargs.get('target_participant', None) self.target_call_connection_id = kwargs.get('target_call_connection_id', None) + self.alternate_caller_id = kwargs.get('alternate_caller_id', None) self.user_to_user_information = kwargs.get('user_to_user_information', None) self.operation_context = kwargs.get('operation_context', None) - self.callback_uri = kwargs.get('callback_uri', None) -class UnmuteParticipantRequest(msrest.serialization.Model): - """The request payload for unmuting any participant. +class TransferCallResult(msrest.serialization.Model): + """The response payload for transfer call operation. All required parameters must be populated in order to send to Azure. - :ivar identifier: Required. The identifier of the participant to be unmuted in the call. - :vartype identifier: ~azure.communication.callingserver.models.CommunicationIdentifierModel + :ivar operation_id: The operation id. + :vartype operation_id: str + :ivar status: Required. The status of the operation. Possible values include: "notStarted", + "running", "completed", "failed". + :vartype status: str or ~azure.communication.callingserver.models.CallingOperationStatus + :ivar operation_context: The operation context provided by client. + :vartype operation_context: str + :ivar result_info: The result info for the operation. + :vartype result_info: ~azure.communication.callingserver.models.CallingOperationResultDetails """ _validation = { - 'identifier': {'required': True}, + 'status': {'required': True}, } _attribute_map = { - 'identifier': {'key': 'identifier', 'type': 'CommunicationIdentifierModel'}, + 'operation_id': {'key': 'operationId', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'operation_context': {'key': 'operationContext', 'type': 'str'}, + 'result_info': {'key': 'resultInfo', 'type': 'CallingOperationResultDetails'}, } def __init__( @@ -2308,32 +2227,84 @@ def __init__( **kwargs ): """ - :keyword identifier: Required. The identifier of the participant to be unmuted in the call. - :paramtype identifier: ~azure.communication.callingserver.models.CommunicationIdentifierModel + :keyword operation_id: The operation id. + :paramtype operation_id: str + :keyword status: Required. The status of the operation. Possible values include: "notStarted", + "running", "completed", "failed". + :paramtype status: str or ~azure.communication.callingserver.models.CallingOperationStatus + :keyword operation_context: The operation context provided by client. + :paramtype operation_context: str + :keyword result_info: The result info for the operation. + :paramtype result_info: ~azure.communication.callingserver.models.CallingOperationResultDetails """ - super(UnmuteParticipantRequest, self).__init__(**kwargs) - self.identifier = kwargs['identifier'] + super(TransferCallResult, self).__init__(**kwargs) + self.operation_id = kwargs.get('operation_id', None) + self.status = kwargs['status'] + self.operation_context = kwargs.get('operation_context', None) + self.result_info = kwargs.get('result_info', None) + + +class TransferCallResultEvent(msrest.serialization.Model): + """The transfer call result event. + + All required parameters must be populated in order to send to Azure. + + :ivar result_info: The result details. + :vartype result_info: ~azure.communication.callingserver.models.CallingOperationResultDetails + :ivar operation_context: The operation context. + :vartype operation_context: str + :ivar status: Required. The status of the operation. Possible values include: "notStarted", + "running", "completed", "failed". + :vartype status: str or ~azure.communication.callingserver.models.CallingOperationStatus + """ + + _validation = { + 'status': {'required': True}, + } + + _attribute_map = { + 'result_info': {'key': 'resultInfo', 'type': 'CallingOperationResultDetails'}, + 'operation_context': {'key': 'operationContext', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword result_info: The result details. + :paramtype result_info: ~azure.communication.callingserver.models.CallingOperationResultDetails + :keyword operation_context: The operation context. + :paramtype operation_context: str + :keyword status: Required. The status of the operation. Possible values include: "notStarted", + "running", "completed", "failed". + :paramtype status: str or ~azure.communication.callingserver.models.CallingOperationStatus + """ + super(TransferCallResultEvent, self).__init__(**kwargs) + self.result_info = kwargs.get('result_info', None) + self.operation_context = kwargs.get('operation_context', None) + self.status = kwargs['status'] -class UnmuteParticipantWithCallLocatorRequest(msrest.serialization.Model): +class UnmuteParticipantRequest(msrest.serialization.Model): """The request payload for unmuting any participant. All required parameters must be populated in order to send to Azure. - :ivar call_locator: Required. The call locator. - :vartype call_locator: ~azure.communication.callingserver.models.CallLocatorModel :ivar identifier: Required. The identifier of the participant to be unmuted in the call. :vartype identifier: ~azure.communication.callingserver.models.CommunicationIdentifierModel + :ivar operation_context: The operation context. + :vartype operation_context: str """ _validation = { - 'call_locator': {'required': True}, 'identifier': {'required': True}, } _attribute_map = { - 'call_locator': {'key': 'callLocator', 'type': 'CallLocatorModel'}, 'identifier': {'key': 'identifier', 'type': 'CommunicationIdentifierModel'}, + 'operation_context': {'key': 'operationContext', 'type': 'str'}, } def __init__( @@ -2341,14 +2312,14 @@ def __init__( **kwargs ): """ - :keyword call_locator: Required. The call locator. - :paramtype call_locator: ~azure.communication.callingserver.models.CallLocatorModel :keyword identifier: Required. The identifier of the participant to be unmuted in the call. :paramtype identifier: ~azure.communication.callingserver.models.CommunicationIdentifierModel + :keyword operation_context: The operation context. + :paramtype operation_context: str """ - super(UnmuteParticipantWithCallLocatorRequest, self).__init__(**kwargs) - self.call_locator = kwargs['call_locator'] + super(UnmuteParticipantRequest, self).__init__(**kwargs) self.identifier = kwargs['identifier'] + self.operation_context = kwargs.get('operation_context', None) class UpdateAudioRoutingGroupRequest(msrest.serialization.Model): diff --git a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/models/_models_py3.py b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/models/_models_py3.py index a12745002e32..7acc3df4135d 100644 --- a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/models/_models_py3.py +++ b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/models/_models_py3.py @@ -18,10 +18,12 @@ class AddParticipantRequest(msrest.serialization.Model): """The add participant request. + All required parameters must be populated in order to send to Azure. + :ivar alternate_caller_id: The alternate identity of source participant. :vartype alternate_caller_id: ~azure.communication.callingserver.models.PhoneNumberIdentifierModel - :ivar participant: The participant to be added to the call. + :ivar participant: Required. The participant to be added to the call. :vartype participant: ~azure.communication.callingserver.models.CommunicationIdentifierModel :ivar operation_context: The operation context. :vartype operation_context: str @@ -29,6 +31,10 @@ class AddParticipantRequest(msrest.serialization.Model): :vartype callback_uri: str """ + _validation = { + 'participant': {'required': True}, + } + _attribute_map = { 'alternate_caller_id': {'key': 'alternateCallerId', 'type': 'PhoneNumberIdentifierModel'}, 'participant': {'key': 'participant', 'type': 'CommunicationIdentifierModel'}, @@ -39,8 +45,8 @@ class AddParticipantRequest(msrest.serialization.Model): def __init__( self, *, + participant: "CommunicationIdentifierModel", alternate_caller_id: Optional["PhoneNumberIdentifierModel"] = None, - participant: Optional["CommunicationIdentifierModel"] = None, operation_context: Optional[str] = None, callback_uri: Optional[str] = None, **kwargs @@ -49,7 +55,7 @@ def __init__( :keyword alternate_caller_id: The alternate identity of source participant. :paramtype alternate_caller_id: ~azure.communication.callingserver.models.PhoneNumberIdentifierModel - :keyword participant: The participant to be added to the call. + :keyword participant: Required. The participant to be added to the call. :paramtype participant: ~azure.communication.callingserver.models.CommunicationIdentifierModel :keyword operation_context: The operation context. :paramtype operation_context: str @@ -89,7 +95,7 @@ def __init__( class AddParticipantResultEvent(msrest.serialization.Model): - """AddParticipantResultEvent. + """The add participant result event. All required parameters must be populated in order to send to Azure. @@ -145,7 +151,7 @@ class AddParticipantWithCallLocatorRequest(msrest.serialization.Model): :ivar alternate_caller_id: The alternate identity of source participant. :vartype alternate_caller_id: ~azure.communication.callingserver.models.PhoneNumberIdentifierModel - :ivar participant: The participant to be added to the call. + :ivar participant: Required. The participant to be added to the call. :vartype participant: ~azure.communication.callingserver.models.CommunicationIdentifierModel :ivar operation_context: The operation context. :vartype operation_context: str @@ -155,6 +161,7 @@ class AddParticipantWithCallLocatorRequest(msrest.serialization.Model): _validation = { 'call_locator': {'required': True}, + 'participant': {'required': True}, } _attribute_map = { @@ -169,8 +176,8 @@ def __init__( self, *, call_locator: "CallLocatorModel", + participant: "CommunicationIdentifierModel", alternate_caller_id: Optional["PhoneNumberIdentifierModel"] = None, - participant: Optional["CommunicationIdentifierModel"] = None, operation_context: Optional[str] = None, callback_uri: Optional[str] = None, **kwargs @@ -181,7 +188,7 @@ def __init__( :keyword alternate_caller_id: The alternate identity of source participant. :paramtype alternate_caller_id: ~azure.communication.callingserver.models.PhoneNumberIdentifierModel - :keyword participant: The participant to be added to the call. + :keyword participant: Required. The participant to be added to the call. :paramtype participant: ~azure.communication.callingserver.models.CommunicationIdentifierModel :keyword operation_context: The operation context. :paramtype operation_context: str @@ -201,9 +208,9 @@ class AnswerCallRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar incoming_call_context: The context associated with the call. + :ivar incoming_call_context: Required. The context associated with the call. :vartype incoming_call_context: str - :ivar callback_uri: Required. The callback uri. + :ivar callback_uri: The callback uri. :vartype callback_uri: str :ivar requested_media_types: The requested modalities. :vartype requested_media_types: list[str or @@ -214,7 +221,7 @@ class AnswerCallRequest(msrest.serialization.Model): """ _validation = { - 'callback_uri': {'required': True}, + 'incoming_call_context': {'required': True}, } _attribute_map = { @@ -227,16 +234,16 @@ class AnswerCallRequest(msrest.serialization.Model): def __init__( self, *, - callback_uri: str, - incoming_call_context: Optional[str] = None, + incoming_call_context: str, + callback_uri: Optional[str] = None, requested_media_types: Optional[List[Union[str, "CallMediaType"]]] = None, requested_call_events: Optional[List[Union[str, "CallingEventSubscriptionType"]]] = None, **kwargs ): """ - :keyword incoming_call_context: The context associated with the call. + :keyword incoming_call_context: Required. The context associated with the call. :paramtype incoming_call_context: str - :keyword callback_uri: Required. The callback uri. + :keyword callback_uri: The callback uri. :paramtype callback_uri: str :keyword requested_media_types: The requested modalities. :paramtype requested_media_types: list[str or @@ -1292,45 +1299,6 @@ def __init__( self.identifier = identifier -class HoldMeetingAudioWithCallLocatorRequest(msrest.serialization.Model): - """The request payload for holding meeting audio for a participant. - - All required parameters must be populated in order to send to Azure. - - :ivar call_locator: Required. The call locator. - :vartype call_locator: ~azure.communication.callingserver.models.CallLocatorModel - :ivar identifier: Required. The identifier of the participant. - :vartype identifier: ~azure.communication.callingserver.models.CommunicationIdentifierModel - """ - - _validation = { - 'call_locator': {'required': True}, - 'identifier': {'required': True}, - } - - _attribute_map = { - 'call_locator': {'key': 'callLocator', 'type': 'CallLocatorModel'}, - 'identifier': {'key': 'identifier', 'type': 'CommunicationIdentifierModel'}, - } - - def __init__( - self, - *, - call_locator: "CallLocatorModel", - identifier: "CommunicationIdentifierModel", - **kwargs - ): - """ - :keyword call_locator: Required. The call locator. - :paramtype call_locator: ~azure.communication.callingserver.models.CallLocatorModel - :keyword identifier: Required. The identifier of the participant. - :paramtype identifier: ~azure.communication.callingserver.models.CommunicationIdentifierModel - """ - super(HoldMeetingAudioWithCallLocatorRequest, self).__init__(**kwargs) - self.call_locator = call_locator - self.identifier = identifier - - class JoinCallRequest(msrest.serialization.Model): """The request payload for join call. @@ -1487,6 +1455,8 @@ class MuteParticipantRequest(msrest.serialization.Model): :ivar identifier: Required. The identifier of the participant to be muted in the call. :vartype identifier: ~azure.communication.callingserver.models.CommunicationIdentifierModel + :ivar operation_context: The operation context. + :vartype operation_context: str """ _validation = { @@ -1495,59 +1465,25 @@ class MuteParticipantRequest(msrest.serialization.Model): _attribute_map = { 'identifier': {'key': 'identifier', 'type': 'CommunicationIdentifierModel'}, + 'operation_context': {'key': 'operationContext', 'type': 'str'}, } def __init__( self, *, identifier: "CommunicationIdentifierModel", + operation_context: Optional[str] = None, **kwargs ): """ :keyword identifier: Required. The identifier of the participant to be muted in the call. :paramtype identifier: ~azure.communication.callingserver.models.CommunicationIdentifierModel + :keyword operation_context: The operation context. + :paramtype operation_context: str """ super(MuteParticipantRequest, self).__init__(**kwargs) self.identifier = identifier - - -class MuteParticipantWithCallLocatorRequest(msrest.serialization.Model): - """The request payload for muting any participant using call locator. - - All required parameters must be populated in order to send to Azure. - - :ivar call_locator: Required. The call locator. - :vartype call_locator: ~azure.communication.callingserver.models.CallLocatorModel - :ivar identifier: Required. The identifier of the participant to be muted in the call. - :vartype identifier: ~azure.communication.callingserver.models.CommunicationIdentifierModel - """ - - _validation = { - 'call_locator': {'required': True}, - 'identifier': {'required': True}, - } - - _attribute_map = { - 'call_locator': {'key': 'callLocator', 'type': 'CallLocatorModel'}, - 'identifier': {'key': 'identifier', 'type': 'CommunicationIdentifierModel'}, - } - - def __init__( - self, - *, - call_locator: "CallLocatorModel", - identifier: "CommunicationIdentifierModel", - **kwargs - ): - """ - :keyword call_locator: Required. The call locator. - :paramtype call_locator: ~azure.communication.callingserver.models.CallLocatorModel - :keyword identifier: Required. The identifier of the participant to be muted in the call. - :paramtype identifier: ~azure.communication.callingserver.models.CommunicationIdentifierModel - """ - super(MuteParticipantWithCallLocatorRequest, self).__init__(**kwargs) - self.call_locator = call_locator - self.identifier = identifier + self.operation_context = operation_context class ParticipantsUpdatedEvent(msrest.serialization.Model): @@ -2225,45 +2161,6 @@ def __init__( self.identifier = identifier -class ResumeMeetingAudioWithCallLocatorRequest(msrest.serialization.Model): - """The request payload for resuming meeting audio for a participant. - - All required parameters must be populated in order to send to Azure. - - :ivar call_locator: Required. The call locator. - :vartype call_locator: ~azure.communication.callingserver.models.CallLocatorModel - :ivar identifier: Required. The identifier of the participant. - :vartype identifier: ~azure.communication.callingserver.models.CommunicationIdentifierModel - """ - - _validation = { - 'call_locator': {'required': True}, - 'identifier': {'required': True}, - } - - _attribute_map = { - 'call_locator': {'key': 'callLocator', 'type': 'CallLocatorModel'}, - 'identifier': {'key': 'identifier', 'type': 'CommunicationIdentifierModel'}, - } - - def __init__( - self, - *, - call_locator: "CallLocatorModel", - identifier: "CommunicationIdentifierModel", - **kwargs - ): - """ - :keyword call_locator: Required. The call locator. - :paramtype call_locator: ~azure.communication.callingserver.models.CallLocatorModel - :keyword identifier: Required. The identifier of the participant. - :paramtype identifier: ~azure.communication.callingserver.models.CommunicationIdentifierModel - """ - super(ResumeMeetingAudioWithCallLocatorRequest, self).__init__(**kwargs) - self.call_locator = call_locator - self.identifier = identifier - - class StartCallRecordingResult(msrest.serialization.Model): """The response payload of start call recording operation. @@ -2298,15 +2195,15 @@ class StartCallRecordingWithCallLocatorRequest(msrest.serialization.Model): :vartype call_locator: ~azure.communication.callingserver.models.CallLocatorModel :ivar recording_state_callback_uri: The uri to send notifications to. :vartype recording_state_callback_uri: str - :ivar recording_content_type: Content type of call recording. Possible values include: "audio", - "audioVideo". + :ivar recording_content_type: The content type of call recording. Possible values include: + "audio", "audioVideo". :vartype recording_content_type: str or ~azure.communication.callingserver.models.RecordingContentType - :ivar recording_channel_type: Channel type of call recording. Possible values include: "mixed", - "unmixed". + :ivar recording_channel_type: The channel type of call recording. Possible values include: + "mixed", "unmixed". :vartype recording_channel_type: str or ~azure.communication.callingserver.models.RecordingChannelType - :ivar recording_format_type: Format type of call recording. Possible values include: "wav", + :ivar recording_format_type: The format type of call recording. Possible values include: "wav", "mp3", "mp4". :vartype recording_format_type: str or ~azure.communication.callingserver.models.RecordingFormatType @@ -2339,16 +2236,16 @@ def __init__( :paramtype call_locator: ~azure.communication.callingserver.models.CallLocatorModel :keyword recording_state_callback_uri: The uri to send notifications to. :paramtype recording_state_callback_uri: str - :keyword recording_content_type: Content type of call recording. Possible values include: + :keyword recording_content_type: The content type of call recording. Possible values include: "audio", "audioVideo". :paramtype recording_content_type: str or ~azure.communication.callingserver.models.RecordingContentType - :keyword recording_channel_type: Channel type of call recording. Possible values include: + :keyword recording_channel_type: The channel type of call recording. Possible values include: "mixed", "unmixed". :paramtype recording_channel_type: str or ~azure.communication.callingserver.models.RecordingChannelType - :keyword recording_format_type: Format type of call recording. Possible values include: "wav", - "mp3", "mp4". + :keyword recording_format_type: The format type of call recording. Possible values include: + "wav", "mp3", "mp4". :paramtype recording_format_type: str or ~azure.communication.callingserver.models.RecordingFormatType """ @@ -2452,20 +2349,22 @@ class TransferCallRequest(msrest.serialization.Model): :ivar target_call_connection_id: The call connection id to replace the current call with. This parameter should be used for consultative transfer. :vartype target_call_connection_id: str + :ivar alternate_caller_id: The alternate identity of the transferor if transferring to a pstn + number. + :vartype alternate_caller_id: + ~azure.communication.callingserver.models.PhoneNumberIdentifierModel :ivar user_to_user_information: The user to user information. :vartype user_to_user_information: str :ivar operation_context: The operation context. :vartype operation_context: str - :ivar callback_uri: The callback URI. - :vartype callback_uri: str """ _attribute_map = { 'target_participant': {'key': 'targetParticipant', 'type': 'CommunicationIdentifierModel'}, 'target_call_connection_id': {'key': 'targetCallConnectionId', 'type': 'str'}, + 'alternate_caller_id': {'key': 'alternateCallerId', 'type': 'PhoneNumberIdentifierModel'}, 'user_to_user_information': {'key': 'userToUserInformation', 'type': 'str'}, 'operation_context': {'key': 'operationContext', 'type': 'str'}, - 'callback_uri': {'key': 'callbackUri', 'type': 'str'}, } def __init__( @@ -2473,9 +2372,9 @@ def __init__( *, target_participant: Optional["CommunicationIdentifierModel"] = None, target_call_connection_id: Optional[str] = None, + alternate_caller_id: Optional["PhoneNumberIdentifierModel"] = None, user_to_user_information: Optional[str] = None, operation_context: Optional[str] = None, - callback_uri: Optional[str] = None, **kwargs ): """ @@ -2485,89 +2384,160 @@ def __init__( :keyword target_call_connection_id: The call connection id to replace the current call with. This parameter should be used for consultative transfer. :paramtype target_call_connection_id: str + :keyword alternate_caller_id: The alternate identity of the transferor if transferring to a + pstn number. + :paramtype alternate_caller_id: + ~azure.communication.callingserver.models.PhoneNumberIdentifierModel :keyword user_to_user_information: The user to user information. :paramtype user_to_user_information: str :keyword operation_context: The operation context. :paramtype operation_context: str - :keyword callback_uri: The callback URI. - :paramtype callback_uri: str """ super(TransferCallRequest, self).__init__(**kwargs) self.target_participant = target_participant self.target_call_connection_id = target_call_connection_id + self.alternate_caller_id = alternate_caller_id self.user_to_user_information = user_to_user_information self.operation_context = operation_context - self.callback_uri = callback_uri -class UnmuteParticipantRequest(msrest.serialization.Model): - """The request payload for unmuting any participant. +class TransferCallResult(msrest.serialization.Model): + """The response payload for transfer call operation. All required parameters must be populated in order to send to Azure. - :ivar identifier: Required. The identifier of the participant to be unmuted in the call. - :vartype identifier: ~azure.communication.callingserver.models.CommunicationIdentifierModel + :ivar operation_id: The operation id. + :vartype operation_id: str + :ivar status: Required. The status of the operation. Possible values include: "notStarted", + "running", "completed", "failed". + :vartype status: str or ~azure.communication.callingserver.models.CallingOperationStatus + :ivar operation_context: The operation context provided by client. + :vartype operation_context: str + :ivar result_info: The result info for the operation. + :vartype result_info: ~azure.communication.callingserver.models.CallingOperationResultDetails """ _validation = { - 'identifier': {'required': True}, + 'status': {'required': True}, } _attribute_map = { - 'identifier': {'key': 'identifier', 'type': 'CommunicationIdentifierModel'}, + 'operation_id': {'key': 'operationId', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'operation_context': {'key': 'operationContext', 'type': 'str'}, + 'result_info': {'key': 'resultInfo', 'type': 'CallingOperationResultDetails'}, } def __init__( self, *, - identifier: "CommunicationIdentifierModel", + status: Union[str, "CallingOperationStatus"], + operation_id: Optional[str] = None, + operation_context: Optional[str] = None, + result_info: Optional["CallingOperationResultDetails"] = None, **kwargs ): """ - :keyword identifier: Required. The identifier of the participant to be unmuted in the call. - :paramtype identifier: ~azure.communication.callingserver.models.CommunicationIdentifierModel + :keyword operation_id: The operation id. + :paramtype operation_id: str + :keyword status: Required. The status of the operation. Possible values include: "notStarted", + "running", "completed", "failed". + :paramtype status: str or ~azure.communication.callingserver.models.CallingOperationStatus + :keyword operation_context: The operation context provided by client. + :paramtype operation_context: str + :keyword result_info: The result info for the operation. + :paramtype result_info: ~azure.communication.callingserver.models.CallingOperationResultDetails """ - super(UnmuteParticipantRequest, self).__init__(**kwargs) - self.identifier = identifier + super(TransferCallResult, self).__init__(**kwargs) + self.operation_id = operation_id + self.status = status + self.operation_context = operation_context + self.result_info = result_info + + +class TransferCallResultEvent(msrest.serialization.Model): + """The transfer call result event. + + All required parameters must be populated in order to send to Azure. + + :ivar result_info: The result details. + :vartype result_info: ~azure.communication.callingserver.models.CallingOperationResultDetails + :ivar operation_context: The operation context. + :vartype operation_context: str + :ivar status: Required. The status of the operation. Possible values include: "notStarted", + "running", "completed", "failed". + :vartype status: str or ~azure.communication.callingserver.models.CallingOperationStatus + """ + + _validation = { + 'status': {'required': True}, + } + + _attribute_map = { + 'result_info': {'key': 'resultInfo', 'type': 'CallingOperationResultDetails'}, + 'operation_context': {'key': 'operationContext', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Union[str, "CallingOperationStatus"], + result_info: Optional["CallingOperationResultDetails"] = None, + operation_context: Optional[str] = None, + **kwargs + ): + """ + :keyword result_info: The result details. + :paramtype result_info: ~azure.communication.callingserver.models.CallingOperationResultDetails + :keyword operation_context: The operation context. + :paramtype operation_context: str + :keyword status: Required. The status of the operation. Possible values include: "notStarted", + "running", "completed", "failed". + :paramtype status: str or ~azure.communication.callingserver.models.CallingOperationStatus + """ + super(TransferCallResultEvent, self).__init__(**kwargs) + self.result_info = result_info + self.operation_context = operation_context + self.status = status -class UnmuteParticipantWithCallLocatorRequest(msrest.serialization.Model): +class UnmuteParticipantRequest(msrest.serialization.Model): """The request payload for unmuting any participant. All required parameters must be populated in order to send to Azure. - :ivar call_locator: Required. The call locator. - :vartype call_locator: ~azure.communication.callingserver.models.CallLocatorModel :ivar identifier: Required. The identifier of the participant to be unmuted in the call. :vartype identifier: ~azure.communication.callingserver.models.CommunicationIdentifierModel + :ivar operation_context: The operation context. + :vartype operation_context: str """ _validation = { - 'call_locator': {'required': True}, 'identifier': {'required': True}, } _attribute_map = { - 'call_locator': {'key': 'callLocator', 'type': 'CallLocatorModel'}, 'identifier': {'key': 'identifier', 'type': 'CommunicationIdentifierModel'}, + 'operation_context': {'key': 'operationContext', 'type': 'str'}, } def __init__( self, *, - call_locator: "CallLocatorModel", identifier: "CommunicationIdentifierModel", + operation_context: Optional[str] = None, **kwargs ): """ - :keyword call_locator: Required. The call locator. - :paramtype call_locator: ~azure.communication.callingserver.models.CallLocatorModel :keyword identifier: Required. The identifier of the participant to be unmuted in the call. :paramtype identifier: ~azure.communication.callingserver.models.CommunicationIdentifierModel + :keyword operation_context: The operation context. + :paramtype operation_context: str """ - super(UnmuteParticipantWithCallLocatorRequest, self).__init__(**kwargs) - self.call_locator = call_locator + super(UnmuteParticipantRequest, self).__init__(**kwargs) self.identifier = identifier + self.operation_context = operation_context class UpdateAudioRoutingGroupRequest(msrest.serialization.Model): diff --git a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/operations/_call_connections_operations.py b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/operations/_call_connections_operations.py index bafa766048b7..fde295ea6e14 100644 --- a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/operations/_call_connections_operations.py +++ b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/operations/_call_connections_operations.py @@ -22,11 +22,11 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False # fmt: off def build_get_audio_routing_groups_request( @@ -35,7 +35,8 @@ def build_get_audio_routing_groups_request( **kwargs # type: Any ): # type: (...) -> HttpRequest - api_version = "2021-11-15-preview" + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/callConnections/{callConnectionId}/audioRoutingGroups/{audioRoutingGroupId}') @@ -69,7 +70,8 @@ def build_delete_audio_routing_group_request( **kwargs # type: Any ): # type: (...) -> HttpRequest - api_version = "2021-11-15-preview" + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/callConnections/{callConnectionId}/audioRoutingGroups/{audioRoutingGroupId}') @@ -103,9 +105,9 @@ def build_update_audio_routing_group_request( **kwargs # type: Any ): # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/callConnections/{callConnectionId}/audioRoutingGroups/{audioRoutingGroupId}') @@ -139,9 +141,9 @@ def build_create_call_request( **kwargs # type: Any ): # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/callConnections') @@ -170,7 +172,8 @@ def build_get_call_request( **kwargs # type: Any ): # type: (...) -> HttpRequest - api_version = "2021-11-15-preview" + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/callConnections/{callConnectionId}') @@ -202,7 +205,8 @@ def build_delete_call_request( **kwargs # type: Any ): # type: (...) -> HttpRequest - api_version = "2021-11-15-preview" + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/callConnections/{callConnectionId}') @@ -234,7 +238,8 @@ def build_hangup_call_request( **kwargs # type: Any ): # type: (...) -> HttpRequest - api_version = "2021-11-15-preview" + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/callConnections/{callConnectionId}/:hangup') @@ -266,9 +271,9 @@ def build_play_audio_request( **kwargs # type: Any ): # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/callConnections/{callConnectionId}/:playAudio') @@ -302,7 +307,8 @@ def build_cancel_all_media_operations_request( **kwargs # type: Any ): # type: (...) -> HttpRequest - api_version = "2021-11-15-preview" + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/callConnections/{callConnectionId}/:cancelAllMediaOperations') @@ -334,7 +340,8 @@ def build_keep_alive_request( **kwargs # type: Any ): # type: (...) -> HttpRequest - api_version = "2021-11-15-preview" + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/callConnections/{callConnectionId}/:keepAlive') @@ -366,9 +373,9 @@ def build_transfer_request( **kwargs # type: Any ): # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/callConnections/{callConnectionId}/:transfer') @@ -402,9 +409,9 @@ def build_create_audio_routing_group_request( **kwargs # type: Any ): # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/callConnections/{callConnectionId}/:createAudioRoutingGroup') @@ -438,7 +445,8 @@ def build_get_participants_request( **kwargs # type: Any ): # type: (...) -> HttpRequest - api_version = "2021-11-15-preview" + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/callConnections/{callConnectionId}/participants') @@ -470,9 +478,9 @@ def build_add_participant_request( **kwargs # type: Any ): # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/callConnections/{callConnectionId}/participants') @@ -506,9 +514,9 @@ def build_remove_participant_request( **kwargs # type: Any ): # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/callConnections/{callConnectionId}/participants:remove') @@ -542,9 +550,9 @@ def build_get_participant_request( **kwargs # type: Any ): # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/callConnections/{callConnectionId}/participants:get') @@ -578,9 +586,9 @@ def build_participant_play_audio_request( **kwargs # type: Any ): # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/callConnections/{callConnectionId}/participants:playAudio') @@ -614,9 +622,9 @@ def build_cancel_participant_media_operation_request( **kwargs # type: Any ): # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/callConnections/{callConnectionId}/participants:cancelMediaOperation') @@ -650,9 +658,9 @@ def build_mute_participant_request( **kwargs # type: Any ): # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/callConnections/{callConnectionId}/participants:mute') @@ -686,9 +694,9 @@ def build_unmute_participant_request( **kwargs # type: Any ): # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/callConnections/{callConnectionId}/participants:unmute') @@ -722,9 +730,9 @@ def build_hold_participant_meeting_audio_request( **kwargs # type: Any ): # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/callConnections/{callConnectionId}/participants:holdMeetingAudio') @@ -758,9 +766,9 @@ def build_resume_participant_meeting_audio_request( **kwargs # type: Any ): # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/callConnections/{callConnectionId}/participants:resumeMeetingAudio') @@ -827,6 +835,9 @@ def get_audio_routing_groups( :type call_connection_id: str :param audio_routing_group_id: The audio routing group id. :type audio_routing_group_id: str + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AudioRoutingGroupResult, or the result of cls(response) :rtype: ~azure.communication.callingserver.models.AudioRoutingGroupResult @@ -843,10 +854,13 @@ def get_audio_routing_groups( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + request = build_get_audio_routing_groups_request( call_connection_id=call_connection_id, audio_routing_group_id=audio_routing_group_id, + api_version=api_version, template_url=self.get_audio_routing_groups.metadata['url'], ) request = _convert_request(request) @@ -888,6 +902,9 @@ def delete_audio_routing_group( :type call_connection_id: str :param audio_routing_group_id: The audio routing group id. :type audio_routing_group_id: str + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -904,10 +921,13 @@ def delete_audio_routing_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + request = build_delete_audio_routing_group_request( call_connection_id=call_connection_id, audio_routing_group_id=audio_routing_group_id, + api_version=api_version, template_url=self.delete_audio_routing_group.metadata['url'], ) request = _convert_request(request) @@ -949,6 +969,9 @@ def update_audio_routing_group( :param update_audio_routing_group_request: The update audio routing group request. :type update_audio_routing_group_request: ~azure.communication.callingserver.models.UpdateAudioRoutingGroupRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -965,6 +988,7 @@ def update_audio_routing_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(update_audio_routing_group_request, 'UpdateAudioRoutingGroupRequest') @@ -972,6 +996,7 @@ def update_audio_routing_group( request = build_update_audio_routing_group_request( call_connection_id=call_connection_id, audio_routing_group_id=audio_routing_group_id, + api_version=api_version, content_type=content_type, json=json, template_url=self.update_audio_routing_group.metadata['url'], @@ -1008,6 +1033,9 @@ def create_call( :param call_request: Create call request. :type call_request: ~azure.communication.callingserver.models.CreateCallRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CreateCallResult, or the result of cls(response) :rtype: ~azure.communication.callingserver.models.CreateCallResult @@ -1024,11 +1052,13 @@ def create_call( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(call_request, 'CreateCallRequest') request = build_create_call_request( + api_version=api_version, content_type=content_type, json=json, template_url=self.create_call.metadata['url'], @@ -1069,6 +1099,9 @@ def get_call( :param call_connection_id: The call connection id. :type call_connection_id: str + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CallConnectionProperties, or the result of cls(response) :rtype: ~azure.communication.callingserver.models.CallConnectionProperties @@ -1085,9 +1118,12 @@ def get_call( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + request = build_get_call_request( call_connection_id=call_connection_id, + api_version=api_version, template_url=self.get_call.metadata['url'], ) request = _convert_request(request) @@ -1126,6 +1162,9 @@ def delete_call( :param call_connection_id: The call connection id. :type call_connection_id: str + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1142,9 +1181,12 @@ def delete_call( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + request = build_delete_call_request( call_connection_id=call_connection_id, + api_version=api_version, template_url=self.delete_call.metadata['url'], ) request = _convert_request(request) @@ -1179,6 +1221,9 @@ def hangup_call( :param call_connection_id: The call connection id. :type call_connection_id: str + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1195,9 +1240,12 @@ def hangup_call( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + request = build_hangup_call_request( call_connection_id=call_connection_id, + api_version=api_version, template_url=self.hangup_call.metadata['url'], ) request = _convert_request(request) @@ -1223,7 +1271,7 @@ def hangup_call( def play_audio( self, call_connection_id, # type: str - request, # type: "_models.PlayAudioRequest" + play_audio_request, # type: "_models.PlayAudioRequest" **kwargs # type: Any ): # type: (...) -> "_models.PlayAudioResult" @@ -1233,8 +1281,11 @@ def play_audio( :param call_connection_id: The call connection id. :type call_connection_id: str - :param request: Play audio request. - :type request: ~azure.communication.callingserver.models.PlayAudioRequest + :param play_audio_request: The play audio request. + :type play_audio_request: ~azure.communication.callingserver.models.PlayAudioRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PlayAudioResult, or the result of cls(response) :rtype: ~azure.communication.callingserver.models.PlayAudioResult @@ -1251,12 +1302,14 @@ def play_audio( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - json = self._serialize.body(request, 'PlayAudioRequest') + json = self._serialize.body(play_audio_request, 'PlayAudioRequest') request = build_play_audio_request( call_connection_id=call_connection_id, + api_version=api_version, content_type=content_type, json=json, template_url=self.play_audio.metadata['url'], @@ -1297,6 +1350,9 @@ def cancel_all_media_operations( :param call_connection_id: The call connection id. :type call_connection_id: str + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1313,9 +1369,12 @@ def cancel_all_media_operations( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + request = build_cancel_all_media_operations_request( call_connection_id=call_connection_id, + api_version=api_version, template_url=self.cancel_all_media_operations.metadata['url'], ) request = _convert_request(request) @@ -1350,6 +1409,9 @@ def keep_alive( :param call_connection_id: The call connection id. :type call_connection_id: str + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1366,9 +1428,12 @@ def keep_alive( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + request = build_keep_alive_request( call_connection_id=call_connection_id, + api_version=api_version, template_url=self.keep_alive.metadata['url'], ) request = _convert_request(request) @@ -1397,7 +1462,7 @@ def transfer( transfer_call_request, # type: "_models.TransferCallRequest" **kwargs # type: Any ): - # type: (...) -> None + # type: (...) -> "_models.TransferCallResult" """Transfer the call to a participant or to another call. Transfer the call to a participant or to another call. @@ -1406,12 +1471,15 @@ def transfer( :type call_connection_id: str :param transfer_call_request: The transfer call request. :type transfer_call_request: ~azure.communication.callingserver.models.TransferCallRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None + :return: TransferCallResult, or the result of cls(response) + :rtype: ~azure.communication.callingserver.models.TransferCallResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] + cls = kwargs.pop('cls', None) # type: ClsType["_models.TransferCallResult"] error_map = { 409: ResourceExistsError, 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), @@ -1422,12 +1490,14 @@ def transfer( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(transfer_call_request, 'TransferCallRequest') request = build_transfer_request( call_connection_id=call_connection_id, + api_version=api_version, content_type=content_type, json=json, template_url=self.transfer.metadata['url'], @@ -1445,8 +1515,12 @@ def transfer( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) + deserialized = self._deserialize('TransferCallResult', pipeline_response) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) + + return deserialized transfer.metadata = {'url': '/calling/callConnections/{callConnectionId}/:transfer'} # type: ignore @@ -1468,6 +1542,9 @@ def create_audio_routing_group( :param audio_routing_group_request: The audio routing group request. :type audio_routing_group_request: ~azure.communication.callingserver.models.AudioRoutingGroupRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CreateAudioRoutingGroupResult, or the result of cls(response) :rtype: ~azure.communication.callingserver.models.CreateAudioRoutingGroupResult @@ -1484,12 +1561,14 @@ def create_audio_routing_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(audio_routing_group_request, 'AudioRoutingGroupRequest') request = build_create_audio_routing_group_request( call_connection_id=call_connection_id, + api_version=api_version, content_type=content_type, json=json, template_url=self.create_audio_routing_group.metadata['url'], @@ -1530,6 +1609,9 @@ def get_participants( :param call_connection_id: The call connection id. :type call_connection_id: str + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of CallParticipant, or the result of cls(response) :rtype: list[~azure.communication.callingserver.models.CallParticipant] @@ -1546,9 +1628,12 @@ def get_participants( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + request = build_get_participants_request( call_connection_id=call_connection_id, + api_version=api_version, template_url=self.get_participants.metadata['url'], ) request = _convert_request(request) @@ -1590,6 +1675,9 @@ def add_participant( :type call_connection_id: str :param add_participant_request: Add participant request. :type add_participant_request: ~azure.communication.callingserver.models.AddParticipantRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AddParticipantResult, or the result of cls(response) :rtype: ~azure.communication.callingserver.models.AddParticipantResult @@ -1606,12 +1694,14 @@ def add_participant( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(add_participant_request, 'AddParticipantRequest') request = build_add_participant_request( call_connection_id=call_connection_id, + api_version=api_version, content_type=content_type, json=json, template_url=self.add_participant.metadata['url'], @@ -1657,6 +1747,9 @@ def remove_participant( call. :type remove_participant_request: ~azure.communication.callingserver.models.RemoveParticipantRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1673,12 +1766,14 @@ def remove_participant( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(remove_participant_request, 'RemoveParticipantRequest') request = build_remove_participant_request( call_connection_id=call_connection_id, + api_version=api_version, content_type=content_type, json=json, template_url=self.remove_participant.metadata['url'], @@ -1718,6 +1813,9 @@ def get_participant( :type call_connection_id: str :param get_participant_request: The identifier of the participant to get from the call. :type get_participant_request: ~azure.communication.callingserver.models.GetParticipantRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of CallParticipant, or the result of cls(response) :rtype: list[~azure.communication.callingserver.models.CallParticipant] @@ -1734,12 +1832,14 @@ def get_participant( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(get_participant_request, 'GetParticipantRequest') request = build_get_participant_request( call_connection_id=call_connection_id, + api_version=api_version, content_type=content_type, json=json, template_url=self.get_participant.metadata['url'], @@ -1784,6 +1884,9 @@ def participant_play_audio( :param play_audio_to_participant_request: The play audio to participant request. :type play_audio_to_participant_request: ~azure.communication.callingserver.models.PlayAudioToParticipantRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PlayAudioResult, or the result of cls(response) :rtype: ~azure.communication.callingserver.models.PlayAudioResult @@ -1800,12 +1903,14 @@ def participant_play_audio( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(play_audio_to_participant_request, 'PlayAudioToParticipantRequest') request = build_participant_play_audio_request( call_connection_id=call_connection_id, + api_version=api_version, content_type=content_type, json=json, template_url=self.participant_play_audio.metadata['url'], @@ -1850,6 +1955,9 @@ def cancel_participant_media_operation( :param cancel_media_operation_request: The cancel media operation for participant request. :type cancel_media_operation_request: ~azure.communication.callingserver.models.CancelParticipantMediaOperationRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1866,12 +1974,14 @@ def cancel_participant_media_operation( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(cancel_media_operation_request, 'CancelParticipantMediaOperationRequest') request = build_cancel_participant_media_operation_request( call_connection_id=call_connection_id, + api_version=api_version, content_type=content_type, json=json, template_url=self.cancel_participant_media_operation.metadata['url'], @@ -1912,6 +2022,9 @@ def mute_participant( :param mute_participant_request: The identifier of the participant to mute in the call. :type mute_participant_request: ~azure.communication.callingserver.models.MuteParticipantRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1928,12 +2041,14 @@ def mute_participant( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(mute_participant_request, 'MuteParticipantRequest') request = build_mute_participant_request( call_connection_id=call_connection_id, + api_version=api_version, content_type=content_type, json=json, template_url=self.mute_participant.metadata['url'], @@ -1974,6 +2089,9 @@ def unmute_participant( :param unmute_participant_request: The identifier of the participant to unmute in the call. :type unmute_participant_request: ~azure.communication.callingserver.models.UnmuteParticipantRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1990,12 +2108,14 @@ def unmute_participant( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(unmute_participant_request, 'UnmuteParticipantRequest') request = build_unmute_participant_request( call_connection_id=call_connection_id, + api_version=api_version, content_type=content_type, json=json, template_url=self.unmute_participant.metadata['url'], @@ -2037,6 +2157,9 @@ def hold_participant_meeting_audio( participant. :type hold_meeting_audio_request: ~azure.communication.callingserver.models.HoldMeetingAudioRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -2053,12 +2176,14 @@ def hold_participant_meeting_audio( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(hold_meeting_audio_request, 'HoldMeetingAudioRequest') request = build_hold_participant_meeting_audio_request( call_connection_id=call_connection_id, + api_version=api_version, content_type=content_type, json=json, template_url=self.hold_participant_meeting_audio.metadata['url'], @@ -2100,6 +2225,9 @@ def resume_participant_meeting_audio( participant. :type resume_meeting_audio_request: ~azure.communication.callingserver.models.ResumeMeetingAudioRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -2116,12 +2244,14 @@ def resume_participant_meeting_audio( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(resume_meeting_audio_request, 'ResumeMeetingAudioRequest') request = build_resume_participant_meeting_audio_request( call_connection_id=call_connection_id, + api_version=api_version, content_type=content_type, json=json, template_url=self.resume_participant_meeting_audio.metadata['url'], diff --git a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/operations/_server_calls_operations.py b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/operations/_server_calls_operations.py index 6439ba4d4355..060ea2a09016 100644 --- a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/operations/_server_calls_operations.py +++ b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_generated/operations/_server_calls_operations.py @@ -22,20 +22,20 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False # fmt: off def build_get_participants_request( **kwargs # type: Any ): # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/participants:getAll') @@ -63,9 +63,9 @@ def build_add_participant_request( **kwargs # type: Any ): # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/participants') @@ -93,9 +93,9 @@ def build_remove_participant_request( **kwargs # type: Any ): # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/participants:remove') @@ -123,9 +123,9 @@ def build_get_participant_request( **kwargs # type: Any ): # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/participants:get') @@ -153,9 +153,9 @@ def build_participant_play_audio_request( **kwargs # type: Any ): # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/participants:playAudio') @@ -183,9 +183,9 @@ def build_cancel_participant_media_operation_request( **kwargs # type: Any ): # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/participants:cancelMediaOperation') @@ -209,133 +209,13 @@ def build_cancel_participant_media_operation_request( ) -def build_mute_participant_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-11-15-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/calling/participants:mute') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_unmute_participant_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-11-15-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/calling/participants:unmute') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_hold_participant_meeting_audio_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-11-15-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/calling/participants:holdMeetingAudio') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_resume_participant_meeting_audio_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-11-15-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/calling/participants:resumeMeetingAudio') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - def build_start_recording_request( **kwargs # type: Any ): # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/recordings') @@ -364,7 +244,8 @@ def build_get_recording_properties_request( **kwargs # type: Any ): # type: (...) -> HttpRequest - api_version = "2021-11-15-preview" + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/recordings/{recordingId}') @@ -396,7 +277,8 @@ def build_stop_recording_request( **kwargs # type: Any ): # type: (...) -> HttpRequest - api_version = "2021-11-15-preview" + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/recordings/{recordingId}') @@ -428,7 +310,8 @@ def build_pause_recording_request( **kwargs # type: Any ): # type: (...) -> HttpRequest - api_version = "2021-11-15-preview" + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/recordings/{recordingId}/:pause') @@ -460,7 +343,8 @@ def build_resume_recording_request( **kwargs # type: Any ): # type: (...) -> HttpRequest - api_version = "2021-11-15-preview" + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling/recordings/{recordingId}/:resume') @@ -491,9 +375,9 @@ def build_join_call_request( **kwargs # type: Any ): # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling:join') @@ -521,9 +405,9 @@ def build_play_audio_request( **kwargs # type: Any ): # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling:playAudio') @@ -551,9 +435,9 @@ def build_cancel_media_operation_request( **kwargs # type: Any ): # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling:cancelMediaOperation') @@ -581,9 +465,9 @@ def build_answer_call_request( **kwargs # type: Any ): # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling:answer') @@ -611,9 +495,9 @@ def build_reject_call_request( **kwargs # type: Any ): # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling:reject') @@ -641,9 +525,9 @@ def build_redirect_call_request( **kwargs # type: Any ): # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/calling:redirect') @@ -704,6 +588,9 @@ def get_participants( participants. :type get_all_participants_with_call_locator_request: ~azure.communication.callingserver.models.GetAllParticipantsWithCallLocatorRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of CallParticipant, or the result of cls(response) :rtype: list[~azure.communication.callingserver.models.CallParticipant] @@ -720,11 +607,13 @@ def get_participants( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(get_all_participants_with_call_locator_request, 'GetAllParticipantsWithCallLocatorRequest') request = build_get_participants_request( + api_version=api_version, content_type=content_type, json=json, template_url=self.get_participants.metadata['url'], @@ -767,6 +656,9 @@ def add_participant( locator. :type add_participant_with_call_locator_request: ~azure.communication.callingserver.models.AddParticipantWithCallLocatorRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AddParticipantResult, or the result of cls(response) :rtype: ~azure.communication.callingserver.models.AddParticipantResult @@ -783,11 +675,13 @@ def add_participant( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(add_participant_with_call_locator_request, 'AddParticipantWithCallLocatorRequest') request = build_add_participant_request( + api_version=api_version, content_type=content_type, json=json, template_url=self.add_participant.metadata['url'], @@ -830,6 +724,9 @@ def remove_participant( removed from the call. :type remove_participant_with_call_locator_request: ~azure.communication.callingserver.models.RemoveParticipantWithCallLocatorRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -846,11 +743,13 @@ def remove_participant( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(remove_participant_with_call_locator_request, 'RemoveParticipantWithCallLocatorRequest') request = build_remove_participant_request( + api_version=api_version, content_type=content_type, json=json, template_url=self.remove_participant.metadata['url'], @@ -888,6 +787,9 @@ def get_participant( :param get_participant_with_call_locator_request: The get participant request. :type get_participant_with_call_locator_request: ~azure.communication.callingserver.models.GetParticipantWithCallLocatorRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of CallParticipant, or the result of cls(response) :rtype: list[~azure.communication.callingserver.models.CallParticipant] @@ -904,11 +806,13 @@ def get_participant( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(get_participant_with_call_locator_request, 'GetParticipantWithCallLocatorRequest') request = build_get_participant_request( + api_version=api_version, content_type=content_type, json=json, template_url=self.get_participant.metadata['url'], @@ -950,6 +854,9 @@ def participant_play_audio( :param play_audio_to_participant_request: The play audio to participant request. :type play_audio_to_participant_request: ~azure.communication.callingserver.models.PlayAudioToParticipantWithCallLocatorRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PlayAudioResult, or the result of cls(response) :rtype: ~azure.communication.callingserver.models.PlayAudioResult @@ -966,11 +873,13 @@ def participant_play_audio( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(play_audio_to_participant_request, 'PlayAudioToParticipantWithCallLocatorRequest') request = build_participant_play_audio_request( + api_version=api_version, content_type=content_type, json=json, template_url=self.participant_play_audio.metadata['url'], @@ -1013,6 +922,9 @@ def cancel_participant_media_operation( request. :type cancel_participant_media_operation_request: ~azure.communication.callingserver.models.CancelParticipantMediaOperationWithCallLocatorRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1029,11 +941,13 @@ def cancel_participant_media_operation( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(cancel_participant_media_operation_request, 'CancelParticipantMediaOperationWithCallLocatorRequest') request = build_cancel_participant_media_operation_request( + api_version=api_version, content_type=content_type, json=json, template_url=self.cancel_participant_media_operation.metadata['url'], @@ -1057,242 +971,6 @@ def cancel_participant_media_operation( cancel_participant_media_operation.metadata = {'url': '/calling/participants:cancelMediaOperation'} # type: ignore - @distributed_trace - def mute_participant( - self, - mute_participant_with_call_locator_request, # type: "_models.MuteParticipantWithCallLocatorRequest" - **kwargs # type: Any - ): - # type: (...) -> None - """Mute participant in the call. - - Mute participant in the call. - - :param mute_participant_with_call_locator_request: The identifier of the participant to mute in - the call. - :type mute_participant_with_call_locator_request: - ~azure.communication.callingserver.models.MuteParticipantWithCallLocatorRequest - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 409: ResourceExistsError, - 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 401: lambda response: ClientAuthenticationError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 403: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - json = self._serialize.body(mute_participant_with_call_locator_request, 'MuteParticipantWithCallLocatorRequest') - - request = build_mute_participant_request( - content_type=content_type, - json=json, - template_url=self.mute_participant.metadata['url'], - ) - request = _convert_request(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) - - mute_participant.metadata = {'url': '/calling/participants:mute'} # type: ignore - - - @distributed_trace - def unmute_participant( - self, - unmute_participant_with_call_locator_request, # type: "_models.UnmuteParticipantWithCallLocatorRequest" - **kwargs # type: Any - ): - # type: (...) -> None - """Unmute participant in the call. - - Unmute participant in the call. - - :param unmute_participant_with_call_locator_request: The identifier of the participant to - unmute in the call. - :type unmute_participant_with_call_locator_request: - ~azure.communication.callingserver.models.UnmuteParticipantWithCallLocatorRequest - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 409: ResourceExistsError, - 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 401: lambda response: ClientAuthenticationError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 403: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - json = self._serialize.body(unmute_participant_with_call_locator_request, 'UnmuteParticipantWithCallLocatorRequest') - - request = build_unmute_participant_request( - content_type=content_type, - json=json, - template_url=self.unmute_participant.metadata['url'], - ) - request = _convert_request(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) - - unmute_participant.metadata = {'url': '/calling/participants:unmute'} # type: ignore - - - @distributed_trace - def hold_participant_meeting_audio( - self, - hold_meeting_audio_with_call_locator_request, # type: "_models.HoldMeetingAudioWithCallLocatorRequest" - **kwargs # type: Any - ): - # type: (...) -> None - """Hold meeting audio of a participant in the call. - - Hold meeting audio of a participant in the call. - - :param hold_meeting_audio_with_call_locator_request: The request payload for holding meeting - audio for a participant. - :type hold_meeting_audio_with_call_locator_request: - ~azure.communication.callingserver.models.HoldMeetingAudioWithCallLocatorRequest - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 409: ResourceExistsError, - 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 401: lambda response: ClientAuthenticationError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 403: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - json = self._serialize.body(hold_meeting_audio_with_call_locator_request, 'HoldMeetingAudioWithCallLocatorRequest') - - request = build_hold_participant_meeting_audio_request( - content_type=content_type, - json=json, - template_url=self.hold_participant_meeting_audio.metadata['url'], - ) - request = _convert_request(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) - - hold_participant_meeting_audio.metadata = {'url': '/calling/participants:holdMeetingAudio'} # type: ignore - - - @distributed_trace - def resume_participant_meeting_audio( - self, - resume_meeting_audio_with_call_locator_request, # type: "_models.ResumeMeetingAudioWithCallLocatorRequest" - **kwargs # type: Any - ): - # type: (...) -> None - """Resume meeting audio of a participant in the call. - - Resume meeting audio of a participant in the call. - - :param resume_meeting_audio_with_call_locator_request: The request payload for resuming meeting - audio for a participant. - :type resume_meeting_audio_with_call_locator_request: - ~azure.communication.callingserver.models.ResumeMeetingAudioWithCallLocatorRequest - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 409: ResourceExistsError, - 400: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 401: lambda response: ClientAuthenticationError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 403: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 404: lambda response: ResourceNotFoundError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - 500: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.CommunicationErrorResponse, response)), - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - json = self._serialize.body(resume_meeting_audio_with_call_locator_request, 'ResumeMeetingAudioWithCallLocatorRequest') - - request = build_resume_participant_meeting_audio_request( - content_type=content_type, - json=json, - template_url=self.resume_participant_meeting_audio.metadata['url'], - ) - request = _convert_request(request) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), - } - request.url = self._client.format_url(request.url, **path_format_arguments) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) - - resume_participant_meeting_audio.metadata = {'url': '/calling/participants:resumeMeetingAudio'} # type: ignore - - @distributed_trace def start_recording( self, @@ -1308,6 +986,9 @@ def start_recording( request. :type start_call_recording_with_call_locator_request: ~azure.communication.callingserver.models.StartCallRecordingWithCallLocatorRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StartCallRecordingResult, or the result of cls(response) :rtype: ~azure.communication.callingserver.models.StartCallRecordingResult @@ -1324,11 +1005,13 @@ def start_recording( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(start_call_recording_with_call_locator_request, 'StartCallRecordingWithCallLocatorRequest') request = build_start_recording_request( + api_version=api_version, content_type=content_type, json=json, template_url=self.start_recording.metadata['url'], @@ -1369,6 +1052,9 @@ def get_recording_properties( :param recording_id: The recording id. :type recording_id: str + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CallRecordingProperties, or the result of cls(response) :rtype: ~azure.communication.callingserver.models.CallRecordingProperties @@ -1385,9 +1071,12 @@ def get_recording_properties( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + request = build_get_recording_properties_request( recording_id=recording_id, + api_version=api_version, template_url=self.get_recording_properties.metadata['url'], ) request = _convert_request(request) @@ -1426,6 +1115,9 @@ def stop_recording( :param recording_id: The recording id. :type recording_id: str + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1442,9 +1134,12 @@ def stop_recording( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + request = build_stop_recording_request( recording_id=recording_id, + api_version=api_version, template_url=self.stop_recording.metadata['url'], ) request = _convert_request(request) @@ -1479,6 +1174,9 @@ def pause_recording( :param recording_id: The recording id. :type recording_id: str + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1495,9 +1193,12 @@ def pause_recording( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + request = build_pause_recording_request( recording_id=recording_id, + api_version=api_version, template_url=self.pause_recording.metadata['url'], ) request = _convert_request(request) @@ -1532,6 +1233,9 @@ def resume_recording( :param recording_id: The recording id. :type recording_id: str + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1548,9 +1252,12 @@ def resume_recording( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str + request = build_resume_recording_request( recording_id=recording_id, + api_version=api_version, template_url=self.resume_recording.metadata['url'], ) request = _convert_request(request) @@ -1585,6 +1292,9 @@ def join_call( :param call_request: The join call request. :type call_request: ~azure.communication.callingserver.models.JoinCallRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: JoinCallResult, or the result of cls(response) :rtype: ~azure.communication.callingserver.models.JoinCallResult @@ -1601,11 +1311,13 @@ def join_call( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(call_request, 'JoinCallRequest') request = build_join_call_request( + api_version=api_version, content_type=content_type, json=json, template_url=self.join_call.metadata['url'], @@ -1647,6 +1359,9 @@ def play_audio( :param play_audio_request: Play audio request. :type play_audio_request: ~azure.communication.callingserver.models.PlayAudioWithCallLocatorRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PlayAudioResult, or the result of cls(response) :rtype: ~azure.communication.callingserver.models.PlayAudioResult @@ -1663,11 +1378,13 @@ def play_audio( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(play_audio_request, 'PlayAudioWithCallLocatorRequest') request = build_play_audio_request( + api_version=api_version, content_type=content_type, json=json, template_url=self.play_audio.metadata['url'], @@ -1709,6 +1426,9 @@ def cancel_media_operation( :param cancel_media_operation_request: The cancel media operation request. :type cancel_media_operation_request: ~azure.communication.callingserver.models.CancelMediaOperationWithCallLocatorRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1725,11 +1445,13 @@ def cancel_media_operation( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(cancel_media_operation_request, 'CancelMediaOperationWithCallLocatorRequest') request = build_cancel_media_operation_request( + api_version=api_version, content_type=content_type, json=json, template_url=self.cancel_media_operation.metadata['url'], @@ -1766,6 +1488,9 @@ def answer_call( :param answer_call_request: The answer call request. :type answer_call_request: ~azure.communication.callingserver.models.AnswerCallRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AnswerCallResult, or the result of cls(response) :rtype: ~azure.communication.callingserver.models.AnswerCallResult @@ -1782,11 +1507,13 @@ def answer_call( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(answer_call_request, 'AnswerCallRequest') request = build_answer_call_request( + api_version=api_version, content_type=content_type, json=json, template_url=self.answer_call.metadata['url'], @@ -1800,7 +1527,7 @@ def answer_call( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) @@ -1827,6 +1554,9 @@ def reject_call( :param reject_call_request: The reject call request. :type reject_call_request: ~azure.communication.callingserver.models.RejectCallRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1843,11 +1573,13 @@ def reject_call( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(reject_call_request, 'RejectCallRequest') request = build_reject_call_request( + api_version=api_version, content_type=content_type, json=json, template_url=self.reject_call.metadata['url'], @@ -1884,6 +1616,9 @@ def redirect_call( :param redirect_call_request: The redirect call request. :type redirect_call_request: ~azure.communication.callingserver.models.RedirectCallRequest + :keyword api_version: Api Version. The default value is "2021-11-15-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1900,11 +1635,13 @@ def redirect_call( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] json = self._serialize.body(redirect_call_request, 'RedirectCallRequest') request = build_redirect_call_request( + api_version=api_version, content_type=content_type, json=json, template_url=self.redirect_call.metadata['url'], diff --git a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_models.py b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_models.py index 1726f7f63fdb..1aed935c94ea 100644 --- a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_models.py +++ b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/_models.py @@ -36,10 +36,10 @@ class CallLocator(Protocol): :ivar Mapping[str, Any] properties: The properties of the locator. """ id = str # type: str - kind = None # type: Optional[Union[CallLocatorKind, str]] + kind = None # type: Union[CallLocatorKind, str] properties = {} # type: Mapping[str, Any] -class GroupCallLocator(object): +class GroupCallLocator(CallLocator): """The group call locator. :ivar kind: The type of locator. @@ -62,7 +62,7 @@ def __init__(self, id): self.id = id self.properties = {} -class ServerCallLocator(object): +class ServerCallLocator(CallLocator): """The server call locator. :ivar kind: The type of locator. @@ -85,180 +85,6 @@ def __init__(self, id): self.id = id self.properties = {} -class CreateCallOptions(object): - """The options for creating a call. - - All required parameters must be populated in order to send to Azure. - - :ivar callback_uri: Required. The callback URI. - :type callback_uri: str - :ivar requested_media_types: The requested media types. - :type requested_media_types: list[str or ~azure.communication.callingserver.models.CallMediaType] - :ivar requested_call_events: The requested call events to subscribe to. - :type requested_call_events: list[str or - ~azure.communication.callingserver.models.CallingEventSubscriptionType] - """ - def __init__( - self, - callback_uri, # type: str - requested_media_types, # type: List[CallMediaType] - requested_call_events # type: List[CallingEventSubscriptionType] - ): # type: (...) -> None - try: - if not callback_uri.lower().startswith('http'): - callback_uri = "https://" + callback_uri - except AttributeError: - raise ValueError("Host URL must be a string") - - parsed_url = urlparse(callback_uri.rstrip('/')) - if not parsed_url.netloc: - raise ValueError("Invalid URL: {}".format(callback_uri)) - - if not requested_media_types: - raise ValueError("requestedMediaTypes can not be None or empty") - - if not requested_call_events: - raise ValueError("requestedCallEvents can not be None or empty") - - self.__callback_uri = callback_uri - self.__requested_media_types = requested_media_types - self.__requested_call_events = requested_call_events - self.__alternate_Caller_Id = None - self.__subject = None - - @property - def callback_uri(self): - # type: () -> Optional[str] - return self.__callback_uri - - @property - def requested_media_types(self): - # type: () -> Optional[str] - return self.__requested_media_types - - @property - def requested_call_events(self): - # type: () -> List[CallingEventSubscriptionType] - return self.__requested_call_events - - @property - def alternate_Caller_Id(self): - # type: () -> Optional[PhoneNumberIdentifier] - return self.__alternate_Caller_Id - @alternate_Caller_Id.setter - def alternate_Caller_Id(self, alternate_Caller_Id): - # type: (PhoneNumberIdentifier) -> None - self.__alternate_Caller_Id = alternate_Caller_Id - - @property - def subject(self): - # type: () -> Optional[str] - return self.__subject - @subject.setter - def subject(self, subject): - # type: (str) -> None - self.__subject = subject - -class JoinCallOptions(object): - """The options for joining a call. - - All required parameters must be populated in order to send to Azure. - - :ivar callback_uri: Required. The callback URI. - :type callback_uri: str - :ivar requested_media_types: The requested media types. - :type requested_media_types: list[str or ~azure.communication.callingserver.models.CallMediaType] - :ivar requested_call_events: The requested call events to subscribe to. - :type requested_call_events: list[str or - ~azure.communication.callingserver.models.CallingEventSubscriptionType] - """ - def __init__( - self, - callback_uri, # type: str - requested_media_types, # type: List[CallMediaType] - requested_call_events # type: List[CallingEventSubscriptionType] - ): # type: (...) -> None - try: - if not callback_uri.lower().startswith('http'): - callback_uri = "https://" + callback_uri - except AttributeError: - raise ValueError("Host URL must be a string") - - parsed_url = urlparse(callback_uri.rstrip('/')) - if not parsed_url.netloc: - raise ValueError("Invalid URL: {}".format(callback_uri)) - - if not requested_media_types: - raise ValueError("requestedMediaTypes can not be None or empty") - - if not requested_call_events: - raise ValueError("requestedCallEvents can not be None or empty") - - self.__callback_uri = callback_uri - self.__requested_media_types = requested_media_types - self.__requested_call_events = requested_call_events - self.__subject = None - - @property - def callback_uri(self): - # type: () -> str - return self.__callback_uri - - @property - def requested_media_types(self): - # type: () -> List[CallMediaType] - return self.__requested_media_types - - @property - def requested_call_events(self): - # type: () -> List[CallingEventSubscriptionType] - return self.__requested_call_events - - @property - def subject(self): - # type: () -> Optional[str] - return self.__subject - @subject.setter - def subject(self, subject): - # type: (str) -> None - self.__subject = subject - -class PlayAudioOptions(object): - """The options for playing audio. - - All required parameters must be populated in order to send to Azure. - - :ivar loop: Required. The flag indicating whether audio file needs to be played in loop or not. - :type loop: bool - :ivar operation_context: Required. The value to identify context of the operation. - :type operation_context: str - :ivar audio_file_id: Required. An id for the media in the AudioFileUri, using which we cache the media resource. - :type audio_file_id: str - :ivar callback_uri: Required. The callback Uri to receive PlayAudio status notifications. - :type callback_uri: str - """ - def __init__( - self, - loop, # type: bool - operation_context, # type: str - audio_file_id, # type: str - callback_uri # type: str - ): # type: (...) -> None - self.loop = loop - self.operation_context = operation_context - self.audio_file_id = audio_file_id - self.callback_uri = callback_uri - self.__subject = None - - @property - def subject(self): - # type: () -> Optional[str] - return self.__subject - @subject.setter - def subject(self, subject): - # type: (str) -> None - self.__subject = subject - class CallingServerEventType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The calling server event type values. """ diff --git a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/aio/_call_connection_async.py b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/aio/_call_connection_async.py index 6d56a57b6648..aa31fe373835 100644 --- a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/aio/_call_connection_async.py +++ b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/aio/_call_connection_async.py @@ -10,7 +10,6 @@ from typing import TYPE_CHECKING, List, Any, Optional # pylint: disable=unused-import from azure.core.tracing.decorator_async import distributed_trace_async -from ..utils._utils import CallingServerUtils from .._communication_identifier_serializer import serialize_identifier from .._converters import ( AddParticipantRequestConverter, @@ -34,6 +33,7 @@ PlayAudioResult, AudioRoutingGroupResult, CreateAudioRoutingGroupResult, + TransferCallResult, CallParticipant, AudioRoutingMode ) @@ -43,9 +43,17 @@ if TYPE_CHECKING: from .._generated.aio.operations import CallConnectionsOperations - from .._models import PlayAudioOptions class CallConnection: + """An client to interact with the AzureCommunicationService Callingserver gateway. + + This client provides operations on top of a established call connection. + + :param str call_connection_id: + The id of this call connection. + :param CallConnectionsOperations call_connection_client: + The call connection client. + """ def __init__( self, call_connection_id: str, @@ -62,6 +70,12 @@ async def get_call( self, **kwargs: Any ) -> CallConnectionProperties: + """Get CallConnectionProperties of this CallConnection. + + :return: CallConnectionProperties + :rtype: ~azure.communication.callingserver.CallConnectionProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ return await self._call_connection_client.get_call( call_connection_id=self.call_connection_id, **kwargs @@ -72,7 +86,13 @@ async def delete_call( self, **kwargs: Any ) -> None: + """Terminates the conversation for all participants in the call. + + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ return await self._call_connection_client.delete_call( call_connection_id=self.call_connection_id, **kwargs @@ -83,7 +103,13 @@ async def hang_up( self, **kwargs: Any ) -> None: + """Hangup the call. + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + + """ return await self._call_connection_client.hangup_call( call_connection_id=self.call_connection_id, **kwargs @@ -94,7 +120,13 @@ async def keep_alive( self, **kwargs: Any ) -> None: + """Keep the call alive. + + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ return await self._call_connection_client.keep_alive( call_connection_id=self.call_connection_id, **kwargs @@ -105,8 +137,13 @@ async def cancel_all_media_operations( self, **kwargs: Any ) -> None: + """Cancels all the currently active and pending PlayAudio operations in the call. + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ return await self._call_connection_client.cancel_all_media_operations( call_connection_id=self.call_connection_id, **kwargs @@ -115,31 +152,49 @@ async def cancel_all_media_operations( @distributed_trace_async() async def play_audio( self, - audio_file_uri: str, - play_audio_options: 'PlayAudioOptions', + audio_url: str, + is_looped: bool = False, + *, + operation_context: Optional[str] = None, + audio_file_id: Optional[str] = None, + callback_uri: Optional[str] = None, **kwargs: Any ) -> PlayAudioResult: - - if not audio_file_uri: - raise ValueError("audio_file_uri can not be None") - - if not CallingServerUtils.is_valid_url(audio_file_uri): - raise ValueError("audio_file_uri is invalid") - - if not play_audio_options: - raise ValueError("options can not be None") - - if not play_audio_options.audio_file_id: - raise ValueError("audio_file_id can not be None") - - if not CallingServerUtils.is_valid_url(play_audio_options.callback_uri): - raise ValueError("callback_uri is invalid") - - play_audio_request = PlayAudioRequestConverter.convert(audio_file_uri, play_audio_options) + """Redirect the call. + + :param call_locator: Required. The call locator. + :type call_locator: ~azure.communication.callingserver.models.CallLocator + :param audio_url: Required. The media resource uri of the play audio request. + Currently only Wave file (.wav) format audio prompts are supported. + More specifically, the audio content in the wave file must be mono (single-channel), + 16-bit samples with a 16,000 (16KHz) sampling rate. + :type audio_url: str + :param is_looped: The flag indicating whether audio file needs to be played in loop or + not. + :type is_looped: bool + :keyword operation_context: The value to identify context of the operation. + :paramtype operation_context: str + :keyword audio_file_id: An id for the media in the AudioFileUri, using which we cache the media + resource. + :paramtype audio_file_id: str + :keyword callback_uri: The callback Uri to receive PlayAudio status notifications. + :paramtype callback_uri: str + :return: PlayAudioResult + :rtype: ~azure.communication.callingserver.PlayAudioResult + :raises: ~azure.core.exceptions.HttpResponseError + + """ + play_audio_request = PlayAudioRequestConverter.convert( + audio_url=audio_url, + loop=is_looped, + operation_context=operation_context, + audio_file_id=audio_file_id, + callback_uri=callback_uri + ) return await self._call_connection_client.play_audio( call_connection_id=self.call_connection_id, - request=play_audio_request, + play_audio_request=play_audio_request, **kwargs ) @@ -147,14 +202,24 @@ async def play_audio( async def add_participant( self, participant: CommunicationIdentifier, + *, alternate_caller_id: Optional[str] = None, operation_context: Optional[str] = None, **kwargs: Any ) -> AddParticipantResult: - - if not participant: - raise ValueError("participant can not be None") - + """Add participant to the call connection. + + :param participant: Required. The participant identity. + :type participant: ~azure.communication.callingserver.models.CommunicationIdentifier + :keyword alternate_caller_id: The alternate caller id. + :paramtype alternate_caller_id: str + :keyword operation_context: The operation context. + :paramtype operation_context: str + :return: AddParticipantResult + :rtype: ~azure.communication.callingserver.AddParticipantResult + :raises: ~azure.core.exceptions.HttpResponseError + + """ alternate_caller_id = (None if alternate_caller_id is None else PhoneNumberIdentifierModel(value=alternate_caller_id)) @@ -177,7 +242,15 @@ async def remove_participant( participant: CommunicationIdentifier, **kwargs: Any ) -> None: + """Remove participant from the call using identifier. + :param participant: Required. The identifier of the participant to be removed from the call. + :type participant: ~azure.communication.callingserver.models.CommunicationIdentifier + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + + """ remove_participant_request = RemoveParticipantRequestConverter.convert( identifier=serialize_identifier(participant) ) @@ -189,11 +262,17 @@ async def remove_participant( ) @distributed_trace_async() - async def get_participants( + async def list_participants( self, **kwargs: Any )-> List[CallParticipant]: + """Get participants from a call. + + :return: List[CallParticipant] + :rtype: List[~azure.communication.callingserver.models.CallParticipant] + :raises: ~azure.core.exceptions.HttpResponseError + """ return await self._call_connection_client.get_participants( call_connection_id=self.call_connection_id, **kwargs @@ -205,7 +284,15 @@ async def get_participant( participant: CommunicationIdentifier, **kwargs # type: Any ) -> List[CallParticipant]: + """Get participant from the call using identifier. + + :param participant: Required. The identifier of the target participant. + :type participant: ~azure.communication.callingserver.models.CommunicationIdentifier + :return: List[CallParticipant] + :rtype: List[~azure.communication.callingserver.models.CallParticipant] + :raises: ~azure.core.exceptions.HttpResponseError + """ get_participant_request = GetParticipantRequestConverter.convert( identifier=serialize_identifier(participant) ) @@ -220,33 +307,45 @@ async def get_participant( async def play_audio_to_participant( self, participant: CommunicationIdentifier, - audio_file_uri: str, - play_audio_options: 'PlayAudioOptions', + audio_url: str, + is_looped: bool = False, + *, + operation_context: Optional[str] = None, + audio_file_id: Optional[str] = None, + callback_uri: Optional[str] = None, **kwargs: Any ) -> PlayAudioResult: - - if not participant: - raise ValueError("participant can not be None") - - if not audio_file_uri: - raise ValueError("audio_file_uri can not be None") - - if not CallingServerUtils.is_valid_url(audio_file_uri): - raise ValueError("audio_file_uri is invalid") - - if not play_audio_options: - raise ValueError("play_audio_options can not be None") - - if not play_audio_options.audio_file_id: - raise ValueError("audio_file_id can not be None") - - if not CallingServerUtils.is_valid_url(play_audio_options.callback_uri): - raise ValueError("callback_uri is invalid") - + """Play audio to a participant. + + :param participant: Required. The media resource uri of the play audio request. + :type participant: str + :param audio_url: Required. The media resource uri of the play audio request. + Currently only Wave file (.wav) format audio prompts are supported. + More specifically, the audio content in the wave file must be mono (single-channel), + 16-bit samples with a 16,000 (16KHz) sampling rate. + :type audio_url: str + :param is_looped: The flag indicating whether audio file needs to be played in loop or + not. + :type is_looped: bool + :keyword operation_context: The value to identify context of the operation. + :paramtype operation_context: str + :keyword audio_file_id: An id for the media in the AudioFileUri, using which we cache the media + resource. + :paramtype audio_file_id: str + :keyword callback_uri: The callback Uri to receive PlayAudio status notifications. + :paramtype callback_uri: str + :return: PlayAudioResult + :rtype: ~azure.communication.callingserver.PlayAudioResult + :raises: ~azure.core.exceptions.HttpResponseError + + """ play_audio_to_participant_request = PlayAudioToParticipantRequestConverter.convert( identifier=serialize_identifier(participant), - audio_file_uri=audio_file_uri, - play_audio_options=play_audio_options + audio_url=audio_url, + loop=is_looped, + operation_context=operation_context, + audio_file_id=audio_file_id, + callback_uri=callback_uri ) return await self._call_connection_client.participant_play_audio( @@ -262,13 +361,17 @@ async def cancel_participant_media_operation( media_operation_id: str, **kwargs: Any )-> None: + """Cancel media operation for a participant. - if not participant: - raise ValueError("participant can not be None") - - if not media_operation_id: - raise ValueError("media_operation_id can not be None") + :param participant: Required. The identifier of the participant. + :type participant: ~azure.communication.callingserver.models.CommunicationIdentifier + :param media_operation_id: Required. The operationId of the media operation to cancel. + :type media_operation_id: str + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ cancel_media_operation_request = CancelParticipantMediaOperationRequestConverter.convert( identifier=serialize_identifier(participant), media_operation_id=media_operation_id @@ -286,10 +389,15 @@ async def mute_participant( participant: CommunicationIdentifier, **kwargs: Any ) -> None: + """Mutes the participant - if not participant: - raise ValueError("participant can not be None") + :param participant: Required. The identifier of the participant to be muted in the call. + :type participant: ~azure.communication.callingserver.models.CommunicationIdentifier + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ mute_participant_request = MuteParticipantRequestConverter.convert( identifier=serialize_identifier(participant) ) @@ -306,10 +414,15 @@ async def unmute_participant( participant: CommunicationIdentifier, **kwargs: Any ) -> None: + """Unmute participant in the call. - if not participant: - raise ValueError("participant can not be None") + :param participant: Required. The identifier of the participant to be unmute in the call. + :type participant: ~azure.communication.callingserver.models.CommunicationIdentifier + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ unmute_participant_request = UnmuteParticipantRequestConverter.convert( identifier=serialize_identifier(participant) ) @@ -326,10 +439,16 @@ async def hold_participant_meeting_audio( participant: CommunicationIdentifier, **kwargs: Any ) -> None: + """Removes the participant from the meeting's default audio mix so the participant + does not hear anything from the meeting and cannot add audio into the meeting. - if not participant: - raise ValueError("participant can not be None") + :param participant: Required. The identifier of the participant. + :type participant: ~azure.communication.callingserver.models.CommunicationIdentifier + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ hold_meeting_audio_request = HoldMeetingAudioRequestConverter.convert( identifier=serialize_identifier(participant) ) @@ -346,10 +465,16 @@ async def resume_participant_meeting_audio( participant: CommunicationIdentifier, **kwargs: Any ) -> None: + """Adds the participant back into the meeting's default audio mix so the participant + begins to hear everything from the meeting and can add audio into the meeting. - if not participant: - raise ValueError("participant can not be None") + :param participant: Required. The identifier of the participant. + :type participant: ~azure.communication.callingserver.models.CommunicationIdentifier + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ resume_participant_meeting_audio_request = ResumeMeetingAudioRequestConverter.convert( identifier=serialize_identifier(participant) ) @@ -361,27 +486,44 @@ async def resume_participant_meeting_audio( ) @distributed_trace_async() - async def transfer_call( + async def transfer( self, target_participant: CommunicationIdentifier, target_call_connection_id: str, + *, + alternate_caller_id: Optional[str] = None, user_to_user_information: Optional[str] = None, operation_context: Optional[str] = None, - callback_uri: Optional[str] = None, **kwargs: Any - )-> None: - - if not target_participant: - raise ValueError("target_participant can not be None") - if not target_call_connection_id: - raise ValueError("target_call_connection_id can not be None") + )-> TransferCallResult: + """Transfer the call. + + :param target_participant: Required. The target participant. + :type target_participant: ~azure.communication.callingserver.models.CommunicationIdentifier + :param target_call_connection_id: The target call connection id to transfer to. + :type target_call_connection_id: str + :keyword alternate_caller_id: The alternate identity of the transferor if transferring to a pstn + number. + :paramtype alternate_caller_id: str + :keyword user_to_user_information: The user to user information. + :paramtype user_to_user_information: str + :keyword operation_context: The operation context. + :paramtype operation_context: str + :return: TransferCallResult + :rtype: ~azure.communication.callingserver.TransferCallResult + :raises: ~azure.core.exceptions.HttpResponseError + + """ + alternate_caller_id = (None + if alternate_caller_id is None + else PhoneNumberIdentifierModel(value=alternate_caller_id)) transfer_call_request = TransferCallRequestConverter.convert( target_participant=serialize_identifier(target_participant), target_call_connection_id=target_call_connection_id, + alternate_caller_id=alternate_caller_id, user_to_user_information=user_to_user_information, - operation_context=operation_context, - callback_uri=callback_uri + operation_context=operation_context ) return await self._call_connection_client.transfer( @@ -397,12 +539,19 @@ async def create_audio_routing_group( targets: List[CommunicationIdentifier], **kwargs: Any ) -> CreateAudioRoutingGroupResult: - - if not audio_routing_mode: - raise ValueError("audio_routing_mode can not be None") - if not targets: - raise ValueError("targets can not be None") - + """Create audio routing group in a call. + + :param audio_routing_mode: Required. The audio routing mode. Possible values include: + "oneToOne", "multicast". + :type audio_routing_mode: str or ~azure.communication.callingserver.models.AudioRoutingMode + :param targets: Required. The target identities that would be receivers in the audio routing + group. + :type targets: list[~azure.communication.callingserver.models.CommunicationIdentifier] + :return: CreateAudioRoutingGroupResult + :rtype: ~azure.communication.callingserver.models.CreateAudioRoutingGroupResult + :raises: ~azure.core.exceptions.HttpResponseError + + """ audio_routing_group_request = AudioRoutingGroupRequestConverter.convert( audio_routing_mode=audio_routing_mode, target_identities=[serialize_identifier(m) for m in targets] @@ -415,15 +564,20 @@ async def create_audio_routing_group( ) @distributed_trace_async() - async def get_audio_routing_groups( + async def list_audio_routing_groups( self, audio_routing_group_id: str, **kwargs: Any ) -> AudioRoutingGroupResult: + """List audio routing group in a call. - if not audio_routing_group_id: - raise ValueError("audio_routing_group_id can not be None") + :param audio_routing_group_id: Required. The audio routing group id. + :type audio_routing_group_id: str + :return: AudioRoutingGroupResult + :rtype: ~azure.communication.callingserver.models.AudioRoutingGroupResult + :raises: ~azure.core.exceptions.HttpResponseError + """ return await self._call_connection_client.get_audio_routing_groups( call_connection_id=self.call_connection_id, audio_routing_group_id=audio_routing_group_id, @@ -436,10 +590,15 @@ async def delete_audio_routing_group( audio_routing_group_id: str, **kwargs: Any ) -> None: + """Delete audio routing group from a call. - if not audio_routing_group_id: - raise ValueError("audio_routing_group_id can not be None") + :param audio_routing_group_id: Required. The audio routing group id. + :type audio_routing_group_id: str + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ return await self._call_connection_client.delete_audio_routing_group( call_connection_id=self.call_connection_id, audio_routing_group_id=audio_routing_group_id, @@ -453,12 +612,18 @@ async def update_audio_routing_group( targets: List[CommunicationIdentifier], **kwargs: Any ) -> None: - - if not audio_routing_group_id: - raise ValueError("audio_routing_group_id can not be None") - if not targets: - raise ValueError("targets can not be None") - + """Update audio routing group. + + :param audio_routing_group_id: Required. The audio routing group id. + :type audio_routing_group_id: str + :param targets: Required. The target identities that would be receivers in the audio routing + group. + :type targets: list[~azure.communication.callingserver.models.CommunicationIdentifier] + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + + """ update_audio_routing_group_request = UpdateAudioRoutingGroupRequestConverter.convert( target_identities=[serialize_identifier(m) for m in targets] ) diff --git a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/aio/_callingserver_client_async.py b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/aio/_callingserver_client_async.py index 1c66176195c9..a5323c9f149a 100644 --- a/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/aio/_callingserver_client_async.py +++ b/sdk/communication/azure-communication-callingserver/azure/communication/callingserver/aio/_callingserver_client_async.py @@ -56,18 +56,13 @@ CancelMediaOperationWithCallLocatorRequestConverter, CancelParticipantMediaOperationWithCallLocatorRequestConverter, GetAllParticipantsWithCallLocatorRequestConverter, - GetParticipantWithCallLocatorRequestConverter, - MuteParticipantWithCallLocatorRequestConverter, - UnmuteParticipantWithCallLocatorRequestConverter, - HoldMeetingAudioWithCallLocatorRequestConverter, - ResumeMeetingAudioWithCallLocatorRequestConverter + GetParticipantWithCallLocatorRequestConverter ) from .._shared.utils import get_authentication_policy, get_host_header_policy, parse_connection_str from .._version import SDK_MONIKER if TYPE_CHECKING: from azure.core.credentials_async import AsyncTokenCredential - from .._models import CreateCallOptions, JoinCallOptions, PlayAudioOptions class CallingServerClient: """A client to interact with the AzureCommunicationService Calling Server. @@ -118,13 +113,13 @@ def from_connection_string( cls, conn_str: str, **kwargs: Any - ) -> 'CallingServerClient': + ): # type: (...) -> CallingServerClient """Create CallingServerClient from a Connection String. :param str conn_str: A connection string to an Azure Communication Service resource. :returns: Instance of CallingServerClient. - :rtype: ~azure.communication.callingserver.CallingServerClient + :rtype: ~azure.communication.phonenumbers.aio.CallingServerClient .. admonition:: Example: @@ -139,16 +134,17 @@ def from_connection_string( return cls(endpoint, access_key, **kwargs) - def get_call_connection( + def get_call_connection( # pylint: disable=unused-argument self, call_connection_id: str, + **kwargs: Any ) -> CallConnection: """Initializes a new instance of CallConnection. :param str call_connection_id: - The thread id for the ChatThreadClient instance. + The call connection id for the CallConnection instance. :returns: Instance of CallConnection. - :rtype: ~azure.communication..callingserver.CallConnection + :rtype: ~azure.communication.callingserver.aio.CallConnection """ if not call_connection_id: raise ValueError("call_connection_id can not be None") @@ -160,37 +156,47 @@ async def create_call_connection( self, source: CommunicationIdentifier, targets: List[CommunicationIdentifier], - options: 'CreateCallOptions', + callback_uri: str, + requested_media_types: List[CallMediaType], + requested_call_events: List[CallingEventSubscriptionType], + *, + alternate_Caller_Id: Optional[str] = None, + subject: Optional[str] = None, **kwargs: Any ) -> CallConnection: """Create an outgoing call from source to target identities. - :param CommunicationIdentifier source: - The source identity. - :param List[CommunicationIdentifier] targets: - The target identities. - :param CreateCallOptions options: - The call options. - :returns: CallConnection for a successful creating callConnection request. + :param source: Required. The source identity. + :type source: CommunicationIdentifier + :param targets: The target identities. + :type targets: list[~azure.communication.callingserver.models.CommunicationIdentifier] + :param callback_uri: The callback uri. + :type callback_uri: str + :param requested_media_types: The requested modalities. + :type requested_media_types: list[str or + ~azure.communication.callingserver.models.CallMediaType] + :param requested_call_events: The requested call events to subscribe to. + :type requested_call_events: list[str or + ~azure.communication.callingserver.models.CallingEventSubscriptionType] + :keyword alternate_Caller_Id: The alternate caller id. + :paramtype alternate_Caller_Id: str + :keyword subject: The subject. + :paramtype subject: str + :return: CallConnection :rtype: ~azure.communication.callingserver.CallConnection - """ - if not source: - raise ValueError("source can not be None") - if not targets: - raise ValueError("targets can not be None or empty") - if not options: - raise ValueError("options can not be None") + :raises: ~azure.core.exceptions.HttpResponseError + """ request = CreateCallRequest( source=serialize_identifier(source), targets=[serialize_identifier(m) for m in targets], - callback_uri=options.callback_uri, - requested_media_types=options.requested_media_types, - requested_call_events=options.requested_call_events, + callback_uri=callback_uri, + requested_media_types=requested_media_types, + requested_call_events=requested_call_events, alternate_caller_id=(None - if options.alternate_Caller_Id is None - else PhoneNumberIdentifierModel(value=options.alternate_Caller_Id.properties['value'])), - subject=options.subject + if alternate_Caller_Id is None + else PhoneNumberIdentifierModel(value=alternate_Caller_Id)), + subject=subject ) create_call_response = await self._call_connection_client.create_call( @@ -208,31 +214,43 @@ async def join_call( self, call_locator: CallLocator, source: CommunicationIdentifier, - call_options: 'JoinCallOptions', + callback_uri: str, + requested_media_types: List[CallMediaType], + requested_call_events: List[CallingEventSubscriptionType], + *, + subject: Optional[str] = None, **kwargs: Any ) -> CallConnection: """Join the call using call_locator. - :param CallLocator call_locator: - The callLocator. - :param CommunicationIdentifier source: - The source identity. - :param JoinCallOptions call_options: - The call Options. - :returns: CallConnection for a successful join request. + :param call_locator: Required. The call locator. + :type call_locator: ~azure.communication.callingserver.models.CallLocator + :param source: Required. The source identity. + :type source: CommunicationIdentifier + :param targets: The target identities. + :type targets: list[~azure.communication.callingserver.models.CommunicationIdentifier] + :param callback_uri: The callback uri. + :type callback_uri: str + :param requested_media_types: The requested modalities. + :type requested_media_types: list[str or + ~azure.communication.callingserver.models.CallMediaType] + :param requested_call_events: The requested call events to subscribe to. + :type requested_call_events: list[str or + ~azure.communication.callingserver.models.CallingEventSubscriptionType] + :keyword subject: The subject. + :paramtype subject: str + :return: CallConnection :rtype: ~azure.communication.callingserver.CallConnection - """ - if not call_locator: - raise ValueError("call_locator can not be None") - if not source: - raise ValueError("source can not be None") - if not call_options: - raise ValueError("call_options can not be None") + :raises: ~azure.core.exceptions.HttpResponseError + """ join_call_request = JoinCallRequestConverter.convert( call_locator=serialize_call_locator(call_locator), source=serialize_identifier(source), - join_call_options=call_options + callback_uri=callback_uri, + requested_media_types=requested_media_types, + requested_call_events=requested_call_events, + subject=subject ) join_call_response = await self._server_call_client.join_call( @@ -250,15 +268,29 @@ async def join_call( async def answer_call( self, incoming_call_context: str, + *, callback_uri: Optional[str] = None, requested_media_types: Optional[List[CallMediaType]] = None, requested_call_events: Optional[List[CallingEventSubscriptionType]] = None, **kwargs: Any ) -> AnswerCallResult: + """Answer the call. + + :param incoming_call_context: Required. The context associated with the call. + :type incoming_call_context: str + :keyword callback_uri: The callback uri. + :paramtype callback_uri: str + :keyword requested_media_types: The requested modalities. + :paramtype requested_media_types: list[str or + ~azure.communication.callingserver.models.CallMediaType] + :keyword requested_call_events: The requested call events to subscribe to. + :paramtype requested_call_events: list[str or + ~azure.communication.callingserver.models.CallingEventSubscriptionType] + :return: AnswerCallResult + :rtype: ~azure.communication.callingserver.AnswerCallResult + :raises: ~azure.core.exceptions.HttpResponseError - if not incoming_call_context: - raise ValueError("incoming_call_context can not be None") - + """ answer_call_request = AnswerCallRequestConverter.convert( incoming_call_context=incoming_call_context, callback_uri=callback_uri, @@ -274,15 +306,25 @@ async def answer_call( @distributed_trace_async() async def reject_call( self, - incoming_call_context: Optional[str] = None, + incoming_call_context: str, + *, call_reject_reason: Optional[CallRejectReason] = None, callback_uri: Optional[str] = None, **kwargs: Any ) -> None: + """Answer the call. + + :param incoming_call_context: Required. The context associated with the call. + :type incoming_call_context: str + :keyword call_reject_reason: The rejection reason. Possible values include: "none", "busy", + "forbidden". + :paramtype call_reject_reason: str or ~azure.communication.callingserver.models.CallRejectReason + :keyword callback_uri: The callback uri. + :paramtype callback_uri: str + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError - if not incoming_call_context: - raise ValueError("incoming_call_context can not be None") - + """ reject_call_request = RejectCallRequestConverter.convert( incoming_call_context=incoming_call_context, call_reject_reason=call_reject_reason, @@ -297,18 +339,28 @@ async def reject_call( @distributed_trace_async() async def redirect_call( self, - incoming_call_context, # type: str - targets, # type: List[CommunicationIdentifier] - callback_uri=None, # type: str - timeout_in_seconds=None, # type: int - **kwargs # type: Any - ): # type: (...) -> None - - if not incoming_call_context: - raise ValueError("incoming_call_context can not be None") - if not targets: - raise ValueError("targets can not be None") + incoming_call_context: str, + targets: List[CommunicationIdentifier], + *, + callback_uri: Optional[str] = None, + timeout_in_seconds: Optional[int] = None, + **kwargs: Any + ) -> None: + """Redirect the call. + + :param incoming_call_context: Required. The call locator. + :type incoming_call_context: ~azure.communication.callingserver.models.CallLocator + :param targets: Required. The identifier of the participant to be removed from the call. + :type targets: ~azure.communication.callingserver.models.CommunicationIdentifier + :keyword callback_uri: The alternate caller id. + :paramtype callback_uri: str + :keyword timeout_in_seconds: The alternate caller id. + :paramtype timeout_in_seconds: int + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ redirect_call_request = RedirectCallRequestConverter.convert( incoming_call_context=incoming_call_context, target_identities=[serialize_identifier(m) for m in targets], @@ -325,26 +377,45 @@ async def redirect_call( async def play_audio( self, call_locator: 'CallLocator', - audio_file_uri: str, - play_audio_options: 'PlayAudioOptions', + audio_url: str, + is_looped: bool = False, + *, + operation_context: Optional[str] = None, + audio_file_id: Optional[str] = None, + callback_uri: Optional[str] = None, **kwargs: Any ) -> PlayAudioResult: + """Redirect the call. + + :param call_locator: Required. The call locator. + :type call_locator: ~azure.communication.callingserver.models.CallLocator + :param audio_url: Required. The media resource uri of the play audio request. + Currently only Wave file (.wav) format audio prompts are supported. + More specifically, the audio content in the wave file must be mono (single-channel), + 16-bit samples with a 16,000 (16KHz) sampling rate. + :type audio_url: str + :param is_looped: The flag indicating whether audio file needs to be played in loop or + not. + :type is_looped: bool + :keyword operation_context: The value to identify context of the operation. + :paramtype operation_context: str + :keyword audio_file_id: An id for the media in the AudioFileUri, using which we cache the media + resource. + :paramtype audio_file_id: str + :keyword callback_uri: The callback Uri to receive PlayAudio status notifications. + :paramtype callback_uri: str + :return: PlayAudioResult + :rtype: ~azure.communication.callingserver.PlayAudioResult + :raises: ~azure.core.exceptions.HttpResponseError - if not call_locator: - raise ValueError("call_locator can not be None") - if not audio_file_uri: - raise ValueError("audio_file_uri can not be None") - if not CallingServerUtils.is_valid_url(audio_file_uri): - raise ValueError("audio_file_uri is invalid") - if not play_audio_options: - raise ValueError("options can not be None") - if not CallingServerUtils.is_valid_url(play_audio_options.callback_uri): - raise ValueError("callback_uri is invalid") - + """ play_audio_request = PlayAudioWithCallLocatorRequestConverter.convert( call_locator=serialize_call_locator(call_locator), - audio_file_uri=audio_file_uri, - play_audio_options=play_audio_options + audio_url=audio_url, + loop=is_looped, + operation_context=operation_context, + audio_file_id=audio_file_id, + callback_uri=callback_uri ) return await self._server_call_client.play_audio( @@ -357,29 +428,48 @@ async def play_audio_to_participant( self, call_locator: 'CallLocator', participant: 'CommunicationIdentifier', - audio_file_uri: str, - play_audio_options: 'PlayAudioOptions', + audio_url: str, + is_looped: bool = False, + *, + operation_context: Optional[str] = None, + audio_file_id: Optional[str] = None, + callback_uri: Optional[str] = None, **kwargs: Any ) -> PlayAudioResult: + """Play audio to a participant. + + :param call_locator: Required. The call locator. + :type call_locator: ~azure.communication.callingserver.models.CallLocator + :param participant: Required. The identifier of the play audio target participant. + :type participant: ~azure.communication.callingserver.models.CommunicationIdentifier + :param audio_url: Required. The media resource uri of the play audio request. + Currently only Wave file (.wav) format audio prompts are supported. + More specifically, the audio content in the wave file must be mono (single-channel), + 16-bit samples with a 16,000 (16KHz) sampling rate. + :type audio_url: str + :param is_looped: The flag indicating whether audio file needs to be played in loop or + not. + :type is_looped: bool + :keyword operation_context: The value to identify context of the operation. + :paramtype operation_context: str + :keyword audio_file_id: An id for the media in the AudioFileUri, using which we cache the media + resource. + :paramtype audio_file_id: str + :keyword callback_uri: The callback Uri to receive PlayAudio status notifications. + :paramtype callback_uri: str + :return: PlayAudioResult + :rtype: ~azure.communication.callingserver.PlayAudioResult + :raises: ~azure.core.exceptions.HttpResponseError - if not call_locator: - raise ValueError("call_locator can not be None") - if not participant: - raise ValueError("participant can not be None") - if not audio_file_uri: - raise ValueError("audio_file_uri can not be None") - if not CallingServerUtils.is_valid_url(audio_file_uri): - raise ValueError("audio_file_uri is invalid") - if not play_audio_options: - raise ValueError("play_audio_options can not be None") - if not CallingServerUtils.is_valid_url(play_audio_options.callback_uri): - raise ValueError("callback_uri is invalid") - + """ play_audio_to_participant_request = PlayAudioToParticipantWithCallLocatorRequestConverter.convert( call_locator=serialize_call_locator(call_locator), identifier=serialize_identifier(participant), - audio_file_uri=audio_file_uri, - play_audio_options=play_audio_options + audio_url=audio_url, + loop=is_looped, + operation_context=operation_context, + audio_file_id=audio_file_id, + callback_uri=callback_uri ) return await self._server_call_client.participant_play_audio( @@ -393,18 +483,28 @@ async def add_participant( # pylint: disable=too-many-arguments call_locator: 'CallLocator', participant: 'CommunicationIdentifier', callback_uri: str, + *, alternate_caller_id: Optional[str] = None, operation_context: Optional[str] = None, **kwargs: Any ) -> AddParticipantResult: + """Add a participant to the call. + + :param call_locator: Required. The call locator. + :type call_locator: ~azure.communication.callingserver.models.CallLocator + :param participant: Required. The participant to be added to the call. + :type participant: ~azure.communication.callingserver.models.CommunicationIdentifier + :param callback_uri: Required. The callback URI. + :type callback_uri: str + :keyword alternate_caller_id: The alternate caller id. + :paramtype alternate_caller_id: str + :keyword operation_context: The operation context. + :paramtype operation_context: str + :return: AddParticipantResult + :rtype: ~azure.communication.callingserver.AddParticipantResult + :raises: ~azure.core.exceptions.HttpResponseError - if not call_locator: - raise ValueError("call_locator can not be None") - if not participant: - raise ValueError("participant can not be None") - if not CallingServerUtils.is_valid_url(callback_uri): - raise ValueError("callback_uri is invalid") - + """ alternate_caller_id = (None if alternate_caller_id is None else PhoneNumberIdentifierModel(value=alternate_caller_id)) @@ -429,7 +529,17 @@ async def remove_participant( participant: CommunicationIdentifier, **kwargs: Any ) -> None: + """Remove participant from the call using identifier. + + :param call_locator: Required. The call locator. + :type call_locator: ~azure.communication.callingserver.models.CallLocator + :param participant: Required. The identifier of the participant to be removed from the call. + :type participant: ~azure.communication.callingserver.models.CommunicationIdentifier + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ if not call_locator: raise ValueError("call_locator can not be None") if not participant: @@ -446,12 +556,20 @@ async def remove_participant( ) @distributed_trace_async() - async def get_participants( + async def list_participants( self, call_locator: CallLocator, **kwargs: Any ) -> List[CallParticipant]: + """Get participants from a server call. + + :param call_locator: Required. The call locator. + :type call_locator: ~azure.communication.callingserver.models.CallLocator + :return: List[CallParticipant] + :rtype: List[~azure.communication.callingserver.models.CallParticipant] + :raises: ~azure.core.exceptions.HttpResponseError + """ get_all_participants_with_call_locator_request = GetAllParticipantsWithCallLocatorRequestConverter.convert( serialize_call_locator(call_locator) ) @@ -468,7 +586,17 @@ async def get_participant( participant: CommunicationIdentifier, **kwargs: Any ) -> List[CallParticipant]: + """Get participant from the call using identifier. + + :param call_locator: Required. The call locator. + :type call_locator: ~azure.communication.callingserver.models.CallLocator + :param participant: Required. The identifier of the target participant. + :type participant: ~azure.communication.callingserver.models.CommunicationIdentifier + :return: list of CallParticipant + :rtype: List[~azure.communication.callingserver.models.CallParticipant] + :raises: ~azure.core.exceptions.HttpResponseError + """ get_participant_with_call_locator_request = GetParticipantWithCallLocatorRequestConverter.convert( serialize_call_locator(call_locator), serialize_identifier(participant) @@ -479,48 +607,6 @@ async def get_participant( **kwargs ) - @distributed_trace_async() - async def mute_participant( - self, - call_locator, # type: CallLocator - participant, # type: CommunicationIdentifier - **kwargs # type: Any - ): # type: (...) -> None - - if not participant: - raise ValueError("participant can not be None") - - mute_participant_with_call_locator_request = MuteParticipantWithCallLocatorRequestConverter.convert( - serialize_call_locator(call_locator), - serialize_identifier(participant) - ) - - return await self._server_call_client.mute_participant( - mute_participant_with_call_locator_request=mute_participant_with_call_locator_request, - **kwargs - ) - - @distributed_trace_async() - async def unmute_participant( - self, - call_locator, # type: CallLocator - participant, # type: CommunicationIdentifier - **kwargs # type: Any - ): # type: (...) -> None - - if not participant: - raise ValueError("participant can not be None") - - unmute_participant_with_call_locator_request = UnmuteParticipantWithCallLocatorRequestConverter.convert( - serialize_call_locator(call_locator), - serialize_identifier(participant) - ) - - return await self._server_call_client.unmute_participant( - unmute_participant_with_call_locator_request=unmute_participant_with_call_locator_request, - **kwargs - ) - @distributed_trace_async() async def cancel_media_operation( self, @@ -528,12 +614,17 @@ async def cancel_media_operation( media_operation_id: str, **kwargs: Any ) -> None: + """Cancel media operation. - if not call_locator: - raise ValueError("call_locator can not be None") - if not media_operation_id: - raise ValueError("media_operation_id can not be None") + :param call_locator: Required. The call locator. + :type call_locator: ~azure.communication.callingserver.models.CallLocator + :param media_operation_id: Required. The operationId of the media operation to cancel. + :type media_operation_id: str + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ cancel_media_operation_request = CancelMediaOperationWithCallLocatorRequestConverter.convert( serialize_call_locator(call_locator), media_operation_id=media_operation_id @@ -552,14 +643,19 @@ async def cancel_participant_media_operation( media_operation_id: str, **kwargs: Any ) -> None: + """Cancel media operation for a participant. + + :param call_locator: Required. The call locator. + :type call_locator: ~azure.communication.callingserver.models.CallLocator + :param participant: Required. The identifier of the participant. + :type participant: ~azure.communication.callingserver.models.CommunicationIdentifier + :param media_operation_id: Required. The operationId of the media operation to cancel. + :type media_operation_id: str + :return: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError - if not call_locator: - raise ValueError("call_locator can not be None") - if not participant: - raise ValueError("participant can not be None") - if not media_operation_id: - raise ValueError("media_operation_id can not be None") - + """ cancel_participant_media_operation_request = \ CancelParticipantMediaOperationWithCallLocatorRequestConverter.convert( serialize_call_locator(call_locator), @@ -572,59 +668,40 @@ async def cancel_participant_media_operation( **kwargs ) - @distributed_trace_async() - async def hold_participant_meeting_audio( - self, - call_locator, # type: CallLocator - participant, # type: CommunicationIdentifier - **kwargs # type: Any - ): # type: (...) -> None - - if not participant: - raise ValueError("participant can not be None") - - hold_meeting_audio_with_call_locator_request = HoldMeetingAudioWithCallLocatorRequestConverter.convert( - serialize_call_locator(call_locator), - serialize_identifier(participant) - ) - - return await self._server_call_client.hold_participant_meeting_audio( - hold_meeting_audio_with_call_locator_request=hold_meeting_audio_with_call_locator_request, - **kwargs - ) - - @distributed_trace_async() - async def resume_participant_meeting_audio( - self, - call_locator, # type: CallLocator - participant, # type: CommunicationIdentifier - **kwargs # type: Any - ): # type: (...) -> None - - if not participant: - raise ValueError("participant can not be None") - - resume_meeting_audio_with_call_locator_request = ResumeMeetingAudioWithCallLocatorRequestConverter.convert( - serialize_call_locator(call_locator), - serialize_identifier(participant) - ) - - return await self._server_call_client.resume_participant_meeting_audio( - resume_meeting_audio_with_call_locator_request=resume_meeting_audio_with_call_locator_request, - **kwargs - ) - @distributed_trace_async() async def start_recording( # pylint: disable=too-many-arguments self, call_locator: CallLocator, recording_state_callback_uri: str, + *, recording_content_type: Optional[RecordingContentType] = None, recording_channel_type: Optional[RecordingChannelType] = None, recording_format_type: Optional[RecordingFormatType] = None, **kwargs: Any ) -> StartCallRecordingResult: + """Start recording the call. + + :param call_locator: Required. The call locator. + :type call_locator: ~azure.communication.callingserver.models.CallLocator + :param recording_state_callback_uri: Required. The uri to send notifications to. + :type recording_state_callback_uri: str + :keyword recording_content_type: The content type of call recording. Possible values include: + "audio", "audioVideo". + :paramtype recording_content_type: str or + ~azure.communication.callingserver.models.RecordingContentType + :keyword recording_channel_type: The channel type of call recording. Possible values include: + "mixed", "unmixed". + :paramtype recording_channel_type: str or + ~azure.communication.callingserver.models.RecordingChannelType + :keyword recording_format_type: The format type of call recording. Possible values include: "wav", + "mp3", "mp4". + :paramtype recording_format_type: str or + ~azure.communication.callingserver.models.RecordingFormatType + :return: StartCallRecordingResult + :rtype: ~azure.communication.callingserver.StartCallRecordingResult + :raises: ~azure.core.exceptions.HttpResponseError + """ start_call_recording_request = StartCallRecordingWithCallLocatorRequest( call_locator=serialize_call_locator(call_locator), recording_state_callback_uri=recording_state_callback_uri, @@ -645,10 +722,15 @@ async def pause_recording( recording_id: str, **kwargs: Any ) -> HttpResponse: + """Pause recording the call. - if not recording_id: - raise ValueError("recording_id cannot be None") + :param recording_id: Required. The recording id. + :type recording_id: str + :return: The response of the operation. + :rtype: ~azure.core.rest.HttpResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ return await self._server_call_client.pause_recording( recording_id=recording_id, **kwargs @@ -660,10 +742,15 @@ async def resume_recording( recording_id: str, **kwargs: Any ) -> HttpResponse: + """Resume recording the call. - if not recording_id: - raise ValueError("recording_id cannot be None") + :param recording_id: Required. The recording id. + :type recording_id: str + :return: The response of the operation. + :rtype: ~azure.core.rest.HttpResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ return await self._server_call_client.resume_recording( recording_id=recording_id, **kwargs @@ -675,10 +762,15 @@ async def stop_recording( recording_id: str, **kwargs: Any ) -> HttpResponse: + """Stop recording the call. - if not recording_id: - raise ValueError("recording_id cannot be None") + :param recording_id: Required. The recording id. + :type recording_id: str + :return: The response of the operation. + :rtype: ~azure.core.rest.HttpResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ return await self._server_call_client.stop_recording( recording_id=recording_id, **kwargs @@ -690,10 +782,15 @@ async def get_recording_properities( recording_id: str, **kwargs: Any ) -> CallRecordingProperties: + """Get recording properities. - if not recording_id: - raise ValueError("recording_id cannot be None") + :param recording_id: Required. The recording id. + :type recording_id: str + :return: CallRecordingProperties + :rtype: ~azure.communication.callingserver.CallRecordingProperties + :raises: ~azure.core.exceptions.HttpResponseError + """ return await self._server_call_client.get_recording_properties( recording_id=recording_id, **kwargs @@ -708,7 +805,21 @@ async def download( parallel_download_options: ParallelDownloadOptions = None, **kwargs: Any ) -> ContentStreamDownloader: + """Download using content url. + + :param content_url: Required. The content url. + :type content_url: str + :keyword start_range: Http range where download start. + :paramtype start_range: int + :keyword end_range: Http range where download end. + :paramtype end_range: int + :keyword parallel_download_options: The options for parallel download. + :paramtype parallel_download_options: ~azure.communication.callingserver.models.ParallelDownloadOptions + :return: ContentStreamDownloader + :rtype: ~azure.communication.callingserver.ContentStreamDownloader + :raises: ~azure.core.exceptions.HttpResponseError + """ #pylint: disable=protected-access content_downloader = ContentDownloader( self._callingserver_service_client._client, @@ -735,6 +846,15 @@ async def delete_recording( **kwargs: Any ): # type: (...) -> HttpResponse + """Delete recording. + + :param content_delete_url: Required. The content delete url. + :type content_delete_url: str + :return: The response of the operation. + :rtype: ~azure.core.rest.HttpResponse + :raises: ~azure.core.exceptions.HttpResponseError + + """ # pylint: disable=protected-access if not content_delete_url: raise ValueError("content_delete_url can not be None") diff --git a/sdk/communication/azure-communication-callingserver/samples/callingserver_samples.py b/sdk/communication/azure-communication-callingserver/samples/callingserver_samples.py index 615622afaadc..d46f4ce2413b 100644 --- a/sdk/communication/azure-communication-callingserver/samples/callingserver_samples.py +++ b/sdk/communication/azure-communication-callingserver/samples/callingserver_samples.py @@ -50,21 +50,18 @@ def create_call_connection(self): endpoint = self.endpoint from_user = self.user # [START create_call_connection] - from azure.communication.callingserver import PhoneNumberIdentifier, CreateCallOptions, CallMediaType, CallingEventSubscriptionType + from azure.communication.callingserver import PhoneNumberIdentifier, CallMediaType, CallingEventSubscriptionType from azure.communication.callingserver import CallingServerClient from azure.identity import DefaultAzureCredential to_user = PhoneNumberIdentifier("") - options = CreateCallOptions( - callback_uri="", - requested_media_types=[CallMediaType.AUDIO], - requested_call_events=[CallingEventSubscriptionType.PARTICIPANTS_UPDATED, CallingEventSubscriptionType.TONE_RECEIVED] - ) # set `endpoint` to an existing ACS endpoint calling_server_client = CallingServerClient(endpoint, DefaultAzureCredential()) call_connection = calling_server_client.create_call_connection( source=from_user, targets=[to_user], - options=options, + callback_uri="", + requested_media_types=[CallMediaType.AUDIO], + requested_call_events=[CallingEventSubscriptionType.PARTICIPANTS_UPDATED, CallingEventSubscriptionType.TONE_RECEIVED] ) # [END create_call_connection] # [START hang_up_call] @@ -76,20 +73,21 @@ def create_server_call_with_calllocator(self): from_user = self.user # [START create_server_call_with_calllocator] # set `endpoint` to an existing ACS endpoint - from azure.communication.callingserver import ServerCallLocator, CommunicationUserIdentifier, CallMediaType, CallingEventSubscriptionType, JoinCallOptions + from azure.communication.callingserver import ServerCallLocator, CommunicationUserIdentifier, CallMediaType, CallingEventSubscriptionType from azure.communication.callingserver import CallingServerClient from azure.identity import DefaultAzureCredential - join_options = JoinCallOptions( - callback_uri="", - requested_media_types=[CallMediaType.AUDIO], - requested_call_events=[CallingEventSubscriptionType.PARTICIPANTS_UPDATED] - ) # set `endpoint` to an existing ACS endpoint calling_server_client = CallingServerClient(endpoint, DefaultAzureCredential()) server_call_id = "" call_locator = ServerCallLocator(server_call_id) - call_connection = calling_server_client.join_call(call_locator, CommunicationUserIdentifier(from_user), join_options) + call_connection = calling_server_client.join_call( + call_locator, + CommunicationUserIdentifier(from_user), + callback_uri="", + requested_media_types=[CallMediaType.AUDIO], + requested_call_events=[CallingEventSubscriptionType.PARTICIPANTS_UPDATED] + ) # [END create_server_call_with_calllocator] # [START hang_up_call] call_connection.hang_up() diff --git a/sdk/communication/azure-communication-callingserver/samples/callingserver_samples_async.py b/sdk/communication/azure-communication-callingserver/samples/callingserver_samples_async.py index d440dd14948b..0a3e4923c634 100644 --- a/sdk/communication/azure-communication-callingserver/samples/callingserver_samples_async.py +++ b/sdk/communication/azure-communication-callingserver/samples/callingserver_samples_async.py @@ -50,21 +50,18 @@ async def create_call_connection_async(self): endpoint = self.endpoint from_user = self.user # [START create_call_connection] - from azure.communication.callingserver import PhoneNumberIdentifier, CreateCallOptions, MediaType, EventSubscriptionType + from azure.communication.callingserver import PhoneNumberIdentifier, CallMediaType, CallingEventSubscriptionType from azure.communication.callingserver.aio import CallingServerClient from azure.identity.aio import DefaultAzureCredential to_user = PhoneNumberIdentifier(self.to_phone_number) - options = CreateCallOptions( - callback_uri="", - requested_media_types=[MediaType.AUDIO], - requested_call_events=[EventSubscriptionType.PARTICIPANTS_UPDATED, EventSubscriptionType.DTMF_RECEIVED] - ) # set `endpoint` to an existing ACS endpoint calling_server_client_async = CallingServerClient(endpoint, DefaultAzureCredential()) call_connection_async = await calling_server_client_async.create_call_connection( source=from_user, targets=[to_user], - options=options, + callback_uri="", + requested_media_types=[CallMediaType.AUDIO], + requested_call_events=[CallingEventSubscriptionType.PARTICIPANTS_UPDATED, CallingEventSubscriptionType.TONE_RECEIVED] ) # [END create_call_connection] # [START hang_up_call] @@ -76,20 +73,21 @@ async def create_server_call_with_calllocator_async(self): from_user = self.user # [START create_server_call_with_calllocator] # set `endpoint` to an existing ACS endpoint - from azure.communication.callingserver import ServerCallLocator, CommunicationUserIdentifier, MediaType, EventSubscriptionType, JoinCallOptions + from azure.communication.callingserver import ServerCallLocator, CommunicationUserIdentifier, CallMediaType, CallingEventSubscriptionType from azure.communication.callingserver.aio import CallingServerClient from azure.identity.aio import DefaultAzureCredential - join_options = JoinCallOptions( - callback_uri="", - requested_media_types=[MediaType.AUDIO], - requested_call_events=[EventSubscriptionType.PARTICIPANTS_UPDATED] - ) # set `endpoint` to an existing ACS endpoint calling_server_client_async = CallingServerClient(endpoint, DefaultAzureCredential()) server_call_id = "" call_locator = ServerCallLocator(server_call_id) - call_connection_async = await calling_server_client_async.join_call(call_locator, CommunicationUserIdentifier(from_user), join_options) + call_connection_async = await calling_server_client_async.join_call( + call_locator, + CommunicationUserIdentifier(from_user), + callback_uri="", + requested_media_types=[CallMediaType.AUDIO], + requested_call_events=[CallingEventSubscriptionType.PARTICIPANTS_UPDATED] + ) # [END create_server_call_with_calllocator] # [START hang_up_call] await call_connection_async.hang_up() diff --git a/sdk/communication/azure-communication-callingserver/swagger/SWAGGER.md b/sdk/communication/azure-communication-callingserver/swagger/SWAGGER.md index 1e1fd584f0c6..658b68788a1e 100644 --- a/sdk/communication/azure-communication-callingserver/swagger/SWAGGER.md +++ b/sdk/communication/azure-communication-callingserver/swagger/SWAGGER.md @@ -15,7 +15,7 @@ autorest SWAGGER.md ### Settings ``` yaml -require: https://raw.githubusercontent.com/navali-msft/azure-rest-api-specs/c16d5c3b668207b9ec101294a9f05a20e7281083/specification/communication/data-plane/CallingServer/readme.md +require: https://raw.githubusercontent.com/navali-msft/azure-rest-api-specs/f63c517df5083d1f3d044277bac15c6b1ed2b060/specification/communication/data-plane/CallingServer/readme.md output-folder: ../azure/communication/callingserver/_generated namespace: azure.communication.callingserver no-namespace-folders: true diff --git a/sdk/communication/azure-communication-callingserver/tests/test_call_connection.py b/sdk/communication/azure-communication-callingserver/tests/test_call_connection.py index 3da665a02022..76321f6bfdb4 100644 --- a/sdk/communication/azure-communication-callingserver/tests/test_call_connection.py +++ b/sdk/communication/azure-communication-callingserver/tests/test_call_connection.py @@ -13,7 +13,6 @@ from azure.communication.callingserver import ( AudioRoutingMode, CommunicationIdentifier, - PlayAudioOptions ) from utils._unit_test_utils import CallConnectionUnitTestUtils @@ -226,8 +225,11 @@ def test_play_audio_succeed( self, test_name, # type: str call_connection_id, # type: str - audio_file_uri, # type: str - options, # type: PlayAudioOptions + audio_url, # type: str + is_looped, # type: bool + audio_file_id, # type: str + callback_uri, # type: str + operation_context, # type: str use_managed_identity = False # type: bool ): @@ -238,7 +240,13 @@ def test_play_audio_succeed( use_managed_identity=use_managed_identity ) - result = call_connection.play_audio(audio_file_uri, options) + result = call_connection.play_audio( + audio_url, + is_looped, + audio_file_id = audio_file_id, + callback_uri = callback_uri, + operation_context = operation_context + ) CallConnectionUnitTestUtils.verify_play_audio_result(result) @parameterized.expand(CallConnectionUnitTestUtils.data_source_test_play_audio()) @@ -246,8 +254,11 @@ def test_play_audio_failed( self, test_name, # type: str call_connection_id, # type: str - audio_file_uri, # type: str - options, # type: PlayAudioOptions + audio_url, # type: str + is_looped, # type: bool + audio_file_id, # type: str + callback_uri, # type: str + operation_context, # type: str use_managed_identity = False # type: bool ): @@ -260,7 +271,14 @@ def test_play_audio_failed( raised = False try: - call_connection.play_audio(audio_file_uri, options) + call_connection.play_audio( + audio_url, + audio_url, + is_looped, + audio_file_id = audio_file_id, + callback_uri = callback_uri, + operation_context = operation_context + ) except: raised = True assert raised == True @@ -271,8 +289,11 @@ def test_play_audio_to_participant_succeed( test_name, # type: str call_connection_id, # type: str participant, # type: CommunicationIdentifier - audio_file_uri, # type: str - options, # type: PlayAudioOptions + audio_url, # type: str + is_looped, # type: bool + audio_file_id, # type: str + callback_uri, # type: str + operation_context, # type: str use_managed_identity = False # type: bool ): @@ -283,7 +304,14 @@ def test_play_audio_to_participant_succeed( use_managed_identity=use_managed_identity ) - result = call_connection.play_audio_to_participant(participant, audio_file_uri, options) + result = call_connection.play_audio_to_participant( + participant, + audio_url, + is_looped, + audio_file_id = audio_file_id, + callback_uri = callback_uri, + operation_context = operation_context + ) CallConnectionUnitTestUtils.verify_play_audio_result(result) @@ -293,8 +321,11 @@ def test_play_audio_to_participant_failed( test_name, # type: str call_connection_id, # type: str participant, # type: CommunicationIdentifier - audio_file_uri, # type: str - options, # type: PlayAudioOptions + audio_url, # type: str + is_looped, # type: bool + audio_file_id, # type: str + callback_uri, # type: str + operation_context, # type: str use_managed_identity = False # type: bool ): @@ -307,7 +338,14 @@ def test_play_audio_to_participant_failed( raised = False try: - call_connection.play_audio_to_participant(participant, audio_file_uri, options) + call_connection.play_audio_to_participant( + participant, + audio_url, + is_looped, + audio_file_id = audio_file_id, + callback_uri = callback_uri, + operation_context = operation_context + ) except: raised = True assert raised == True @@ -331,7 +369,7 @@ def test_add_participant_succeed( ) result = call_connection.add_participant( - participant = participant, + participant, alternate_caller_id = alternate_caller_id, operation_context = operation_context ) @@ -358,7 +396,7 @@ def test_add_participant_failed( raised = False try: call_connection.add_participant( - participant = participant, + participant, alternate_caller_id = alternate_caller_id, operation_context = operation_context ) @@ -412,8 +450,8 @@ def test_remove_participant_failed( raised = True assert raised == True - @parameterized.expand(CallConnectionUnitTestUtils.data_source_test_get_participants()) - def test_get_participants_succeed( + @parameterized.expand(CallConnectionUnitTestUtils.data_source_test_list_participants()) + def test_list_participants_succeed( self, test_name, # type: str call_connection_id, # type: str @@ -427,11 +465,11 @@ def test_get_participants_succeed( use_managed_identity=use_managed_identity ) - call_connection.get_participants() + call_connection.list_participants() assert call_connection.call_connection_id == _test_constants.CALL_ID - @parameterized.expand(CallConnectionUnitTestUtils.data_source_test_get_participants()) - def test_get_participants_failed( + @parameterized.expand(CallConnectionUnitTestUtils.data_source_test_list_participants()) + def test_list_participants_failed( self, test_name, # type: str call_connection_id, # type: str @@ -447,7 +485,7 @@ def test_get_participants_failed( raised = False try: - call_connection.get_participants() + call_connection.list_participants() except: raised = True assert raised == True @@ -589,7 +627,6 @@ def test_mute_participant_failed( try: call_connection.mute_participant( participant = participant, - media_operation_id = media_operation_id ) except: raised = True @@ -733,45 +770,46 @@ def test_resume_participant_meeting_audio_failed( raised = True assert raised == True - @parameterized.expand(CallConnectionUnitTestUtils.data_source_test_transfer_call()) - def test_transfer_call_succeed( + @parameterized.expand(CallConnectionUnitTestUtils.data_source_test_transfer()) + def test_transfer_succeed( self, test_name, # type: str call_connection_id, # type: str target_participant, # type: CommunicationIdentifier target_call_connection_id, # type: str + alternate_caller_id, # type: str user_to_user_information, # type: str operation_context, # type: str - callback_uri, # type: str use_managed_identity = False # type: bool ): call_connection = _mock_utils.create_mock_call_connection( call_connection_id, status_code=202, - payload=None, + payload=_test_constants.TransferResultPayload, use_managed_identity=use_managed_identity ) - call_connection.transfer_call( - target_participant = target_participant, - target_call_connection_id = target_call_connection_id, + result = call_connection.transfer( + target_participant, + target_call_connection_id, + alternate_caller_id = alternate_caller_id, user_to_user_information = user_to_user_information, - operation_context = operation_context, - callback_uri = callback_uri + operation_context = operation_context ) - assert call_connection.call_connection_id == _test_constants.CALL_ID + CallConnectionUnitTestUtils.verify_transfer_result(result) - @parameterized.expand(CallConnectionUnitTestUtils.data_source_test_transfer_call()) - def test_transfer_call_failed( + + @parameterized.expand(CallConnectionUnitTestUtils.data_source_test_transfer()) + def test_transfer_failed( self, test_name, # type: str call_connection_id, # type: str target_participant, # type: CommunicationIdentifier target_call_connection_id, # type: str + alternate_caller_id, # type: str user_to_user_information, # type: str operation_context, # type: str - callback_uri, # type: str use_managed_identity = False # type: bool ): @@ -784,12 +822,12 @@ def test_transfer_call_failed( raised = False try: - call_connection.transfer_call( - target_participant = target_participant, - target_call_connection_id = target_call_connection_id, + call_connection.transfer( + target_participant, + target_call_connection_id, + alternate_caller_id = alternate_caller_id, user_to_user_information = user_to_user_information, - operation_context = operation_context, - callback_uri = callback_uri + operation_context = operation_context ) except: raised = True @@ -845,8 +883,8 @@ def test_create_audio_routing_group_failed( raised = True assert raised == True - @parameterized.expand(CallConnectionUnitTestUtils.data_source_test_get_audio_routing_group()) - def test_get_audio_routing_groups_succeed( + @parameterized.expand(CallConnectionUnitTestUtils.data_source_test_list_audio_routing_groups()) + def test_list_audio_routing_groups_succeed( self, test_name, # type: str call_connection_id, # type: str @@ -861,13 +899,13 @@ def test_get_audio_routing_groups_succeed( use_managed_identity=use_managed_identity ) - result = call_connection.get_audio_routing_groups( + result = call_connection.list_audio_routing_groups( audio_routing_group_id = audio_routing_group_id ) CallConnectionUnitTestUtils.verify_get_audio_routing_group(result) - @parameterized.expand(CallConnectionUnitTestUtils.data_source_test_get_audio_routing_group()) - def test_get_audio_routing_groups_failed( + @parameterized.expand(CallConnectionUnitTestUtils.data_source_test_list_audio_routing_groups()) + def test_list_audio_routing_groups_failed( self, test_name, # type: str call_connection_id, # type: str @@ -884,7 +922,7 @@ def test_get_audio_routing_groups_failed( raised = False try: - call_connection.get_audio_routing_groups( + call_connection.list_audio_routing_groups( audio_routing_group_id = audio_routing_group_id ) except: diff --git a/sdk/communication/azure-communication-callingserver/tests/test_call_connection_async.py b/sdk/communication/azure-communication-callingserver/tests/test_call_connection_async.py index 09588ace86d4..fc28a120322b 100644 --- a/sdk/communication/azure-communication-callingserver/tests/test_call_connection_async.py +++ b/sdk/communication/azure-communication-callingserver/tests/test_call_connection_async.py @@ -12,8 +12,7 @@ from azure.communication.callingserver import ( AudioRoutingMode, - CommunicationIdentifier, - PlayAudioOptions + CommunicationIdentifier ) from utils._unit_test_utils import CallConnectionUnitTestUtils @@ -224,8 +223,11 @@ async def test_cancel_all_media_operations_failed( async def test_play_audio_succeed( test_name, # type: str call_connection_id, # type: str - audio_file_uri, # type: str - options, # type: PlayAudioOptions + audio_url, # type: str + is_looped, # type: bool + audio_file_id, # type: str + callback_uri, # type: str + operation_context, # type: str use_managed_identity = False # type: bool ): @@ -236,7 +238,13 @@ async def test_play_audio_succeed( use_managed_identity=use_managed_identity ) - result = await call_connection.play_audio(audio_file_uri, options) + result = await call_connection.play_audio( + audio_url, + is_looped, + audio_file_id = audio_file_id, + callback_uri = callback_uri, + operation_context = operation_context + ) CallConnectionUnitTestUtils.verify_play_audio_result(result) @parameterized.expand(CallConnectionUnitTestUtils.data_source_test_play_audio()) @@ -244,8 +252,11 @@ async def test_play_audio_succeed( async def test_play_audio_failed( test_name, # type: str call_connection_id, # type: str - audio_file_uri, # type: str - options, # type: PlayAudioOptions + audio_url, # type: str + is_looped, # type: bool + audio_file_id, # type: str + callback_uri, # type: str + operation_context, # type: str use_managed_identity = False # type: bool ): @@ -258,7 +269,13 @@ async def test_play_audio_failed( raised = False try: - await call_connection.play_audio(audio_file_uri, options) + await call_connection.play_audio( + audio_url, + is_looped, + audio_file_id = audio_file_id, + callback_uri = callback_uri, + operation_context = operation_context + ) except: raised = True assert raised == True @@ -282,7 +299,7 @@ async def test_add_participant_succeed( ) result = await call_connection.add_participant( - participant = participant, + participant, alternate_caller_id = alternate_caller_id, operation_context = operation_context ) @@ -309,7 +326,7 @@ async def test_add_participant_failed( raised = False try: await call_connection.add_participant( - participant = participant, + participant, alternate_caller_id = alternate_caller_id, operation_context = operation_context ) @@ -363,9 +380,9 @@ async def test_remove_participant_failed( raised = True assert raised == True -@parameterized.expand(CallConnectionUnitTestUtils.data_source_test_get_participants()) +@parameterized.expand(CallConnectionUnitTestUtils.data_source_test_list_participants()) @pytest.mark.asyncio -async def test_get_participants_succeed( +async def test_list_participants_succeed( test_name, # type: str call_connection_id, # type: str use_managed_identity = False # type: bool @@ -378,12 +395,12 @@ async def test_get_participants_succeed( use_managed_identity=use_managed_identity ) - await call_connection.get_participants() + await call_connection.list_participants() assert call_connection.call_connection_id == _test_constants.CALL_ID -@parameterized.expand(CallConnectionUnitTestUtils.data_source_test_get_participants()) +@parameterized.expand(CallConnectionUnitTestUtils.data_source_test_list_participants()) @pytest.mark.asyncio -async def test_get_participants_failed( +async def test_list_participants_failed( test_name, # type: str call_connection_id, # type: str use_managed_identity = False # type: bool @@ -398,7 +415,7 @@ async def test_get_participants_failed( raised = False try: - await call_connection.get_participants() + await call_connection.list_participants() except: raised = True assert raised == True @@ -455,8 +472,11 @@ async def test_play_audio_to_participant_succeed( test_name, # type: str call_connection_id, # type: str participant, # type: CommunicationIdentifier - audio_file_uri, # type: str - options, # type: PlayAudioOptions + audio_url, # type: str + is_looped, # type: bool + audio_file_id, # type: str + callback_uri, # type: str + operation_context, # type: str use_managed_identity = False # type: bool ): @@ -467,7 +487,14 @@ async def test_play_audio_to_participant_succeed( use_managed_identity=use_managed_identity ) - result = await call_connection.play_audio_to_participant(participant, audio_file_uri, options) + result = await call_connection.play_audio_to_participant( + participant, + audio_url, + is_looped, + audio_file_id = audio_file_id, + callback_uri = callback_uri, + operation_context = operation_context + ) CallConnectionUnitTestUtils.verify_play_audio_result(result) @parameterized.expand(CallConnectionUnitTestUtils.data_source_test_play_audio_to_participant()) @@ -476,8 +503,11 @@ async def test_play_audio_to_participant_failed( test_name, # type: str call_connection_id, # type: str participant, # type: CommunicationIdentifier - audio_file_uri, # type: str - options, # type: PlayAudioOptions + audio_url, # type: str + is_looped, # type: bool + audio_file_id, # type: str + callback_uri, # type: str + operation_context, # type: str use_managed_identity = False # type: bool ): @@ -490,7 +520,14 @@ async def test_play_audio_to_participant_failed( raised = False try: - await call_connection.play_audio_to_participant(participant, audio_file_uri, options) + await call_connection.play_audio_to_participant( + participant, + audio_url, + is_looped, + audio_file_id = audio_file_id, + callback_uri = callback_uri, + operation_context = operation_context + ) except: raised = True assert raised == True @@ -729,45 +766,45 @@ async def test_resume_participant_meeting_audio_failed( raised = True assert raised == True -@parameterized.expand(CallConnectionUnitTestUtils.data_source_test_transfer_call()) +@parameterized.expand(CallConnectionUnitTestUtils.data_source_test_transfer()) @pytest.mark.asyncio -async def test_transfer_call_succeed( +async def test_transfer_succeed( test_name, # type: str call_connection_id, # type: str target_participant, # type: CommunicationIdentifier target_call_connection_id, # type: str + alternate_caller_id, # type: str user_to_user_information, # type: str operation_context, # type: str - callback_uri, # type: str use_managed_identity = False # type: bool ): call_connection = _mock_utils_async.create_mock_call_connection( call_connection_id, status_code=202, - payload=None, + payload=_test_constants.TransferResultPayload, use_managed_identity=use_managed_identity ) - await call_connection.transfer_call( - target_participant = target_participant, - target_call_connection_id = target_call_connection_id, + result = await call_connection.transfer( + target_participant, + target_call_connection_id, + alternate_caller_id = alternate_caller_id, user_to_user_information = user_to_user_information, - operation_context = operation_context, - callback_uri = callback_uri + operation_context = operation_context ) - assert call_connection.call_connection_id == _test_constants.CALL_ID + CallConnectionUnitTestUtils.verify_transfer_result(result) -@parameterized.expand(CallConnectionUnitTestUtils.data_source_test_transfer_call()) +@parameterized.expand(CallConnectionUnitTestUtils.data_source_test_transfer()) @pytest.mark.asyncio -async def test_transfer_call_failed( +async def test_transfer_failed( test_name, # type: str call_connection_id, # type: str target_participant, # type: CommunicationIdentifier target_call_connection_id, # type: str + alternate_caller_id, # type: str user_to_user_information, # type: str operation_context, # type: str - callback_uri, # type: str use_managed_identity = False # type: bool ): @@ -780,12 +817,12 @@ async def test_transfer_call_failed( raised = False try: - await call_connection.transfer_call( - target_participant = target_participant, - target_call_connection_id = target_call_connection_id, + await call_connection.transfer( + target_participant, + target_call_connection_id, + alternate_caller_id = alternate_caller_id, user_to_user_information = user_to_user_information, operation_context = operation_context, - callback_uri = callback_uri ) except: raised = True @@ -841,9 +878,9 @@ async def test_create_audio_routing_group_failed( raised = True assert raised == True -@parameterized.expand(CallConnectionUnitTestUtils.data_source_test_get_audio_routing_group()) +@parameterized.expand(CallConnectionUnitTestUtils.data_source_test_list_audio_routing_groups()) @pytest.mark.asyncio -async def test_get_audio_routing_groups_succeed( +async def test_list_audio_routing_groups_succeed( test_name, # type: str call_connection_id, # type: str audio_routing_group_id, # type: str @@ -857,14 +894,14 @@ async def test_get_audio_routing_groups_succeed( use_managed_identity=use_managed_identity ) - result = await call_connection.get_audio_routing_groups( + result = await call_connection.list_audio_routing_groups( audio_routing_group_id = audio_routing_group_id ) CallConnectionUnitTestUtils.verify_get_audio_routing_group(result) -@parameterized.expand(CallConnectionUnitTestUtils.data_source_test_get_audio_routing_group()) +@parameterized.expand(CallConnectionUnitTestUtils.data_source_test_list_audio_routing_groups()) @pytest.mark.asyncio -async def test_get_audio_routing_groups_failed( +async def test_list_audio_routing_groups_failed( test_name, # type: str call_connection_id, # type: str audio_routing_group_id, # type: str @@ -880,7 +917,7 @@ async def test_get_audio_routing_groups_failed( raised = False try: - await call_connection.get_audio_routing_groups( + await call_connection.list_audio_routing_groups( audio_routing_group_id = audio_routing_group_id ) except: diff --git a/sdk/communication/azure-communication-callingserver/tests/test_callingserver_client.py b/sdk/communication/azure-communication-callingserver/tests/test_callingserver_client.py index 87e73bca62d4..b94e61103787 100644 --- a/sdk/communication/azure-communication-callingserver/tests/test_callingserver_client.py +++ b/sdk/communication/azure-communication-callingserver/tests/test_callingserver_client.py @@ -10,12 +10,8 @@ from typing import List from parameterized import parameterized from azure.communication.callingserver import ( - CreateCallOptions, - JoinCallOptions, CommunicationIdentifier, CallLocator, - PlayAudioOptions, - ServerCallLocator, CallMediaType, CallingEventSubscriptionType, CallRejectReason @@ -31,7 +27,9 @@ def test_create_connection_succeed( test_name, # type: str source_user, # type: CommunicationIdentifier target_users, # type: List[CommunicationIdentifier] - options, # type: CreateCallOptions + callback_uri, # type: str + requested_media_types, # type: List[CallMediaType] + requested_call_events, # type: List[CallingEventSubscriptionType] use_managed_identity = False # type: bool ): @@ -41,8 +39,13 @@ def test_create_connection_succeed( use_managed_identity = use_managed_identity ) - call_connection = calling_server_client.create_call_connection(source_user, - target_users, options) + call_connection = calling_server_client.create_call_connection( + source_user, + target_users, + callback_uri, + requested_media_types, + requested_call_events + ) assert call_connection.call_connection_id == _test_constants.CALL_ID @parameterized.expand(CallingServerUnitTestUtils.data_source_test_create_connection()) @@ -51,7 +54,9 @@ def test_create_connection_failed( test_name, # type: str source_user, # type: CommunicationIdentifier target_users, # type: List[CommunicationIdentifier] - options, # type: CreateCallOptions + callback_uri, # type: str + requested_media_types, # type: List[CallMediaType] + requested_call_events, # type: List[CallingEventSubscriptionType] use_managed_identity = False # type: bool ): @@ -63,7 +68,13 @@ def test_create_connection_failed( raised = False try: - calling_server_client.create_call_connection(source_user, target_users, options) + calling_server_client.create_call_connection( + source_user, + target_users, + callback_uri, + requested_media_types, + requested_call_events + ) except: raised = True assert raised == True @@ -74,7 +85,9 @@ def test_join_call_succeed( test_name, # type: str call_locator, # type: CallLocator source_user, # type: CommunicationIdentifier - options, # type: JoinCallOptions + callback_uri, # type: str + requested_media_types, # type: List[CallMediaType] + requested_call_events, # type: List[CallingEventSubscriptionType] use_managed_identity = False # type: bool ): @@ -87,7 +100,9 @@ def test_join_call_succeed( call_connection = calling_server_client.join_call( call_locator, source_user, - options + callback_uri, + requested_media_types, + requested_call_events ) assert call_connection.call_connection_id == _test_constants.CALL_ID @@ -98,7 +113,9 @@ def test_join_call_failed( test_name, # type: str call_locator, # type: CallLocator source_user, # type: CommunicationIdentifier - options, # type: JoinCallOptions + callback_uri, # type: str + requested_media_types, # type: List[CallMediaType] + requested_call_events, # type: List[CallingEventSubscriptionType] use_managed_identity = False # type: bool ): @@ -113,7 +130,9 @@ def test_join_call_failed( calling_server_client.join_call( call_locator, source_user, - options + callback_uri, + requested_media_types, + requested_call_events ) except: raised = True @@ -131,7 +150,7 @@ def test_answer_call_succeed( ): calling_server_client = _mock_utils.create_mock_calling_server_client( - status_code=201, + status_code=202, payload=_test_constants.AnswerCallResponsePayload, use_managed_identity = use_managed_identity ) @@ -281,8 +300,11 @@ def test_play_audio_succeed( self, test_name, # type: str call_locator, # type: CallLocator - audio_file_uri, # type: str - options, # type: PlayAudioOptions + audio_url, # type: str + is_looped, # type: bool + audio_file_id, # type: str + callback_uri, # type: str + operation_context, # type: str use_managed_identity = False # type: bool ): @@ -294,8 +316,11 @@ def test_play_audio_succeed( result = calling_server_client.play_audio( call_locator, - audio_file_uri, - options + audio_url, + is_looped, + audio_file_id = audio_file_id, + callback_uri = callback_uri, + operation_context = operation_context ) CallingServerUnitTestUtils.verify_play_audio_result(result) @@ -305,8 +330,11 @@ def test_play_audio_failed( self, test_name, # type: str call_locator, # type: CallLocator - audio_file_uri, # type: str - options, # type: PlayAudioOptions + audio_url, # type: str + is_looped, # type: bool + audio_file_id, # type: str + callback_uri, # type: str + operation_context, # type: str use_managed_identity = False # type: bool ): @@ -320,8 +348,11 @@ def test_play_audio_failed( try: calling_server_client.play_audio( call_locator, - audio_file_uri, - options + audio_url, + is_looped, + audio_file_id = audio_file_id, + callback_uri = callback_uri, + operation_context = operation_context ) except: raised = True @@ -333,8 +364,11 @@ def test_play_audio_to_participant_succeed( test_name, # type: str call_locator, # type: CallLocator participant, # type: CommunicationIdentifier - audio_file_uri, # type: str - play_audio_options, # type: PlayAudioOptions + audio_url, # type: str + is_looped, # type: bool + audio_file_id, # type: str + callback_uri, # type: str + operation_context, # type: str use_managed_identity = False # type: bool ): @@ -347,8 +381,11 @@ def test_play_audio_to_participant_succeed( result = calling_server_client.play_audio_to_participant( call_locator, participant, - audio_file_uri, - play_audio_options + audio_url, + is_looped, + audio_file_id = audio_file_id, + callback_uri = callback_uri, + operation_context = operation_context ) CallingServerUnitTestUtils.verify_play_audio_result(result) @@ -358,8 +395,11 @@ def test_play_audio_to_participant_failed( test_name, # type: str call_locator, # type: CallLocator participant, # type: CommunicationIdentifier - audio_file_uri, # type: str - play_audio_options, # type: PlayAudioOptions + audio_url, # type: str + is_looped, # type: bool + audio_file_id, # type: str + callback_uri, # type: str + operation_context, # type: str use_managed_identity = False # type: bool ): @@ -374,8 +414,11 @@ def test_play_audio_to_participant_failed( calling_server_client.play_audio_to_participant( call_locator, participant, - audio_file_uri, - play_audio_options + audio_url, + is_looped, + audio_file_id = audio_file_id, + callback_uri = callback_uri, + operation_context = operation_context ) except: raised = True @@ -485,8 +528,8 @@ def test_remove_participant_failed( raised = True assert raised == True - @parameterized.expand(CallingServerUnitTestUtils.data_source_test_get_participants_with_call_locator()) - def test_get_participants_succeed( + @parameterized.expand(CallingServerUnitTestUtils.data_source_test_list_participants_with_call_locator()) + def test_list_participants_succeed( self, test_name, # type: str call_locator, # type: CallLocator @@ -499,13 +542,13 @@ def test_get_participants_succeed( use_managed_identity=use_managed_identity ) - result = calling_server_client.get_participants( + result = calling_server_client.list_participants( call_locator ) - CallingServerUnitTestUtils.verify_get_participants_result(result) + CallingServerUnitTestUtils.verify_list_participants_result(result) - @parameterized.expand(CallingServerUnitTestUtils.data_source_test_get_participants_with_call_locator()) - def test_get_participants_failed( + @parameterized.expand(CallingServerUnitTestUtils.data_source_test_list_participants_with_call_locator()) + def test_list_participants_failed( self, test_name, # type: str call_locator, # type: CallLocator @@ -520,7 +563,7 @@ def test_get_participants_failed( raised = False try: - calling_server_client.get_participants( + calling_server_client.list_participants( call_locator ) except: @@ -573,96 +616,6 @@ def test_get_participant_failed( raised = True assert raised == True - @parameterized.expand(CallingServerUnitTestUtils.data_source_test_mute_participant_with_call_locator()) - def test_mute_participant_succeed( - self, - test_name, # type: str - call_locator, # type: CallLocator - participant, # type: CommunicationIdentifier - use_managed_identity = False # type: bool - ): - - calling_server_client = _mock_utils.create_mock_calling_server_client( - status_code=200, - payload=None, - use_managed_identity=use_managed_identity - ) - - calling_server_client.mute_participant( - call_locator, - participant=participant - ) - - @parameterized.expand(CallingServerUnitTestUtils.data_source_test_mute_participant_with_call_locator()) - def test_mute_participant_failed( - self, - test_name, # type: str - call_locator, # type: CallLocator - participant, # type: CommunicationIdentifier - use_managed_identity = False # type: bool - ): - - calling_server_client = _mock_utils.create_mock_calling_server_client( - status_code=404, - payload=_test_constants.ErrorPayload, - use_managed_identity = use_managed_identity - ) - - raised = False - try: - calling_server_client.mute_participant( - call_locator, - participant=participant - ) - except: - raised = True - assert raised == True - - @parameterized.expand(CallingServerUnitTestUtils.data_source_test_unmute_participant_with_call_locator()) - def test_unmute_participant_succeed( - self, - test_name, # type: str - call_locator, # type: CallLocator - participant, # type: CommunicationIdentifier - use_managed_identity = False # type: bool - ): - - calling_server_client = _mock_utils.create_mock_calling_server_client( - status_code=200, - payload=None, - use_managed_identity=use_managed_identity - ) - - calling_server_client.unmute_participant( - call_locator, - participant=participant - ) - - @parameterized.expand(CallingServerUnitTestUtils.data_source_test_unmute_participant_with_call_locator()) - def test_unmute_participant_failed( - self, - test_name, # type: str - call_locator, # type: CallLocator - participant, # type: CommunicationIdentifier - use_managed_identity = False # type: bool - ): - - calling_server_client = _mock_utils.create_mock_calling_server_client( - status_code=404, - payload=_test_constants.ErrorPayload, - use_managed_identity = use_managed_identity - ) - - raised = False - try: - calling_server_client.unmute_participant( - call_locator, - participant=participant - ) - except: - raised = True - assert raised == True - @parameterized.expand(CallingServerUnitTestUtils.data_source_test_cancel_media_operation()) def test_cancel_media_operation_succeed( self, @@ -756,93 +709,3 @@ def test_cancel_participant_media_operation_failed( except: raised = True assert raised == True - - @parameterized.expand(CallingServerUnitTestUtils.data_source_test_hold_participant_meeting_audio_with_callLocator()) - def test_hold_participant_meeting_audio( - self, - test_name, # type: str - call_locator, # type: CallLocator - participant, # type: CommunicationIdentifier - use_managed_identity = False # type: bool - ): - - calling_server_client = _mock_utils.create_mock_calling_server_client( - status_code=200, - payload=None, - use_managed_identity=use_managed_identity - ) - - calling_server_client.hold_participant_meeting_audio( - call_locator, - participant - ) - - @parameterized.expand(CallingServerUnitTestUtils.data_source_test_hold_participant_meeting_audio_with_callLocator()) - def test_hold_participant_meeting_audio_failed( - self, - test_name, # type: str - call_locator, # type: CallLocator - participant, # type: CommunicationIdentifier - use_managed_identity = False # type: bool - ): - - calling_server_client = _mock_utils.create_mock_calling_server_client( - status_code=404, - payload=_test_constants.ErrorPayload, - use_managed_identity = use_managed_identity - ) - - raised = False - try: - calling_server_client.hold_participant_meeting_audio( - call_locator, - participant - ) - except: - raised = True - assert raised == True - - @parameterized.expand(CallingServerUnitTestUtils.data_source_test_resume_participant_meeting_audio_with_callLocator()) - def test_resume_participant_meeting_audio( - self, - test_name, # type: str - call_locator, # type: CallLocator - participant, # type: CommunicationIdentifier - use_managed_identity = False # type: bool - ): - - calling_server_client = _mock_utils.create_mock_calling_server_client( - status_code=200, - payload=None, - use_managed_identity=use_managed_identity - ) - - calling_server_client.resume_participant_meeting_audio( - call_locator, - participant - ) - - @parameterized.expand(CallingServerUnitTestUtils.data_source_test_resume_participant_meeting_audio_with_callLocator()) - def test_resume_participant_meeting_audio_failed( - self, - test_name, # type: str - call_locator, # type: CallLocator - participant, # type: CommunicationIdentifier - use_managed_identity = False # type: bool - ): - - calling_server_client = _mock_utils.create_mock_calling_server_client( - status_code=404, - payload=_test_constants.ErrorPayload, - use_managed_identity = use_managed_identity - ) - - raised = False - try: - calling_server_client.resume_participant_meeting_audio( - call_locator, - participant - ) - except: - raised = True - assert raised == True diff --git a/sdk/communication/azure-communication-callingserver/tests/test_callingserver_client_async.py b/sdk/communication/azure-communication-callingserver/tests/test_callingserver_client_async.py index 86bc5cb0ab33..9a4dcaa8329e 100644 --- a/sdk/communication/azure-communication-callingserver/tests/test_callingserver_client_async.py +++ b/sdk/communication/azure-communication-callingserver/tests/test_callingserver_client_async.py @@ -10,9 +10,6 @@ from typing import List from parameterized import parameterized from azure.communication.callingserver import ( - CreateCallOptions, - JoinCallOptions, - PlayAudioOptions, CommunicationIdentifier, CallLocator, ServerCallLocator, @@ -28,7 +25,9 @@ async def test_create_connection_succeed( test_name, # type: str source_user, # type: CommunicationIdentifier target_users, # type: List[CommunicationIdentifier] - options, # type: CreateCallOptions + callback_uri, # type: str + requested_media_types, # type: List[CallMediaType] + requested_call_events, # type: List[CallingEventSubscriptionType] use_managed_identity = False # type: bool ): @@ -38,8 +37,13 @@ async def test_create_connection_succeed( use_managed_identity = use_managed_identity ) - call_connection = await calling_server_client.create_call_connection(source_user, - target_users, options) + call_connection = await calling_server_client.create_call_connection( + source_user, + target_users, + callback_uri, + requested_media_types, + requested_call_events + ) assert call_connection.call_connection_id == _test_constants.CALL_ID @@ -49,7 +53,9 @@ async def test_create_connection_failed( test_name, # type: str source_user, # type: CommunicationIdentifier target_users, # type: List[CommunicationIdentifier] - options, # type: CreateCallOptions + callback_uri, # type: str + requested_media_types, # type: List[CallMediaType] + requested_call_events, # type: List[CallingEventSubscriptionType] use_managed_identity = False # type: bool ): @@ -61,7 +67,13 @@ async def test_create_connection_failed( raised = False try: - await calling_server_client.create_call_connection(source_user, target_users, options) + await calling_server_client.create_call_connection( + source_user, + target_users, + callback_uri, + requested_media_types, + requested_call_events + ) except: raised = True assert raised == True @@ -72,7 +84,9 @@ async def test_join_call_succeed( test_name, # type: str call_locator, # type: CallLocator source_user, # type: CommunicationIdentifier - options, # type: JoinCallOptions + callback_uri, # type: str + requested_media_types, # type: List[CallMediaType] + requested_call_events, # type: List[CallingEventSubscriptionType] use_managed_identity = False # type: bool ): @@ -85,7 +99,9 @@ async def test_join_call_succeed( call_connection = await calling_server_client.join_call( call_locator, source_user, - options + callback_uri, + requested_media_types, + requested_call_events ) assert call_connection.call_connection_id == _test_constants.CALL_ID @@ -96,7 +112,9 @@ async def test_join_call_failed( test_name, # type: str call_locator, # type: CallLocator source_user, # type: CommunicationIdentifier - options, # type: JoinCallOptions + callback_uri, # type: str + requested_media_types, # type: List[CallMediaType] + requested_call_events, # type: List[CallingEventSubscriptionType] use_managed_identity = False # type: bool ): @@ -111,7 +129,9 @@ async def test_join_call_failed( await calling_server_client.join_call( call_locator, source_user, - options + callback_uri, + requested_media_types, + requested_call_events ) except: raised = True @@ -129,13 +149,13 @@ async def test_answer_call_succeed( ): calling_server_client = _mock_utils_async.create_mock_calling_server_client( - status_code=201, + status_code=202, payload=_test_constants.AnswerCallResponsePayload, use_managed_identity = use_managed_identity ) result = await calling_server_client.answer_call( - incoming_call_context=incoming_call_context, + incoming_call_context, callback_uri=callback_uri, requested_media_types=requested_media_types, requested_call_events=requested_call_events @@ -279,8 +299,11 @@ async def test_redirect_call_failed( async def test_play_audio_succeed( test_name, # type: str call_locator, # type: CallLocator - audio_file_uri, # type: str - options, # type: PlayAudioOptions + audio_url, # type: str + is_looped, # type: bool + audio_file_id, # type: str + callback_uri, # type: str + operation_context, # type: str use_managed_identity = False # type: bool ): @@ -292,8 +315,11 @@ async def test_play_audio_succeed( result = await calling_server_client.play_audio( call_locator, - audio_file_uri, - options + audio_url, + is_looped, + audio_file_id = audio_file_id, + callback_uri = callback_uri, + operation_context = operation_context ) CallingServerUnitTestUtils.verify_play_audio_result(result) @@ -303,8 +329,11 @@ async def test_play_audio_succeed( async def test_play_audio_failed( test_name, # type: str call_locator, # type: CallLocator - audio_file_uri, # type: str - options, # type: PlayAudioOptions + audio_url, # type: str + is_looped, # type: bool + audio_file_id, # type: str + callback_uri, # type: str + operation_context, # type: str use_managed_identity = False # type: bool ): @@ -318,8 +347,11 @@ async def test_play_audio_failed( try: await calling_server_client.play_audio( call_locator, - audio_file_uri, - options + audio_url, + is_looped, + audio_file_id = audio_file_id, + callback_uri = callback_uri, + operation_context = operation_context ) except: raised = True @@ -331,8 +363,11 @@ async def test_play_audio_to_participant_succeed( test_name, # type: str call_locator, # type: CallLocator participant, # type: CommunicationIdentifier - audio_file_uri, # type: str - play_audio_options, # type: PlayAudioOptions + audio_url, # type: str + is_looped, # type: bool + audio_file_id, # type: str + callback_uri, # type: str + operation_context, # type: str use_managed_identity = False # type: bool ): @@ -345,8 +380,11 @@ async def test_play_audio_to_participant_succeed( result = await calling_server_client.play_audio_to_participant( call_locator, participant, - audio_file_uri, - play_audio_options + audio_url, + is_looped, + audio_file_id = audio_file_id, + callback_uri = callback_uri, + operation_context = operation_context ) CallingServerUnitTestUtils.verify_play_audio_result(result) @@ -356,8 +394,11 @@ async def test_play_audio_to_participant_failed( test_name, # type: str call_locator, # type: CallLocator participant, # type: CommunicationIdentifier - audio_file_uri, # type: str - play_audio_options, # type: PlayAudioOptions + audio_url, # type: str + is_looped, # type: bool + audio_file_id, # type: str + callback_uri, # type: str + operation_context, # type: str use_managed_identity = False # type: bool ): @@ -372,8 +413,11 @@ async def test_play_audio_to_participant_failed( await calling_server_client.play_audio_to_participant( call_locator, participant, - audio_file_uri, - play_audio_options + audio_url, + is_looped, + audio_file_id = audio_file_id, + callback_uri = callback_uri, + operation_context = operation_context ) except: raised = True @@ -483,9 +527,9 @@ async def test_remove_participant_failed( raised = True assert raised == True -@parameterized.expand(CallingServerUnitTestUtils.data_source_test_get_participants_with_call_locator()) +@parameterized.expand(CallingServerUnitTestUtils.data_source_test_list_participants_with_call_locator()) @pytest.mark.asyncio -async def test_get_participants_succeed( +async def test_list_participants_succeed( test_name, # type: str call_locator, # type: CallLocator use_managed_identity = False # type: bool @@ -497,14 +541,14 @@ async def test_get_participants_succeed( use_managed_identity=use_managed_identity ) - result = await calling_server_client.get_participants( + result = await calling_server_client.list_participants( call_locator ) - CallingServerUnitTestUtils.verify_get_participants_result(result) + CallingServerUnitTestUtils.verify_list_participants_result(result) -@parameterized.expand(CallingServerUnitTestUtils.data_source_test_get_participants_with_call_locator()) +@parameterized.expand(CallingServerUnitTestUtils.data_source_test_list_participants_with_call_locator()) @pytest.mark.asyncio -async def test_get_participants_failed( +async def test_list_participants_failed( test_name, # type: str call_locator, # type: CallLocator use_managed_identity = False # type: bool @@ -518,7 +562,7 @@ async def test_get_participants_failed( raised = False try: - await calling_server_client.get_participants( + await calling_server_client.list_participants( call_locator ) except: @@ -571,96 +615,6 @@ async def test_get_participant_failed( raised = True assert raised == True -@parameterized.expand(CallingServerUnitTestUtils.data_source_test_mute_participant_with_call_locator()) -@pytest.mark.asyncio -async def test_mute_participant_succeed( - test_name, # type: str - call_locator, # type: CallLocator - participant, # type: CommunicationIdentifier - use_managed_identity = False # type: bool - ): - - calling_server_client = _mock_utils_async.create_mock_calling_server_client( - status_code=200, - payload=None, - use_managed_identity=use_managed_identity - ) - - await calling_server_client.mute_participant( - call_locator, - participant=participant - ) - -@parameterized.expand(CallingServerUnitTestUtils.data_source_test_mute_participant_with_call_locator()) -@pytest.mark.asyncio -async def test_mute_participant_failed( - test_name, # type: str - call_locator, # type: CallLocator - participant, # type: CommunicationIdentifier - use_managed_identity = False # type: bool - ): - - calling_server_client = _mock_utils_async.create_mock_calling_server_client( - status_code=404, - payload=_test_constants.ErrorPayload, - use_managed_identity = use_managed_identity - ) - - raised = False - try: - await calling_server_client.mute_participant( - call_locator, - participant=participant - ) - except: - raised = True - assert raised == True - -@parameterized.expand(CallingServerUnitTestUtils.data_source_test_unmute_participant_with_call_locator()) -@pytest.mark.asyncio -async def test_unmute_participant_succeed( - test_name, # type: str - call_locator, # type: CallLocator - participant, # type: CommunicationIdentifier - use_managed_identity = False # type: bool - ): - - calling_server_client = _mock_utils_async.create_mock_calling_server_client( - status_code=200, - payload=None, - use_managed_identity=use_managed_identity - ) - - await calling_server_client.unmute_participant( - call_locator, - participant=participant - ) - -@parameterized.expand(CallingServerUnitTestUtils.data_source_test_unmute_participant_with_call_locator()) -@pytest.mark.asyncio -async def test_unmute_participant_failed( - test_name, # type: str - call_locator, # type: CallLocator - participant, # type: CommunicationIdentifier - use_managed_identity = False # type: bool - ): - - calling_server_client = _mock_utils_async.create_mock_calling_server_client( - status_code=404, - payload=_test_constants.ErrorPayload, - use_managed_identity = use_managed_identity - ) - - raised = False - try: - await calling_server_client.unmute_participant( - call_locator, - participant=participant - ) - except: - raised = True - assert raised == True - @parameterized.expand(CallingServerUnitTestUtils.data_source_test_cancel_media_operation()) @pytest.mark.asyncio async def test_cancel_media_operation_succeed( @@ -754,93 +708,3 @@ async def test_cancel_participant_media_operation_failed( except: raised = True assert raised == True - -@parameterized.expand(CallingServerUnitTestUtils.data_source_test_hold_participant_meeting_audio_with_callLocator()) -@pytest.mark.asyncio -async def test_hold_participant_meeting_audio( - test_name, # type: str - call_locator, # type: CallLocator - participant, # type: CommunicationIdentifier - use_managed_identity = False # type: bool - ): - - calling_server_client = _mock_utils_async.create_mock_calling_server_client( - status_code=200, - payload=None, - use_managed_identity=use_managed_identity - ) - - await calling_server_client.hold_participant_meeting_audio( - call_locator, - participant - ) - -@parameterized.expand(CallingServerUnitTestUtils.data_source_test_hold_participant_meeting_audio_with_callLocator()) -@pytest.mark.asyncio -async def test_hold_participant_meeting_audio_failed( - test_name, # type: str - call_locator, # type: CallLocator - participant, # type: CommunicationIdentifier - use_managed_identity = False # type: bool - ): - - calling_server_client = _mock_utils_async.create_mock_calling_server_client( - status_code=404, - payload=_test_constants.ErrorPayload, - use_managed_identity = use_managed_identity - ) - - raised = False - try: - await calling_server_client.hold_participant_meeting_audio( - call_locator, - participant - ) - except: - raised = True - assert raised == True - -@parameterized.expand(CallingServerUnitTestUtils.data_source_test_resume_participant_meeting_audio_with_callLocator()) -@pytest.mark.asyncio -async def test_resume_participant_meeting_audio( - test_name, # type: str - call_locator, # type: CallLocator - participant, # type: CommunicationIdentifier - use_managed_identity = False # type: bool - ): - - calling_server_client = _mock_utils_async.create_mock_calling_server_client( - status_code=200, - payload=None, - use_managed_identity=use_managed_identity - ) - - await calling_server_client.resume_participant_meeting_audio( - call_locator, - participant - ) - -@parameterized.expand(CallingServerUnitTestUtils.data_source_test_resume_participant_meeting_audio_with_callLocator()) -@pytest.mark.asyncio -async def test_resume_participant_meeting_audio_failed( - test_name, # type: str - call_locator, # type: CallLocator - participant, # type: CommunicationIdentifier - use_managed_identity = False # type: bool - ): - - calling_server_client = _mock_utils_async.create_mock_calling_server_client( - status_code=404, - payload=_test_constants.ErrorPayload, - use_managed_identity = use_managed_identity - ) - - raised = False - try: - await calling_server_client.resume_participant_meeting_audio( - call_locator, - participant - ) - except: - raised = True - assert raised == True diff --git a/sdk/communication/azure-communication-callingserver/tests/test_live_call_connection.py b/sdk/communication/azure-communication-callingserver/tests/test_live_call_connection.py index 8f637a51751f..a7f59db63ca5 100644 --- a/sdk/communication/azure-communication-callingserver/tests/test_live_call_connection.py +++ b/sdk/communication/azure-communication-callingserver/tests/test_live_call_connection.py @@ -10,9 +10,7 @@ from azure.communication.callingserver import ( CallingServerClient, - PlayAudioOptions, PhoneNumberIdentifier, - CreateCallOptions, CallMediaType, CallingEventSubscriptionType, CommunicationUserIdentifier @@ -65,19 +63,14 @@ def setUp(self): ) def test_create_play_cancel_hangup_scenario(self): - # create call option - options = CreateCallOptions( - callback_uri=CONST.AppCallbackUrl, - requested_media_types=[CallMediaType.AUDIO], - requested_call_events=[CallingEventSubscriptionType.PARTICIPANTS_UPDATED, CallingEventSubscriptionType.TONE_RECEIVED] - ) - options.alternate_Caller_Id = PhoneNumberIdentifier(self.from_phone_number) - - # Establish a call + # create call option and establish a call call_connection = self.callingserver_client.create_call_connection( source=CommunicationUserIdentifier(self.from_user), targets=[PhoneNumberIdentifier(self.to_phone_number)], - options=options + callback_uri=CONST.AppCallbackUrl, + requested_media_types=[CallMediaType.AUDIO], + requested_call_events=[CallingEventSubscriptionType.PARTICIPANTS_UPDATED, CallingEventSubscriptionType.TONE_RECEIVED], + alternate_Caller_Id = PhoneNumberIdentifier(self.from_phone_number) ) CallingServerLiveTestUtils.validate_callconnection(call_connection) @@ -87,16 +80,13 @@ def test_create_play_cancel_hangup_scenario(self): CallingServerLiveTestUtils.sleep_if_in_live_mode() OperationContext = str(uuid.uuid4()) AudioFileId = str(uuid.uuid4()) - options = PlayAudioOptions( - loop = True, + play_audio_result = call_connection.play_audio( + CONST.AudioFileUrl, + is_looped = True, audio_file_id = AudioFileId, callback_uri = CONST.AppCallbackUrl, operation_context = OperationContext ) - play_audio_result = call_connection.play_audio( - CONST.AudioFileUrl, - options - ) CallingServerLiveTestUtils.validate_play_audio_result(play_audio_result) # Cancel All Media Operations @@ -108,19 +98,14 @@ def test_create_play_cancel_hangup_scenario(self): call_connection.hang_up() def test_create_add_remove_hangup_scenario(self): - # create option - options = CreateCallOptions( - callback_uri=CONST.AppCallbackUrl, - requested_media_types=[CallMediaType.AUDIO], - requested_call_events=[CallingEventSubscriptionType.PARTICIPANTS_UPDATED, CallingEventSubscriptionType.TONE_RECEIVED] - ) - options.alternate_Caller_Id = PhoneNumberIdentifier(self.from_phone_number) - - # Establish a call + # create option and establish a call call_connection = self.callingserver_client.create_call_connection( source=CommunicationUserIdentifier(self.from_user), targets=[PhoneNumberIdentifier(self.to_phone_number)], - options=options, + callback_uri=CONST.AppCallbackUrl, + requested_media_types=[CallMediaType.AUDIO], + requested_call_events=[CallingEventSubscriptionType.PARTICIPANTS_UPDATED, CallingEventSubscriptionType.TONE_RECEIVED], + alternate_Caller_Id = PhoneNumberIdentifier(self.from_phone_number) ) CallingServerLiveTestUtils.validate_callconnection(call_connection) diff --git a/sdk/communication/azure-communication-callingserver/tests/test_live_call_connection_async.py b/sdk/communication/azure-communication-callingserver/tests/test_live_call_connection_async.py index 5f9d9ed1a0a1..b517434f37c2 100644 --- a/sdk/communication/azure-communication-callingserver/tests/test_live_call_connection_async.py +++ b/sdk/communication/azure-communication-callingserver/tests/test_live_call_connection_async.py @@ -10,9 +10,7 @@ from azure.communication.callingserver.aio import CallingServerClient from azure.communication.callingserver import ( - PlayAudioOptions, PhoneNumberIdentifier, - CreateCallOptions, CallMediaType, CallingEventSubscriptionType, CommunicationUserIdentifier @@ -66,20 +64,15 @@ def setUp(self): @AsyncCommunicationTestCase.await_prepared_test async def test_create_play_cancel_hangup_scenario_async(self): - # create call option - options = CreateCallOptions( - callback_uri=CONST.AppCallbackUrl, - requested_media_types=[CallMediaType.AUDIO], - requested_call_events=[CallingEventSubscriptionType.PARTICIPANTS_UPDATED, CallingEventSubscriptionType.TONE_RECEIVED] - ) - options.alternate_Caller_Id = PhoneNumberIdentifier(self.from_phone_number) - - # Establish a call + # create call option and establish a call async with self.callingserver_client: call_connection_async = await self.callingserver_client.create_call_connection( source=CommunicationUserIdentifier(self.from_user), targets=[PhoneNumberIdentifier(self.to_phone_number)], - options=options + callback_uri=CONST.AppCallbackUrl, + requested_media_types=[CallMediaType.AUDIO], + requested_call_events=[CallingEventSubscriptionType.PARTICIPANTS_UPDATED, CallingEventSubscriptionType.TONE_RECEIVED], + alternate_Caller_Id = PhoneNumberIdentifier(self.from_phone_number) ) CallingServerLiveTestUtilsAsync.validate_callconnection_Async(call_connection_async) @@ -89,16 +82,13 @@ async def test_create_play_cancel_hangup_scenario_async(self): CallingServerLiveTestUtils.sleep_if_in_live_mode() OperationContext = str(uuid.uuid4()) AudioFileId = str(uuid.uuid4()) - options = PlayAudioOptions( - loop = True, + play_audio_result = await call_connection_async.play_audio( + CONST.AudioFileUrl, + is_looped = True, audio_file_id = AudioFileId, callback_uri = CONST.AppCallbackUrl, operation_context = OperationContext ) - play_audio_result = await call_connection_async.play_audio( - CONST.AudioFileUrl, - options - ) CallingServerLiveTestUtils.validate_play_audio_result(play_audio_result) # Cancel All Media Operations @@ -111,20 +101,15 @@ async def test_create_play_cancel_hangup_scenario_async(self): @AsyncCommunicationTestCase.await_prepared_test async def test_create_add_remove_hangup_scenario_async(self): - # create call option - options = CreateCallOptions( - callback_uri=CONST.AppCallbackUrl, - requested_media_types=[CallMediaType.AUDIO], - requested_call_events=[CallingEventSubscriptionType.PARTICIPANTS_UPDATED, CallingEventSubscriptionType.TONE_RECEIVED] - ) - options.alternate_Caller_Id = PhoneNumberIdentifier(self.from_phone_number) - - # Establish a call + # create call option and establish a call async with self.callingserver_client: call_connection_async = await self.callingserver_client.create_call_connection( source=CommunicationUserIdentifier(self.from_user), targets=[PhoneNumberIdentifier(self.to_phone_number)], - options=options + callback_uri=CONST.AppCallbackUrl, + requested_media_types=[CallMediaType.AUDIO], + requested_call_events=[CallingEventSubscriptionType.PARTICIPANTS_UPDATED, CallingEventSubscriptionType.TONE_RECEIVED], + alternate_Caller_Id = PhoneNumberIdentifier(self.from_phone_number) ) CallingServerLiveTestUtils.validate_callconnection(call_connection_async) diff --git a/sdk/communication/azure-communication-callingserver/tests/test_live_server_call.py b/sdk/communication/azure-communication-callingserver/tests/test_live_server_call.py index 9b5c08657576..fb85fdc6d68e 100644 --- a/sdk/communication/azure-communication-callingserver/tests/test_live_server_call.py +++ b/sdk/communication/azure-communication-callingserver/tests/test_live_server_call.py @@ -8,7 +8,6 @@ import utils._test_constants as CONST from azure.communication.callingserver import ( CallingServerClient, - PlayAudioOptions, CommunicationUserIdentifier, GroupCallLocator ) @@ -84,16 +83,14 @@ def test_join_play_cancel_hangup_scenario(self): # Play Audio CallingServerLiveTestUtils.sleep_if_in_live_mode() OperationContext = str(uuid.uuid4()) - options = PlayAudioOptions( - loop = True, - audio_file_id = str(uuid.uuid4()), - callback_uri = CONST.AppCallbackUrl, - operation_context = OperationContext - ) + play_audio_result = self.callingserver_client.play_audio( GroupCallLocator(group_id), CONST.AudioFileUrl, - options + is_looped = True, + audio_file_id = str(uuid.uuid4()), + callback_uri = CONST.AppCallbackUrl, + operation_context = OperationContext ) CallingServerLiveTestUtils.validate_play_audio_result(play_audio_result) diff --git a/sdk/communication/azure-communication-callingserver/tests/test_live_server_call_async.py b/sdk/communication/azure-communication-callingserver/tests/test_live_server_call_async.py index 78a36ae4c015..54987716fc07 100644 --- a/sdk/communication/azure-communication-callingserver/tests/test_live_server_call_async.py +++ b/sdk/communication/azure-communication-callingserver/tests/test_live_server_call_async.py @@ -9,7 +9,6 @@ import utils._test_constants as CONST from azure.communication.callingserver.aio import CallingServerClient from azure.communication.callingserver import ( - PlayAudioOptions, CommunicationUserIdentifier, GroupCallLocator ) @@ -86,16 +85,14 @@ async def test_join_play_cancel_hangup_scenario_async(self): # Play Audio CallingServerLiveTestUtils.sleep_if_in_live_mode() OperationContext = str(uuid.uuid4()) - options = PlayAudioOptions( - loop = True, - audio_file_id = str(uuid.uuid4()), - callback_uri = CONST.AppCallbackUrl, - operation_context = OperationContext - ) + play_audio_result = await self.callingserver_client.play_audio( GroupCallLocator(group_id), CONST.AudioFileUrl, - options + is_looped = True, + audio_file_id = str(uuid.uuid4()), + callback_uri = CONST.AppCallbackUrl, + operation_context = OperationContext ) CallingServerLiveTestUtils.validate_play_audio_result(play_audio_result) diff --git a/sdk/communication/azure-communication-callingserver/tests/utils/_live_test_utils.py b/sdk/communication/azure-communication-callingserver/tests/utils/_live_test_utils.py index bce4781df567..940c9644117a 100644 --- a/sdk/communication/azure-communication-callingserver/tests/utils/_live_test_utils.py +++ b/sdk/communication/azure-communication-callingserver/tests/utils/_live_test_utils.py @@ -13,7 +13,6 @@ from azure.communication.identity import CommunicationIdentityClient from azure.communication.callingserver import ( CommunicationUserIdentifier, - CreateCallOptions, CallingServerClient, CallConnection, PlayAudioResult, @@ -22,7 +21,6 @@ CallingOperationStatus, CallMediaType, CallingEventSubscriptionType, - ServerCallLocator, GroupCallLocator ) @@ -106,22 +104,24 @@ def create_group_calls( to_call_connection = None try: # join from_participant to Server Call - from_options = CreateCallOptions( + from_call_connection = callingserver_client.join_call( + GroupCallLocator(group_id), + from_participant, callback_uri=call_back_uri, requested_media_types=[CallMediaType.AUDIO], requested_call_events=[CallingEventSubscriptionType.PARTICIPANTS_UPDATED] - ) - from_call_connection = callingserver_client.join_call(GroupCallLocator(group_id), from_participant, from_options) + ) CallingServerLiveTestUtils.validate_callconnection(from_call_connection) CallingServerLiveTestUtils.sleep_if_in_live_mode() # join to_participant to Server Call - to_options = CreateCallOptions( + to_call_connection = callingserver_client.join_call( + GroupCallLocator(group_id), + to_participant, callback_uri=call_back_uri, requested_media_types=[CallMediaType.AUDIO], requested_call_events=[CallingEventSubscriptionType.PARTICIPANTS_UPDATED] - ) - to_call_connection = callingserver_client.join_call(GroupCallLocator(group_id), to_participant, to_options) + ) CallingServerLiveTestUtils.validate_callconnection(from_call_connection) CallingServerLiveTestUtils.sleep_if_in_live_mode() diff --git a/sdk/communication/azure-communication-callingserver/tests/utils/_live_test_utils_async.py b/sdk/communication/azure-communication-callingserver/tests/utils/_live_test_utils_async.py index daaa45fbb9d8..636920e0178a 100644 --- a/sdk/communication/azure-communication-callingserver/tests/utils/_live_test_utils_async.py +++ b/sdk/communication/azure-communication-callingserver/tests/utils/_live_test_utils_async.py @@ -7,7 +7,6 @@ from azure.communication.callingserver.aio import CallingServerClient, CallConnection from azure.communication.callingserver import ( CommunicationUserIdentifier, - CreateCallOptions, CallMediaType, CallingEventSubscriptionType, ServerCallLocator, @@ -39,22 +38,24 @@ async def create_group_calls_async( to_call_connection = None try: # join from_participant to Server Call - from_options = CreateCallOptions( + from_call_connection = await callingserver_client.join_call( + GroupCallLocator(group_id), + from_participant, callback_uri=call_back_uri, requested_media_types=[CallMediaType.AUDIO], requested_call_events=[CallingEventSubscriptionType.PARTICIPANTS_UPDATED] - ) - from_call_connection = await callingserver_client.join_call(GroupCallLocator(group_id), from_participant, from_options) + ) CallingServerLiveTestUtilsAsync.validate_callconnection_Async(from_call_connection) CallingServerLiveTestUtils.sleep_if_in_live_mode() # join to_participant to Server Call - to_options = CreateCallOptions( + to_call_connection = await callingserver_client.join_call( + GroupCallLocator(group_id), + to_participant, callback_uri=call_back_uri, requested_media_types=[CallMediaType.AUDIO], requested_call_events=[CallingEventSubscriptionType.PARTICIPANTS_UPDATED] - ) - to_call_connection = await callingserver_client.join_call(GroupCallLocator(group_id), to_participant, to_options) + ) CallingServerLiveTestUtilsAsync.validate_callconnection_Async(from_call_connection) CallingServerLiveTestUtils.sleep_if_in_live_mode() diff --git a/sdk/communication/azure-communication-callingserver/tests/utils/_test_constants.py b/sdk/communication/azure-communication-callingserver/tests/utils/_test_constants.py index c0c9f33c8967..f4512ed9872e 100644 --- a/sdk/communication/azure-communication-callingserver/tests/utils/_test_constants.py +++ b/sdk/communication/azure-communication-callingserver/tests/utils/_test_constants.py @@ -172,12 +172,17 @@ } # PlayAudioPayload -AUDIO_FILE_URI = "https://bot.contoso.io/audio/sample-message.wav" +AUDIO_URL = "https://bot.contoso.io/audio/sample-message.wav" AUDIO_FILE_ID = "sampleAudioFileId" PlayAudioResponsePayload = { "operationId": OPERATION_ID, "status": "running", - "operationContext": OPERATION_CONTEXT + "operationContext": OPERATION_CONTEXT, + "resultInfo": { + "code": 202, + "subcode": 202, + "message": "Good." + } } # AddParticipantPayload @@ -185,15 +190,27 @@ "participantId": PARTICIPANT_ID_01 } +# TransferPayload +TransferResultPayload = { + "operationId": OPERATION_ID, + "status": "completed", + "operationContext": OPERATION_CONTEXT, + "resultInfo": { + "code": 202, + "subcode": 202, + "message": "Good." + } + } + # CreateAudioRoutingGroupPayload -AUDIO_FILE_URI = "https://bot.contoso.io/audio/sample-message.wav" +AUDIO_URL = "https://bot.contoso.io/audio/sample-message.wav" AUDIO_FILE_ID = "sampleAudioFileId" CreateAudioRoutingGroupResponsePayload = { "audioRoutingGroupId": AUDIO_ROUTING_GROUP_ID, } # GetAudioRoutingGroupPayload -AUDIO_FILE_URI = "https://bot.contoso.io/audio/sample-message.wav" +AUDIO_URL = "https://bot.contoso.io/audio/sample-message.wav" AUDIO_FILE_ID = "sampleAudioFileId" GetAudioRoutingGroupResponsePayload = { "audioRoutingMode": "oneToOne", diff --git a/sdk/communication/azure-communication-callingserver/tests/utils/_unit_test_utils.py b/sdk/communication/azure-communication-callingserver/tests/utils/_unit_test_utils.py index 220715e12f75..2f62413e9044 100644 --- a/sdk/communication/azure-communication-callingserver/tests/utils/_unit_test_utils.py +++ b/sdk/communication/azure-communication-callingserver/tests/utils/_unit_test_utils.py @@ -14,11 +14,8 @@ from azure.communication.callingserver import ( AudioRoutingMode, - CreateCallOptions, CallMediaType, CallingEventSubscriptionType, - JoinCallOptions, - PlayAudioOptions, PlayAudioResult, AddParticipantResult, CallConnectionProperties, @@ -31,33 +28,31 @@ AudioRoutingGroupResult, CreateAudioRoutingGroupResult, CallRejectReason, - CallParticipant + CallParticipant, + TransferCallResult ) class CallingServerUnitTestUtils: @staticmethod def data_source_test_create_connection(): - options = CreateCallOptions( - callback_uri=_test_constants.CALLBACK_URI, - requested_media_types=[CallMediaType.AUDIO], - requested_call_events=[CallingEventSubscriptionType.PARTICIPANTS_UPDATED]) - options.subject=_test_constants.CALL_SUBJECT - options.alternate_Caller_Id = PhoneNumberIdentifier(_test_constants.PHONE_NUMBER) - parameters = [] parameters.append(( _test_constants.ClientType_ConnectionString, CommunicationUserIdentifier(_test_constants.RESOURCE_SOURCE), [CommunicationUserIdentifier(_test_constants.RESOURCE_TARGET), PhoneNumberIdentifier(_test_constants.PHONE_NUMBER)], - options, + _test_constants.CALLBACK_URI, + [CallMediaType.AUDIO], + [CallingEventSubscriptionType.PARTICIPANTS_UPDATED], )) parameters.append(( _test_constants.ClientType_ManagedIdentity, CommunicationUserIdentifier(_test_constants.RESOURCE_SOURCE), [CommunicationUserIdentifier(_test_constants.RESOURCE_TARGET), PhoneNumberIdentifier(_test_constants.PHONE_NUMBER)], - options, + _test_constants.CALLBACK_URI, + [CallMediaType.AUDIO], + [CallingEventSubscriptionType.PARTICIPANTS_UPDATED], True, )) @@ -65,25 +60,23 @@ def data_source_test_create_connection(): @staticmethod def data_source_test_join_call(): - options = JoinCallOptions( - callback_uri=_test_constants.CALLBACK_URI, - requested_media_types=[CallMediaType.AUDIO], - requested_call_events=[CallingEventSubscriptionType.PARTICIPANTS_UPDATED]) - options.subject=_test_constants.CALL_SUBJECT - parameters = [] parameters.append(( _test_constants.ClientType_ConnectionString, ServerCallLocator(_test_constants.SEVERCALL_ID), CommunicationUserIdentifier(_test_constants.RESOURCE_SOURCE), - options, + _test_constants.CALLBACK_URI, + [CallMediaType.AUDIO], + [CallingEventSubscriptionType.PARTICIPANTS_UPDATED], )) parameters.append(( _test_constants.ClientType_ManagedIdentity, ServerCallLocator(_test_constants.SEVERCALL_ID), CommunicationUserIdentifier(_test_constants.RESOURCE_SOURCE), - options, + _test_constants.CALLBACK_URI, + [CallMediaType.AUDIO], + [CallingEventSubscriptionType.PARTICIPANTS_UPDATED], True, )) @@ -91,14 +84,18 @@ def data_source_test_join_call(): _test_constants.ClientType_ConnectionString, GroupCallLocator(_test_constants.GROUPCALL_ID), CommunicationUserIdentifier(_test_constants.RESOURCE_SOURCE), - options, + _test_constants.CALLBACK_URI, + [CallMediaType.AUDIO], + [CallingEventSubscriptionType.PARTICIPANTS_UPDATED], )) parameters.append(( _test_constants.ClientType_ManagedIdentity, GroupCallLocator(_test_constants.GROUPCALL_ID), CommunicationUserIdentifier(_test_constants.RESOURCE_SOURCE), - options, + _test_constants.CALLBACK_URI, + [CallMediaType.AUDIO], + [CallingEventSubscriptionType.PARTICIPANTS_UPDATED], True, )) @@ -171,41 +168,46 @@ def data_source_test_redirect_call(): @staticmethod def data_source_test_play_audio(): - options = PlayAudioOptions( - loop = True, - audio_file_id=_test_constants.AUDIO_FILE_ID, - callback_uri=_test_constants.CALLBACK_URI, - operation_context=_test_constants.OPERATION_CONTEXT - ) - parameters = [] parameters.append(( _test_constants.ClientType_ConnectionString, ServerCallLocator(_test_constants.SEVERCALL_ID), - _test_constants.AUDIO_FILE_URI, - options, + _test_constants.AUDIO_URL, + True, + _test_constants.AUDIO_FILE_ID, + _test_constants.CALLBACK_URI, + _test_constants.OPERATION_CONTEXT, )) parameters.append(( _test_constants.ClientType_ManagedIdentity, ServerCallLocator(_test_constants.SEVERCALL_ID), - _test_constants.AUDIO_FILE_URI, - options, + _test_constants.AUDIO_URL, + True, + _test_constants.AUDIO_FILE_ID, + _test_constants.CALLBACK_URI, + _test_constants.OPERATION_CONTEXT, True, )) parameters.append(( _test_constants.ClientType_ConnectionString, GroupCallLocator(_test_constants.GROUPCALL_ID), - _test_constants.AUDIO_FILE_URI, - options, + _test_constants.AUDIO_URL, + True, + _test_constants.AUDIO_FILE_ID, + _test_constants.CALLBACK_URI, + _test_constants.OPERATION_CONTEXT, )) parameters.append(( _test_constants.ClientType_ManagedIdentity, GroupCallLocator(_test_constants.GROUPCALL_ID), - _test_constants.AUDIO_FILE_URI, - options, + _test_constants.AUDIO_URL, + True, + _test_constants.AUDIO_FILE_ID, + _test_constants.CALLBACK_URI, + _test_constants.OPERATION_CONTEXT, True, )) @@ -213,28 +215,27 @@ def data_source_test_play_audio(): @staticmethod def data_source_test_play_audio_to_participant(): - play_audio_options = PlayAudioOptions( - loop = True, - audio_file_id = _test_constants.AUDIO_FILE_ID, - callback_uri = _test_constants.CALLBACK_URI, - operation_context = _test_constants.OPERATION_CONTEXT - ) - parameters = [] parameters.append(( _test_constants.ClientType_ConnectionString, ServerCallLocator(_test_constants.SEVERCALL_ID), CommunicationUserIdentifier(_test_constants.RESOURCE_SOURCE), - _test_constants.AUDIO_FILE_URI, - play_audio_options, + _test_constants.AUDIO_URL, + True, + _test_constants.AUDIO_FILE_ID, + _test_constants.CALLBACK_URI, + _test_constants.OPERATION_CONTEXT, )) parameters.append(( _test_constants.ClientType_ManagedIdentity, ServerCallLocator(_test_constants.SEVERCALL_ID), CommunicationUserIdentifier(_test_constants.RESOURCE_SOURCE), - _test_constants.AUDIO_FILE_URI, - play_audio_options, + _test_constants.AUDIO_URL, + True, + _test_constants.AUDIO_FILE_ID, + _test_constants.CALLBACK_URI, + _test_constants.OPERATION_CONTEXT, True, )) @@ -242,16 +243,22 @@ def data_source_test_play_audio_to_participant(): _test_constants.ClientType_ConnectionString, GroupCallLocator(_test_constants.GROUPCALL_ID), CommunicationUserIdentifier(_test_constants.RESOURCE_SOURCE), - _test_constants.AUDIO_FILE_URI, - play_audio_options, + _test_constants.AUDIO_URL, + True, + _test_constants.AUDIO_FILE_ID, + _test_constants.CALLBACK_URI, + _test_constants.OPERATION_CONTEXT, )) parameters.append(( _test_constants.ClientType_ManagedIdentity, GroupCallLocator(_test_constants.GROUPCALL_ID), CommunicationUserIdentifier(_test_constants.RESOURCE_SOURCE), - _test_constants.AUDIO_FILE_URI, - play_audio_options, + _test_constants.AUDIO_URL, + True, + _test_constants.AUDIO_FILE_ID, + _test_constants.CALLBACK_URI, + _test_constants.OPERATION_CONTEXT, True, )) @@ -332,7 +339,7 @@ def data_source_test_remove_participant_with_call_locator(): return parameters @staticmethod - def data_source_test_get_participants_with_call_locator(): + def data_source_test_list_participants_with_call_locator(): parameters = [] parameters.append(( _test_constants.ClientType_ConnectionString, @@ -389,68 +396,6 @@ def data_source_test_get_participant_with_call_locator(): return parameters - @staticmethod - def data_source_test_mute_participant_with_call_locator(): - parameters = [] - parameters.append(( - _test_constants.ClientType_ConnectionString, - ServerCallLocator(_test_constants.SEVERCALL_ID), - CommunicationUserIdentifier(_test_constants.COMMUNICATION_USER_Id_01), - )) - - parameters.append(( - _test_constants.ClientType_ManagedIdentity, - ServerCallLocator(_test_constants.SEVERCALL_ID), - CommunicationUserIdentifier(_test_constants.COMMUNICATION_USER_Id_01), - True, - )) - - parameters.append(( - _test_constants.ClientType_ConnectionString, - GroupCallLocator(_test_constants.GROUPCALL_ID), - CommunicationUserIdentifier(_test_constants.COMMUNICATION_USER_Id_01), - )) - - parameters.append(( - _test_constants.ClientType_ManagedIdentity, - GroupCallLocator(_test_constants.GROUPCALL_ID), - CommunicationUserIdentifier(_test_constants.COMMUNICATION_USER_Id_01), - True, - )) - - return parameters - - @staticmethod - def data_source_test_unmute_participant_with_call_locator(): - parameters = [] - parameters.append(( - _test_constants.ClientType_ConnectionString, - ServerCallLocator(_test_constants.SEVERCALL_ID), - CommunicationUserIdentifier(_test_constants.COMMUNICATION_USER_Id_01), - )) - - parameters.append(( - _test_constants.ClientType_ManagedIdentity, - ServerCallLocator(_test_constants.SEVERCALL_ID), - CommunicationUserIdentifier(_test_constants.COMMUNICATION_USER_Id_01), - True, - )) - - parameters.append(( - _test_constants.ClientType_ConnectionString, - GroupCallLocator(_test_constants.GROUPCALL_ID), - CommunicationUserIdentifier(_test_constants.COMMUNICATION_USER_Id_01), - )) - - parameters.append(( - _test_constants.ClientType_ManagedIdentity, - GroupCallLocator(_test_constants.GROUPCALL_ID), - CommunicationUserIdentifier(_test_constants.COMMUNICATION_USER_Id_01), - True, - )) - - return parameters - @staticmethod def data_source_test_cancel_media_operation(): @@ -518,74 +463,10 @@ def data_source_test_cancel_participant_media_operation_with_callLocator(): return parameters - @staticmethod - def data_source_test_hold_participant_meeting_audio_with_callLocator(): - - parameters = [] - parameters.append(( - _test_constants.ClientType_ConnectionString, - ServerCallLocator(_test_constants.SEVERCALL_ID), - CommunicationUserIdentifier(_test_constants.PARTICIPANT_ID_01), - )) - - parameters.append(( - _test_constants.ClientType_ManagedIdentity, - ServerCallLocator(_test_constants.SEVERCALL_ID), - CommunicationUserIdentifier(_test_constants.PARTICIPANT_ID_01), - True, - )) - - parameters.append(( - _test_constants.ClientType_ConnectionString, - GroupCallLocator(_test_constants.GROUPCALL_ID), - CommunicationUserIdentifier(_test_constants.PARTICIPANT_ID_01), - )) - - parameters.append(( - _test_constants.ClientType_ManagedIdentity, - GroupCallLocator(_test_constants.GROUPCALL_ID), - CommunicationUserIdentifier(_test_constants.PARTICIPANT_ID_01), - True, - )) - - return parameters - - @staticmethod - def data_source_test_resume_participant_meeting_audio_with_callLocator(): - - parameters = [] - parameters.append(( - _test_constants.ClientType_ConnectionString, - ServerCallLocator(_test_constants.SEVERCALL_ID), - CommunicationUserIdentifier(_test_constants.PARTICIPANT_ID_01), - )) - - parameters.append(( - _test_constants.ClientType_ManagedIdentity, - ServerCallLocator(_test_constants.SEVERCALL_ID), - CommunicationUserIdentifier(_test_constants.PARTICIPANT_ID_01), - True, - )) - - parameters.append(( - _test_constants.ClientType_ConnectionString, - GroupCallLocator(_test_constants.GROUPCALL_ID), - CommunicationUserIdentifier(_test_constants.PARTICIPANT_ID_01), - )) - - parameters.append(( - _test_constants.ClientType_ManagedIdentity, - GroupCallLocator(_test_constants.GROUPCALL_ID), - CommunicationUserIdentifier(_test_constants.PARTICIPANT_ID_01), - True, - )) - - return parameters - @staticmethod def verify_play_audio_result(result): # type: (PlayAudioResult) -> None - assert "dummyId" == result.operation_id + assert _test_constants.OPERATION_ID == result.operation_id assert CallingOperationStatus.RUNNING == result.status assert _test_constants.OPERATION_CONTEXT == result.operation_context @@ -600,7 +481,7 @@ def verify_answer_call_result(result): assert result.call_connection_id == _test_constants.CALL_ID @staticmethod - def verify_get_participants_result(result): + def verify_list_participants_result(result): # type: (List[CallParticipant]) -> None target_identifier_01 = deserialize_identifier(result[0].identifier) assert _test_constants.COMMUNICATION_USER_Id_01 == target_identifier_01.properties['id'] @@ -711,25 +592,25 @@ def data_source_test_cancel_all_media_operations(): @staticmethod def data_source_test_play_audio(): - options = PlayAudioOptions( - loop = True, - audio_file_id = _test_constants.AUDIO_FILE_ID, - callback_uri = _test_constants.CALLBACK_URI, - operation_context = _test_constants.OPERATION_CONTEXT - ) parameters = [] parameters.append(( _test_constants.ClientType_ConnectionString, _test_constants.CALL_ID, - _test_constants.AUDIO_FILE_URI, - options, + _test_constants.AUDIO_URL, + True, + _test_constants.AUDIO_FILE_ID, + _test_constants.CALLBACK_URI, + _test_constants.OPERATION_CONTEXT )) parameters.append(( _test_constants.ClientType_ManagedIdentity, _test_constants.CALL_ID, - _test_constants.AUDIO_FILE_URI, - options, + _test_constants.AUDIO_URL, + True, + _test_constants.AUDIO_FILE_ID, + _test_constants.CALLBACK_URI, + _test_constants.OPERATION_CONTEXT, True, )) @@ -737,27 +618,27 @@ def data_source_test_play_audio(): @staticmethod def data_source_test_play_audio_to_participant(): - options = PlayAudioOptions( - loop = True, - audio_file_id = _test_constants.AUDIO_FILE_ID, - callback_uri = _test_constants.CALLBACK_URI, - operation_context = _test_constants.OPERATION_CONTEXT - ) parameters = [] parameters.append(( _test_constants.ClientType_ConnectionString, _test_constants.CALL_ID, CommunicationUserIdentifier(_test_constants.RESOURCE_SOURCE), - _test_constants.AUDIO_FILE_URI, - options, + _test_constants.AUDIO_URL, + True, + _test_constants.AUDIO_FILE_ID, + _test_constants.CALLBACK_URI, + _test_constants.OPERATION_CONTEXT )) parameters.append(( _test_constants.ClientType_ManagedIdentity, _test_constants.CALL_ID, CommunicationUserIdentifier(_test_constants.RESOURCE_SOURCE), - _test_constants.AUDIO_FILE_URI, - options, + _test_constants.AUDIO_URL, + True, + _test_constants.AUDIO_FILE_ID, + _test_constants.CALLBACK_URI, + _test_constants.OPERATION_CONTEXT, True, )) @@ -786,16 +667,16 @@ def data_source_test_add_participant(): return parameters @staticmethod - def data_source_test_transfer_call(): + def data_source_test_transfer(): parameters = [] parameters.append(( _test_constants.ClientType_ConnectionString, _test_constants.CALL_ID, CommunicationUserIdentifier(_test_constants.RESOURCE_SOURCE), _test_constants.SERVER_CALL_ID, + _test_constants.COMMUNICATION_USER_Id_02, _test_constants.USER_TO_USER_INFORMATION, _test_constants.OPERATION_CONTEXT, - _test_constants.CALLBACK_URI )) parameters.append(( @@ -803,9 +684,9 @@ def data_source_test_transfer_call(): _test_constants.CALL_ID, CommunicationUserIdentifier(_test_constants.RESOURCE_SOURCE), _test_constants.SERVER_CALL_ID, + _test_constants.COMMUNICATION_USER_Id_02, _test_constants.USER_TO_USER_INFORMATION, _test_constants.OPERATION_CONTEXT, - _test_constants.CALLBACK_URI, True, )) @@ -830,7 +711,7 @@ def data_source_test_remove_participant(): return parameters @staticmethod - def data_source_test_get_participants(): + def data_source_test_list_participants(): parameters = [] parameters.append(( _test_constants.ClientType_ConnectionString, @@ -976,7 +857,7 @@ def data_source_test_create_audio_routing_group(): return parameters @staticmethod - def data_source_test_get_audio_routing_group(): + def data_source_test_list_audio_routing_groups(): parameters = [] parameters.append(( _test_constants.ClientType_ConnectionString, @@ -1080,4 +961,11 @@ def verify_get_audio_routing_group(result): target_identifier_01 = deserialize_identifier(result.targets[0]) assert result.audio_routing_mode == AudioRoutingMode.ONE_TO_ONE assert _test_constants.RESOURCE_SOURCE == target_identifier_01.properties['id'] - assert _test_constants.COMMUNICATION_USER_KIND == target_identifier_01.kind \ No newline at end of file + assert _test_constants.COMMUNICATION_USER_KIND == target_identifier_01.kind + + @staticmethod + def verify_transfer_result(result): + # type: (TransferCallResult) -> None + assert _test_constants.OPERATION_ID == result.operation_id + assert CallingOperationStatus.COMPLETED == result.status + assert _test_constants.OPERATION_CONTEXT == result.operation_context \ No newline at end of file