From b9e0b1725aee9ce674792ed41291f107d23c7fae Mon Sep 17 00:00:00 2001 From: amariwest-msft <139818906+amariwest-msft@users.noreply.github.com> Date: Fri, 21 Jun 2024 17:32:42 -0500 Subject: [PATCH] Move CallAutomation GA3 Changes to ALPHA3 (#35650) * init commit * swagger generation * added RecordingStorageKind * changed CHANGELOG * removed unused import * fixed callautomation linter issues * fixed jobrouter and phonenumber linting issues --- .../CHANGELOG.md | 2 +- .../communication/callautomation/__init__.py | 4 +- .../callautomation/_api_versions.py | 1 + .../callautomation/_call_automation_client.py | 10 +- .../callautomation/_generated/_patch.py | 2 + .../_generated/_serialization.py | 2 +- .../callautomation/_generated/aio/_patch.py | 2 + .../_generated/aio/operations/_operations.py | 332 ++++++++-- .../_generated/aio/operations/_patch.py | 2 + .../_generated/models/__init__.py | 30 +- .../_generated/models/_enums.py | 55 +- .../_generated/models/_models.py | 586 +++++++++++------- .../_generated/models/_patch.py | 2 + .../_generated/operations/_operations.py | 388 ++++++++++-- .../_generated/operations/_patch.py | 2 + .../communication/callautomation/_models.py | 36 ++ .../aio/_call_automation_client_async.py | 10 +- .../swagger/SWAGGER.md | 4 +- 18 files changed, 1117 insertions(+), 353 deletions(-) diff --git a/sdk/communication/azure-communication-callautomation/CHANGELOG.md b/sdk/communication/azure-communication-callautomation/CHANGELOG.md index 8f8b21f30b4..5ad5be4a680 100644 --- a/sdk/communication/azure-communication-callautomation/CHANGELOG.md +++ b/sdk/communication/azure-communication-callautomation/CHANGELOG.md @@ -58,4 +58,4 @@ Call Automation enables developers to build call workflows. Personalise customer [Overview]: https://learn.microsoft.com/azure/communication-services/concepts/voice-video-calling/call-automation [Demo Video]: https://ignite.microsoft.com/sessions/14a36f87-d1a2-4882-92a7-70f2c16a306a [Incoming Call Concept]: https://learn.microsoft.com/azure/communication-services/concepts/voice-video-calling/incoming-call-notification -[Build a customer interaction workflow using Call Automation]: https://learn.microsoft.com/azure/communication-services/quickstarts/voice-video-calling/callflows-for-customer-interactions +[Build a customer interaction workflow using Call Automation]: https://learn.microsoft.com/azure/communication-services/quickstarts/voice-video-calling/callflows-for-customer-interactions \ No newline at end of file diff --git a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/__init__.py b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/__init__.py index 0aafd11b081..ff7def54d0c 100644 --- a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/__init__.py +++ b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/__init__.py @@ -42,7 +42,7 @@ from ._generated.models._enums import ( RecordingContent, RecordingChannel, RecordingFormat, - RecordingStorage, + RecordingStorageKind, RecognizeInputType, MediaStreamingAudioChannelType, MediaStreamingContentType, @@ -105,7 +105,7 @@ __all__ = [ "RecordingContent", "RecordingChannel", "RecordingFormat", - "RecordingStorage", + "RecordingStorageKind", "RecognizeInputType", "MediaStreamingAudioChannelType", "MediaStreamingContentType", diff --git a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_api_versions.py b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_api_versions.py index 42e71d46da6..afbb208318c 100644 --- a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_api_versions.py +++ b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_api_versions.py @@ -11,5 +11,6 @@ class ApiVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): V2023_06_15_PREVIEW = "2023-06-15-preview" V2023_10_15 = "2023-10-15" V2023_10_03_PREVIEW = "2023-10-03-preview" + V2024_04_15 = "2024-04-15" DEFAULT_VERSION = ApiVersion.V2023_10_03_PREVIEW.value diff --git a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_call_automation_client.py b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_call_automation_client.py index f73f2c4bb6c..ca9dced86de 100644 --- a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_call_automation_client.py +++ b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_call_automation_client.py @@ -61,7 +61,7 @@ if TYPE_CHECKING: RecordingContent, RecordingChannel, RecordingFormat, - RecordingStorage + RecordingStorageKind ) @@ -453,7 +453,7 @@ class CallAutomationClient: recording_format_type: Optional[Union[str, 'RecordingFormat']] = None, audio_channel_participant_ordering: Optional[List['CommunicationIdentifier']] = None, channel_affinity: Optional[List['ChannelAffinity']] = None, - recording_storage_type: Optional[Union[str, 'RecordingStorage']] = None, + recording_storage_kind: Optional[Union[str, 'RecordingStorageKind']] = None, external_storage_location: Optional[str] = None, pause_on_start: Optional[bool] = None, **kwargs @@ -486,7 +486,7 @@ class CallAutomationClient: ``External`` enables bring your own storage. :paramtype recording_storage_type: str or None :keyword external_storage_location: The location where recording is stored, - when RecordingStorageType is set to 'BlobStorage'. + when RecordingStorageKind is set to 'AzureBlobStorage'. :paramtype external_storage_location: str or ~azure.communication.callautomation.RecordingStorage or None :keyword pause_on_start: The state of the pause on start option. :paramtype pause_on_start: bool or None @@ -506,7 +506,7 @@ class CallAutomationClient: recording_format_type: Optional[Union[str, 'RecordingFormat']] = None, audio_channel_participant_ordering: Optional[List['CommunicationIdentifier']] = None, channel_affinity: Optional[List['ChannelAffinity']] = None, - recording_storage_type: Optional[Union[str, 'RecordingStorage']] = None, + recording_storage_kind: Optional[Union[str, 'RecordingStorageKind']] = None, external_storage_location: Optional[str] = None, pause_on_start: Optional[bool] = None, **kwargs @@ -539,7 +539,7 @@ class CallAutomationClient: ``External`` enables bring your own storage. :paramtype recording_storage_type: str or None :keyword external_storage_location: The location where recording is stored, - when RecordingStorageType is set to 'BlobStorage'. + when RecordingStorageKind is set to 'AzureBlobStorage'. :paramtype external_storage_location: str or ~azure.communication.callautomation.RecordingStorage or None :keyword pause_on_start: The state of the pause on start option. :paramtype pause_on_start: bool or None diff --git a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/_patch.py b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/_patch.py index f7dd3251033..5755fd181b3 100644 --- a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/_patch.py +++ b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/_patch.py @@ -2,6 +2,8 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ + + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/_serialization.py b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/_serialization.py index 2f781d74082..f0c6180722c 100644 --- a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/_serialization.py +++ b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/_serialization.py @@ -1441,7 +1441,7 @@ class Deserializer(object): elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: attributes = response._attribute_map # type: ignore diff --git a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/aio/_patch.py b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/aio/_patch.py index f7dd3251033..5755fd181b3 100644 --- a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/aio/_patch.py +++ b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/aio/_patch.py @@ -2,6 +2,8 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ + + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/aio/operations/_operations.py b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/aio/operations/_operations.py index a4ea3ac5aed..0dbf85352d4 100644 --- a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/aio/operations/_operations.py +++ b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/aio/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -52,9 +53,11 @@ from ...operations._operations import ( build_call_media_send_dtmf_tones_request, build_call_media_start_continuous_dtmf_recognition_request, build_call_media_start_hold_music_request, + build_call_media_start_media_streaming_request, build_call_media_start_transcription_request, build_call_media_stop_continuous_dtmf_recognition_request, build_call_media_stop_hold_music_request, + build_call_media_stop_media_streaming_request, build_call_media_stop_transcription_request, build_call_media_unhold_request, build_call_media_update_transcription_request, @@ -66,6 +69,10 @@ from ...operations._operations import ( ) from .._vendor import AzureCommunicationCallAutomationServiceMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,6 +80,7 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T class AzureCommunicationCallAutomationServiceOperationsMixin( # pylint: disable=name-too-long AzureCommunicationCallAutomationServiceMixinABC ): + @overload async def create_call( self, create_call_request: _models.CreateCallRequest, *, content_type: str = "application/json", **kwargs: Any @@ -125,7 +133,7 @@ class AzureCommunicationCallAutomationServiceOperationsMixin( # pylint: disable :rtype: ~azure.communication.callautomation.models.CallConnectionProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -233,7 +241,7 @@ class AzureCommunicationCallAutomationServiceOperationsMixin( # pylint: disable :rtype: ~azure.communication.callautomation.models.CallConnectionProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -345,7 +353,7 @@ class AzureCommunicationCallAutomationServiceOperationsMixin( # pylint: disable :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -449,7 +457,7 @@ class AzureCommunicationCallAutomationServiceOperationsMixin( # pylint: disable :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -533,7 +541,7 @@ class CallConnectionOperations: :rtype: ~azure.communication.callautomation.models.CallConnectionProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -594,7 +602,7 @@ class CallConnectionOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -649,7 +657,7 @@ class CallConnectionOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -762,7 +770,7 @@ class CallConnectionOperations: :rtype: ~azure.communication.callautomation.models.TransferCallResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -839,7 +847,7 @@ class CallConnectionOperations: "cls", None ) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -985,7 +993,7 @@ class CallConnectionOperations: :rtype: ~azure.communication.callautomation.models.AddParticipantResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1114,7 +1122,7 @@ class CallConnectionOperations: :rtype: ~azure.communication.callautomation.models.RemoveParticipantResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1243,7 +1251,7 @@ class CallConnectionOperations: :rtype: ~azure.communication.callautomation.models.MuteParticipantsResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1372,7 +1380,7 @@ class CallConnectionOperations: :rtype: ~azure.communication.callautomation.models.UnmuteParticipantsResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1501,7 +1509,7 @@ class CallConnectionOperations: :rtype: ~azure.communication.callautomation.models.CancelAddParticipantResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1574,7 +1582,7 @@ class CallConnectionOperations: :rtype: ~azure.communication.callautomation.models.CallParticipant :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1702,7 +1710,7 @@ class CallMediaOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1827,7 +1835,7 @@ class CallMediaOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1952,7 +1960,7 @@ class CallMediaOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2019,7 +2027,7 @@ class CallMediaOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2128,7 +2136,7 @@ class CallMediaOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2253,7 +2261,7 @@ class CallMediaOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2378,7 +2386,7 @@ class CallMediaOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2502,7 +2510,7 @@ class CallMediaOperations: :rtype: ~azure.communication.callautomation.models.SendDtmfTonesResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2631,7 +2639,7 @@ class CallMediaOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2746,7 +2754,7 @@ class CallMediaOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2866,7 +2874,7 @@ class CallMediaOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2991,7 +2999,7 @@ class CallMediaOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3115,7 +3123,7 @@ class CallMediaOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3168,6 +3176,256 @@ class CallMediaOperations: if cls: return cls(pipeline_response, None, {}) # type: ignore + @overload + async def start_media_streaming( # pylint: disable=inconsistent-return-statements + self, + call_connection_id: str, + start_media_streaming_request: _models.StartMediaStreamingRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Starts media streaming in the call. + + Starts media streaming in the call. + + :param call_connection_id: The call connection id. Required. + :type call_connection_id: str + :param start_media_streaming_request: Required. + :type start_media_streaming_request: + ~azure.communication.callautomation.models.StartMediaStreamingRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def start_media_streaming( # pylint: disable=inconsistent-return-statements + self, + call_connection_id: str, + start_media_streaming_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Starts media streaming in the call. + + Starts media streaming in the call. + + :param call_connection_id: The call connection id. Required. + :type call_connection_id: str + :param start_media_streaming_request: Required. + :type start_media_streaming_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def start_media_streaming( # pylint: disable=inconsistent-return-statements + self, + call_connection_id: str, + start_media_streaming_request: Union[_models.StartMediaStreamingRequest, IO[bytes]], + **kwargs: Any + ) -> None: + """Starts media streaming in the call. + + Starts media streaming in the call. + + :param call_connection_id: The call connection id. Required. + :type call_connection_id: str + :param start_media_streaming_request: Is either a StartMediaStreamingRequest type or a + IO[bytes] type. Required. + :type start_media_streaming_request: + ~azure.communication.callautomation.models.StartMediaStreamingRequest or IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(start_media_streaming_request, (IOBase, bytes)): + _content = start_media_streaming_request + else: + _json = self._serialize.body(start_media_streaming_request, "StartMediaStreamingRequest") + + _request = build_call_media_start_media_streaming_request( + call_connection_id=call_connection_id, + content_type=content_type, + api_version=self._config.api_version, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CommunicationErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + async def stop_media_streaming( # pylint: disable=inconsistent-return-statements + self, + call_connection_id: str, + stop_media_streaming_request: _models.StopMediaStreamingRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Stops media streaming in the call. + + Stops media streaming in the call. + + :param call_connection_id: The call connection id. Required. + :type call_connection_id: str + :param stop_media_streaming_request: stop media streaming request payload. Required. + :type stop_media_streaming_request: + ~azure.communication.callautomation.models.StopMediaStreamingRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def stop_media_streaming( # pylint: disable=inconsistent-return-statements + self, + call_connection_id: str, + stop_media_streaming_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Stops media streaming in the call. + + Stops media streaming in the call. + + :param call_connection_id: The call connection id. Required. + :type call_connection_id: str + :param stop_media_streaming_request: stop media streaming request payload. Required. + :type stop_media_streaming_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def stop_media_streaming( # pylint: disable=inconsistent-return-statements + self, + call_connection_id: str, + stop_media_streaming_request: Union[_models.StopMediaStreamingRequest, IO[bytes]], + **kwargs: Any + ) -> None: + """Stops media streaming in the call. + + Stops media streaming in the call. + + :param call_connection_id: The call connection id. Required. + :type call_connection_id: str + :param stop_media_streaming_request: stop media streaming request payload. Is either a + StopMediaStreamingRequest type or a IO[bytes] type. Required. + :type stop_media_streaming_request: + ~azure.communication.callautomation.models.StopMediaStreamingRequest or IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(stop_media_streaming_request, (IOBase, bytes)): + _content = stop_media_streaming_request + else: + _json = self._serialize.body(stop_media_streaming_request, "StopMediaStreamingRequest") + + _request = build_call_media_stop_media_streaming_request( + call_connection_id=call_connection_id, + content_type=content_type, + api_version=self._config.api_version, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CommunicationErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + class CallDialogOperations: """ @@ -3268,7 +3526,7 @@ class CallDialogOperations: :rtype: ~azure.communication.callautomation.models.DialogStateResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3344,7 +3602,7 @@ class CallDialogOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3467,7 +3725,7 @@ class CallDialogOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3598,7 +3856,7 @@ class CallRecordingOperations: :rtype: ~azure.communication.callautomation.models.RecordingStateResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3666,7 +3924,7 @@ class CallRecordingOperations: :rtype: ~azure.communication.callautomation.models.RecordingStateResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3725,7 +3983,7 @@ class CallRecordingOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3780,7 +4038,7 @@ class CallRecordingOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3835,7 +4093,7 @@ class CallRecordingOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/aio/operations/_patch.py b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/aio/operations/_patch.py index f7dd3251033..5755fd181b3 100644 --- a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/aio/operations/_patch.py +++ b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/aio/operations/_patch.py @@ -2,6 +2,8 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ + + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/models/__init__.py b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/models/__init__.py index 8612fa98fc7..503fb787e4c 100644 --- a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/models/__init__.py +++ b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/models/__init__.py @@ -15,7 +15,6 @@ from ._models import AnswerFailed from ._models import AzureOpenAIDialog from ._models import AzureOpenAIDialogUpdate from ._models import BaseDialog -from ._models import BlobStorage from ._models import CallConnected from ._models import CallConnectionProperties from ._models import CallDisconnected @@ -61,6 +60,10 @@ from ._models import FileSource from ._models import HoldFailed from ._models import HoldRequest from ._models import MediaStreamingConfiguration +from ._models import MediaStreamingFailed +from ._models import MediaStreamingStarted +from ._models import MediaStreamingStopped +from ._models import MediaStreamingUpdate from ._models import MicrosoftTeamsAppIdentifierModel from ._models import MicrosoftTeamsUserIdentifierModel from ._models import MuteParticipantsRequest @@ -98,11 +101,11 @@ from ._models import SsmlSource from ._models import StartCallRecordingRequest from ._models import StartDialogRequest from ._models import StartHoldMusicRequest +from ._models import StartMediaStreamingRequest from ._models import StartTranscriptionRequest from ._models import StopHoldMusicRequest +from ._models import StopMediaStreamingRequest from ._models import StopTranscriptionRequest -from ._models import TeamsComplianceRecordingStateChanged -from ._models import TeamsRecordingStateChanged from ._models import TextSource from ._models import TranscriptionConfiguration from ._models import TranscriptionFailed @@ -128,6 +131,8 @@ from ._enums import DialogInputType from ._enums import DtmfTone from ._enums import MediaStreamingAudioChannelType from ._enums import MediaStreamingContentType +from ._enums import MediaStreamingStatus +from ._enums import MediaStreamingStatusDetails from ._enums import MediaStreamingTransportType from ._enums import PlaySourceType from ._enums import RecognitionType @@ -135,9 +140,9 @@ from ._enums import RecognizeInputType from ._enums import RecordingChannel from ._enums import RecordingContent from ._enums import RecordingFormat +from ._enums import RecordingKind from ._enums import RecordingState -from ._enums import RecordingStorage -from ._enums import RecordingType +from ._enums import RecordingStorageKind from ._enums import TranscriptionStatus from ._enums import TranscriptionStatusDetails from ._enums import TranscriptionTransportType @@ -156,7 +161,6 @@ __all__ = [ "AzureOpenAIDialog", "AzureOpenAIDialogUpdate", "BaseDialog", - "BlobStorage", "CallConnected", "CallConnectionProperties", "CallDisconnected", @@ -202,6 +206,10 @@ __all__ = [ "HoldFailed", "HoldRequest", "MediaStreamingConfiguration", + "MediaStreamingFailed", + "MediaStreamingStarted", + "MediaStreamingStopped", + "MediaStreamingUpdate", "MicrosoftTeamsAppIdentifierModel", "MicrosoftTeamsUserIdentifierModel", "MuteParticipantsRequest", @@ -239,11 +247,11 @@ __all__ = [ "StartCallRecordingRequest", "StartDialogRequest", "StartHoldMusicRequest", + "StartMediaStreamingRequest", "StartTranscriptionRequest", "StopHoldMusicRequest", + "StopMediaStreamingRequest", "StopTranscriptionRequest", - "TeamsComplianceRecordingStateChanged", - "TeamsRecordingStateChanged", "TextSource", "TranscriptionConfiguration", "TranscriptionFailed", @@ -268,6 +276,8 @@ __all__ = [ "DtmfTone", "MediaStreamingAudioChannelType", "MediaStreamingContentType", + "MediaStreamingStatus", + "MediaStreamingStatusDetails", "MediaStreamingTransportType", "PlaySourceType", "RecognitionType", @@ -275,9 +285,9 @@ __all__ = [ "RecordingChannel", "RecordingContent", "RecordingFormat", + "RecordingKind", "RecordingState", - "RecordingStorage", - "RecordingType", + "RecordingStorageKind", "TranscriptionStatus", "TranscriptionStatusDetails", "TranscriptionTransportType", diff --git a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/models/_enums.py b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/models/_enums.py index 87ca1991c2d..3fcabc58b16 100644 --- a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/models/_enums.py +++ b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/models/_enums.py @@ -91,11 +91,40 @@ class MediaStreamingAudioChannelType(str, Enum, metaclass=CaseInsensitiveEnumMet class MediaStreamingContentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Content type to stream, eg. audio, audio/video.""" + """Content type to stream, eg. audio.""" AUDIO = "audio" +class MediaStreamingStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MediaStreamingStatus.""" + + MEDIA_STREAMING_STARTED = "mediaStreamingStarted" + MEDIA_STREAMING_FAILED = "mediaStreamingFailed" + MEDIA_STREAMING_STOPPED = "mediaStreamingStopped" + UNSPECIFIED_ERROR = "unspecifiedError" + + +class MediaStreamingStatusDetails(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MediaStreamingStatusDetails.""" + + SUBSCRIPTION_STARTED = "subscriptionStarted" + STREAM_CONNECTION_REESTABLISHED = "streamConnectionReestablished" + STREAM_CONNECTION_UNSUCCESSFUL = "streamConnectionUnsuccessful" + STREAM_URL_MISSING = "streamUrlMissing" + SERVICE_SHUTDOWN = "serviceShutdown" + STREAM_CONNECTION_INTERRUPTED = "streamConnectionInterrupted" + SPEECH_SERVICES_CONNECTION_ERROR = "speechServicesConnectionError" + SUBSCRIPTION_STOPPED = "subscriptionStopped" + UNSPECIFIED_ERROR = "unspecifiedError" + AUTHENTICATION_FAILURE = "authenticationFailure" + BAD_REQUEST = "badRequest" + TOO_MANY_REQUESTS = "tooManyRequests" + FORBIDDEN = "forbidden" + SERVICE_TIMEOUT = "serviceTimeout" + INITIAL_WEB_SOCKET_CONNECTION_FAILED = "initialWebSocketConnectionFailed" + + class MediaStreamingTransportType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of transport to be used for media streaming, eg. Websocket.""" @@ -151,6 +180,14 @@ class RecordingFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): MP4 = "mp4" +class RecordingKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """RecordingKind.""" + + AZURE_COMMUNICATION_SERVICES = "azureCommunicationServices" + TEAMS = "teams" + TEAMS_COMPLIANCE = "teamsCompliance" + + class RecordingState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """RecordingState.""" @@ -158,19 +195,11 @@ class RecordingState(str, Enum, metaclass=CaseInsensitiveEnumMeta): INACTIVE = "inactive" -class RecordingStorage(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Defines the type of external storage.""" +class RecordingStorageKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines the kind of external storage.""" - ACS = "acs" - BLOB_STORAGE = "blobStorage" - - -class RecordingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """RecordingType.""" - - ACS = "acs" - TEAMS = "teams" - TEAMS_COMPLIANCE = "teamsCompliance" + AZURE_COMMUNICATION_SERVICES = "azureCommunicationServices" + AZURE_BLOB_STORAGE = "azureBlobStorage" class TranscriptionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/models/_models.py b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/models/_models.py index 392fa07a63b..1d04dd25a25 100644 --- a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/models/_models.py +++ b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/models/_models.py @@ -416,7 +416,7 @@ class BaseDialog(_serialization.Model): "context": {"key": "context", "type": "{object}"}, } - _subtype_map = {"kind": {"AzureOpenAI": "AzureOpenAIDialog", "PowerVirtualAgents": "PowerVirtualAgentsDialog"}} + _subtype_map = {"kind": {"azureOpenAI": "AzureOpenAIDialog", "powerVirtualAgents": "PowerVirtualAgentsDialog"}} def __init__(self, *, context: Dict[str, JSON], **kwargs: Any) -> None: """ @@ -456,7 +456,7 @@ class AzureOpenAIDialog(BaseDialog): :paramtype context: dict[str, JSON] """ super().__init__(context=context, **kwargs) - self.kind: str = "AzureOpenAI" + self.kind: str = "azureOpenAI" class DialogUpdateBase(_serialization.Model): @@ -483,7 +483,7 @@ class DialogUpdateBase(_serialization.Model): "context": {"key": "context", "type": "{object}"}, } - _subtype_map = {"kind": {"AzureOpenAI": "AzureOpenAIDialogUpdate"}} + _subtype_map = {"kind": {"azureOpenAI": "AzureOpenAIDialogUpdate"}} def __init__(self, *, context: Optional[Dict[str, JSON]] = None, **kwargs: Any) -> None: """ @@ -522,33 +522,7 @@ class AzureOpenAIDialogUpdate(DialogUpdateBase): :paramtype context: dict[str, JSON] """ super().__init__(context=context, **kwargs) - self.kind: str = "AzureOpenAI" - - -class BlobStorage(_serialization.Model): - """Used to specify Blob container url to recording storage. - - All required parameters must be populated in order to send to server. - - :ivar container_uri: Url of a container or a location within a container. Required. - :vartype container_uri: str - """ - - _validation = { - "container_uri": {"required": True}, - } - - _attribute_map = { - "container_uri": {"key": "containerUri", "type": "str"}, - } - - def __init__(self, *, container_uri: str, **kwargs: Any) -> None: - """ - :keyword container_uri: Url of a container or a location within a container. Required. - :paramtype container_uri: str - """ - super().__init__(**kwargs) - self.container_uri = container_uri + self.kind: str = "azureOpenAI" class CallConnected(_serialization.Model): @@ -2558,39 +2532,42 @@ class ExternalStorage(_serialization.Model): All required parameters must be populated in order to send to server. - :ivar storage_type: Defines the type of external storage. Required. Known values are: "acs" and - "blobStorage". - :vartype storage_type: str or ~azure.communication.callautomation.models.RecordingStorage - :ivar blob_storage: Defines the blob storage location where the recording will be stored. - :vartype blob_storage: ~azure.communication.callautomation.models.BlobStorage + :ivar recording_storage_kind: Defines the kind of external storage. Required. Known values are: + "azureCommunicationServices" and "AzureBlobStorage". + :vartype recording_storage_kind: str or + ~azure.communication.callautomation.models.RecordingStorageKind + :ivar recording_destination_container_url: Uri of a container or a location within a container. + :vartype recording_destination_container_url: str """ _validation = { - "storage_type": {"required": True}, + "recording_storage_kind": {"required": True}, } _attribute_map = { - "storage_type": {"key": "storageType", "type": "str"}, - "blob_storage": {"key": "blobStorage", "type": "BlobStorage"}, + "recording_storage_kind": {"key": "recordingStorageKind", "type": "str"}, + "recording_destination_container_url": {"key": "recordingDestinationContainerUrl", "type": "str"}, } def __init__( self, *, - storage_type: Union[str, "_models.RecordingStorage"], - blob_storage: Optional["_models.BlobStorage"] = None, + recording_storage_kind: Union[str, "_models.RecordingStorageKind"], + recording_destination_container_url: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword storage_type: Defines the type of external storage. Required. Known values are: "acs" - and "blobStorage". - :paramtype storage_type: str or ~azure.communication.callautomation.models.RecordingStorage - :keyword blob_storage: Defines the blob storage location where the recording will be stored. - :paramtype blob_storage: ~azure.communication.callautomation.models.BlobStorage + :keyword recording_storage_kind: Defines the kind of external storage. Required. Known values + are: "azureCommunicationServices" and "AzureBlobStorage". + :paramtype recording_storage_kind: str or + ~azure.communication.callautomation.models.RecordingStorageKind + :keyword recording_destination_container_url: Uri of a container or a location within a + container. + :paramtype recording_destination_container_url: str """ super().__init__(**kwargs) - self.storage_type = storage_type - self.blob_storage = blob_storage + self.recording_storage_kind = recording_storage_kind + self.recording_destination_container_url = recording_destination_container_url class FileSource(_serialization.Model): @@ -2771,13 +2748,16 @@ class MediaStreamingConfiguration(_serialization.Model): Required. "websocket" :vartype transport_type: str or ~azure.communication.callautomation.models.MediaStreamingTransportType - :ivar content_type: Content type to stream, eg. audio, audio/video. Required. "audio" + :ivar content_type: Content type to stream, eg. audio. Required. "audio" :vartype content_type: str or ~azure.communication.callautomation.models.MediaStreamingContentType :ivar audio_channel_type: Audio channel type to stream, eg. unmixed audio, mixed audio. Required. Known values are: "mixed" and "unmixed". :vartype audio_channel_type: str or ~azure.communication.callautomation.models.MediaStreamingAudioChannelType + :ivar start_media_streaming: Determines if the media streaming should be started immediately + after call is answered or not. + :vartype start_media_streaming: bool """ _validation = { @@ -2792,6 +2772,7 @@ class MediaStreamingConfiguration(_serialization.Model): "transport_type": {"key": "transportType", "type": "str"}, "content_type": {"key": "contentType", "type": "str"}, "audio_channel_type": {"key": "audioChannelType", "type": "str"}, + "start_media_streaming": {"key": "startMediaStreaming", "type": "bool"}, } def __init__( @@ -2801,6 +2782,7 @@ class MediaStreamingConfiguration(_serialization.Model): transport_type: Union[str, "_models.MediaStreamingTransportType"], content_type: Union[str, "_models.MediaStreamingContentType"], audio_channel_type: Union[str, "_models.MediaStreamingAudioChannelType"], + start_media_streaming: Optional[bool] = None, **kwargs: Any ) -> None: """ @@ -2810,19 +2792,232 @@ class MediaStreamingConfiguration(_serialization.Model): Required. "websocket" :paramtype transport_type: str or ~azure.communication.callautomation.models.MediaStreamingTransportType - :keyword content_type: Content type to stream, eg. audio, audio/video. Required. "audio" + :keyword content_type: Content type to stream, eg. audio. Required. "audio" :paramtype content_type: str or ~azure.communication.callautomation.models.MediaStreamingContentType :keyword audio_channel_type: Audio channel type to stream, eg. unmixed audio, mixed audio. Required. Known values are: "mixed" and "unmixed". :paramtype audio_channel_type: str or ~azure.communication.callautomation.models.MediaStreamingAudioChannelType + :keyword start_media_streaming: Determines if the media streaming should be started immediately + after call is answered or not. + :paramtype start_media_streaming: bool """ super().__init__(**kwargs) self.transport_url = transport_url self.transport_type = transport_type self.content_type = content_type self.audio_channel_type = audio_channel_type + self.start_media_streaming = start_media_streaming + + +class MediaStreamingFailed(_serialization.Model): + """MediaStreamingFailed. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar operation_context: Used by customers when calling mid-call actions to correlate the + request to the response event. + :vartype operation_context: str + :ivar result_information: Contains the resulting SIP code, sub-code and message. + :vartype result_information: ~azure.communication.callautomation.models.ResultInformation + :ivar media_streaming_update: Defines the result for audio streaming update with the current + status and the details about the status. + :vartype media_streaming_update: + ~azure.communication.callautomation.models.MediaStreamingUpdate + :ivar call_connection_id: Call connection ID. + :vartype call_connection_id: str + :ivar server_call_id: Server call ID. + :vartype server_call_id: str + :ivar correlation_id: Correlation ID for event to call correlation. Also called ChainId for + skype chain ID. + :vartype correlation_id: str + """ + + _validation = { + "operation_context": {"readonly": True}, + "result_information": {"readonly": True}, + "media_streaming_update": {"readonly": True}, + "call_connection_id": {"readonly": True}, + "server_call_id": {"readonly": True}, + "correlation_id": {"readonly": True}, + } + + _attribute_map = { + "operation_context": {"key": "operationContext", "type": "str"}, + "result_information": {"key": "resultInformation", "type": "ResultInformation"}, + "media_streaming_update": {"key": "mediaStreamingUpdate", "type": "MediaStreamingUpdate"}, + "call_connection_id": {"key": "callConnectionId", "type": "str"}, + "server_call_id": {"key": "serverCallId", "type": "str"}, + "correlation_id": {"key": "correlationId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.operation_context = None + self.result_information = None + self.media_streaming_update = None + self.call_connection_id = None + self.server_call_id = None + self.correlation_id = None + + +class MediaStreamingStarted(_serialization.Model): + """MediaStreamingStarted. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar operation_context: Used by customers when calling mid-call actions to correlate the + request to the response event. + :vartype operation_context: str + :ivar result_information: Contains the resulting SIP code, sub-code and message. + :vartype result_information: ~azure.communication.callautomation.models.ResultInformation + :ivar media_streaming_update: Defines the result for audio streaming update with the current + status and the details about the status. + :vartype media_streaming_update: + ~azure.communication.callautomation.models.MediaStreamingUpdate + :ivar call_connection_id: Call connection ID. + :vartype call_connection_id: str + :ivar server_call_id: Server call ID. + :vartype server_call_id: str + :ivar correlation_id: Correlation ID for event to call correlation. Also called ChainId for + skype chain ID. + :vartype correlation_id: str + """ + + _validation = { + "operation_context": {"readonly": True}, + "result_information": {"readonly": True}, + "media_streaming_update": {"readonly": True}, + "call_connection_id": {"readonly": True}, + "server_call_id": {"readonly": True}, + "correlation_id": {"readonly": True}, + } + + _attribute_map = { + "operation_context": {"key": "operationContext", "type": "str"}, + "result_information": {"key": "resultInformation", "type": "ResultInformation"}, + "media_streaming_update": {"key": "mediaStreamingUpdate", "type": "MediaStreamingUpdate"}, + "call_connection_id": {"key": "callConnectionId", "type": "str"}, + "server_call_id": {"key": "serverCallId", "type": "str"}, + "correlation_id": {"key": "correlationId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.operation_context = None + self.result_information = None + self.media_streaming_update = None + self.call_connection_id = None + self.server_call_id = None + self.correlation_id = None + + +class MediaStreamingStopped(_serialization.Model): + """MediaStreamingStopped. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar operation_context: Used by customers when calling mid-call actions to correlate the + request to the response event. + :vartype operation_context: str + :ivar result_information: Contains the resulting SIP code, sub-code and message. + :vartype result_information: ~azure.communication.callautomation.models.ResultInformation + :ivar media_streaming_update: Defines the result for audio streaming update with the current + status and the details about the status. + :vartype media_streaming_update: + ~azure.communication.callautomation.models.MediaStreamingUpdate + :ivar call_connection_id: Call connection ID. + :vartype call_connection_id: str + :ivar server_call_id: Server call ID. + :vartype server_call_id: str + :ivar correlation_id: Correlation ID for event to call correlation. Also called ChainId for + skype chain ID. + :vartype correlation_id: str + """ + + _validation = { + "operation_context": {"readonly": True}, + "result_information": {"readonly": True}, + "media_streaming_update": {"readonly": True}, + "call_connection_id": {"readonly": True}, + "server_call_id": {"readonly": True}, + "correlation_id": {"readonly": True}, + } + + _attribute_map = { + "operation_context": {"key": "operationContext", "type": "str"}, + "result_information": {"key": "resultInformation", "type": "ResultInformation"}, + "media_streaming_update": {"key": "mediaStreamingUpdate", "type": "MediaStreamingUpdate"}, + "call_connection_id": {"key": "callConnectionId", "type": "str"}, + "server_call_id": {"key": "serverCallId", "type": "str"}, + "correlation_id": {"key": "correlationId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.operation_context = None + self.result_information = None + self.media_streaming_update = None + self.call_connection_id = None + self.server_call_id = None + self.correlation_id = None + + +class MediaStreamingUpdate(_serialization.Model): + """MediaStreamingUpdate. + + :ivar content_type: + :vartype content_type: str + :ivar media_streaming_status: Known values are: "mediaStreamingStarted", + "mediaStreamingFailed", "mediaStreamingStopped", and "unspecifiedError". + :vartype media_streaming_status: str or + ~azure.communication.callautomation.models.MediaStreamingStatus + :ivar media_streaming_status_details: Known values are: "subscriptionStarted", + "streamConnectionReestablished", "streamConnectionUnsuccessful", "streamUrlMissing", + "serviceShutdown", "streamConnectionInterrupted", "speechServicesConnectionError", + "subscriptionStopped", "unspecifiedError", "authenticationFailure", "badRequest", + "tooManyRequests", "forbidden", "serviceTimeout", and "initialWebSocketConnectionFailed". + :vartype media_streaming_status_details: str or + ~azure.communication.callautomation.models.MediaStreamingStatusDetails + """ + + _attribute_map = { + "content_type": {"key": "contentType", "type": "str"}, + "media_streaming_status": {"key": "mediaStreamingStatus", "type": "str"}, + "media_streaming_status_details": {"key": "mediaStreamingStatusDetails", "type": "str"}, + } + + def __init__( + self, + *, + content_type: Optional[str] = None, + media_streaming_status: Optional[Union[str, "_models.MediaStreamingStatus"]] = None, + media_streaming_status_details: Optional[Union[str, "_models.MediaStreamingStatusDetails"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword content_type: + :paramtype content_type: str + :keyword media_streaming_status: Known values are: "mediaStreamingStarted", + "mediaStreamingFailed", "mediaStreamingStopped", and "unspecifiedError". + :paramtype media_streaming_status: str or + ~azure.communication.callautomation.models.MediaStreamingStatus + :keyword media_streaming_status_details: Known values are: "subscriptionStarted", + "streamConnectionReestablished", "streamConnectionUnsuccessful", "streamUrlMissing", + "serviceShutdown", "streamConnectionInterrupted", "speechServicesConnectionError", + "subscriptionStopped", "unspecifiedError", "authenticationFailure", "badRequest", + "tooManyRequests", "forbidden", "serviceTimeout", and "initialWebSocketConnectionFailed". + :paramtype media_streaming_status_details: str or + ~azure.communication.callautomation.models.MediaStreamingStatusDetails + """ + super().__init__(**kwargs) + self.content_type = content_type + self.media_streaming_status = media_streaming_status + self.media_streaming_status_details = media_streaming_status_details class MicrosoftTeamsAppIdentifierModel(_serialization.Model): @@ -3148,6 +3343,8 @@ class PlayFailed(_serialization.Model): :vartype operation_context: str :ivar result_information: Contains the resulting SIP code, sub-code and message. :vartype result_information: ~azure.communication.callautomation.models.ResultInformation + :ivar failed_play_source_index: Indicates the index of the failed play source. + :vartype failed_play_source_index: int :ivar call_connection_id: Call connection ID. :vartype call_connection_id: str :ivar server_call_id: Server call ID. @@ -3160,6 +3357,7 @@ class PlayFailed(_serialization.Model): _validation = { "operation_context": {"readonly": True}, "result_information": {"readonly": True}, + "failed_play_source_index": {"readonly": True}, "call_connection_id": {"readonly": True}, "server_call_id": {"readonly": True}, "correlation_id": {"readonly": True}, @@ -3168,6 +3366,7 @@ class PlayFailed(_serialization.Model): _attribute_map = { "operation_context": {"key": "operationContext", "type": "str"}, "result_information": {"key": "resultInformation", "type": "ResultInformation"}, + "failed_play_source_index": {"key": "failedPlaySourceIndex", "type": "int"}, "call_connection_id": {"key": "callConnectionId", "type": "str"}, "server_call_id": {"key": "serverCallId", "type": "str"}, "correlation_id": {"key": "correlationId", "type": "str"}, @@ -3178,6 +3377,7 @@ class PlayFailed(_serialization.Model): super().__init__(**kwargs) self.operation_context = None self.result_information = None + self.failed_play_source_index = None self.call_connection_id = None self.server_call_id = None self.correlation_id = None @@ -3388,7 +3588,7 @@ class PowerVirtualAgentsDialog(BaseDialog): :paramtype language: str """ super().__init__(context=context, **kwargs) - self.kind: str = "PowerVirtualAgents" + self.kind: str = "powerVirtualAgents" self.bot_app_id = bot_app_id self.language = language @@ -3516,6 +3716,8 @@ class RecognizeFailed(_serialization.Model): :vartype operation_context: str :ivar result_information: Contains the resulting SIP code, sub-code and message. :vartype result_information: ~azure.communication.callautomation.models.ResultInformation + :ivar failed_play_source_index: Indicates the index of the failed play source. + :vartype failed_play_source_index: int :ivar call_connection_id: Call connection ID. :vartype call_connection_id: str :ivar server_call_id: Server call ID. @@ -3528,6 +3730,7 @@ class RecognizeFailed(_serialization.Model): _validation = { "operation_context": {"readonly": True}, "result_information": {"readonly": True}, + "failed_play_source_index": {"readonly": True}, "call_connection_id": {"readonly": True}, "server_call_id": {"readonly": True}, "correlation_id": {"readonly": True}, @@ -3536,6 +3739,7 @@ class RecognizeFailed(_serialization.Model): _attribute_map = { "operation_context": {"key": "operationContext", "type": "str"}, "result_information": {"key": "resultInformation", "type": "ResultInformation"}, + "failed_play_source_index": {"key": "failedPlaySourceIndex", "type": "int"}, "call_connection_id": {"key": "callConnectionId", "type": "str"}, "server_call_id": {"key": "serverCallId", "type": "str"}, "correlation_id": {"key": "correlationId", "type": "str"}, @@ -3546,6 +3750,7 @@ class RecognizeFailed(_serialization.Model): super().__init__(**kwargs) self.operation_context = None self.result_information = None + self.failed_play_source_index = None self.call_connection_id = None self.server_call_id = None self.correlation_id = None @@ -3646,6 +3851,8 @@ class RecognizeRequest(_serialization.Model): ~azure.communication.callautomation.models.RecognizeInputType :ivar play_prompt: The source of the audio to be played for recognition. :vartype play_prompt: ~azure.communication.callautomation.models.PlaySource + :ivar play_prompts: The source of the audio to be played for recognition. + :vartype play_prompts: list[~azure.communication.callautomation.models.PlaySource] :ivar interrupt_call_media_operation: If set recognize can barge into other existing queued-up/currently-processing requests. :vartype interrupt_call_media_operation: bool @@ -3668,6 +3875,7 @@ class RecognizeRequest(_serialization.Model): _attribute_map = { "recognize_input_type": {"key": "recognizeInputType", "type": "str"}, "play_prompt": {"key": "playPrompt", "type": "PlaySource"}, + "play_prompts": {"key": "playPrompts", "type": "[PlaySource]"}, "interrupt_call_media_operation": {"key": "interruptCallMediaOperation", "type": "bool"}, "recognize_options": {"key": "recognizeOptions", "type": "RecognizeOptions"}, "operation_context": {"key": "operationContext", "type": "str"}, @@ -3680,6 +3888,7 @@ class RecognizeRequest(_serialization.Model): recognize_input_type: Union[str, "_models.RecognizeInputType"], recognize_options: "_models.RecognizeOptions", play_prompt: Optional["_models.PlaySource"] = None, + play_prompts: Optional[List["_models.PlaySource"]] = None, interrupt_call_media_operation: Optional[bool] = None, operation_context: Optional[str] = None, operation_callback_uri: Optional[str] = None, @@ -3692,6 +3901,8 @@ class RecognizeRequest(_serialization.Model): ~azure.communication.callautomation.models.RecognizeInputType :keyword play_prompt: The source of the audio to be played for recognition. :paramtype play_prompt: ~azure.communication.callautomation.models.PlaySource + :keyword play_prompts: The source of the audio to be played for recognition. + :paramtype play_prompts: list[~azure.communication.callautomation.models.PlaySource] :keyword interrupt_call_media_operation: If set recognize can barge into other existing queued-up/currently-processing requests. :paramtype interrupt_call_media_operation: bool @@ -3708,6 +3919,7 @@ class RecognizeRequest(_serialization.Model): super().__init__(**kwargs) self.recognize_input_type = recognize_input_type self.play_prompt = play_prompt + self.play_prompts = play_prompts self.interrupt_call_media_operation = interrupt_call_media_operation self.recognize_options = recognize_options self.operation_context = operation_context @@ -3725,8 +3937,9 @@ class RecordingStateChanged(_serialization.Model): :vartype state: str or ~azure.communication.callautomation.models.RecordingState :ivar start_date_time: The time of the recording started. :vartype start_date_time: ~datetime.datetime - :ivar recording_type: Known values are: "acs", "teams", and "teamsCompliance". - :vartype recording_type: str or ~azure.communication.callautomation.models.RecordingType + :ivar recording_kind: Known values are: "azureCommunicationServices", "teams", and + "teamsCompliance". + :vartype recording_kind: str or ~azure.communication.callautomation.models.RecordingKind :ivar call_connection_id: Call connection ID. :vartype call_connection_id: str :ivar server_call_id: Server call ID. @@ -3748,7 +3961,7 @@ class RecordingStateChanged(_serialization.Model): "recording_id": {"key": "recordingId", "type": "str"}, "state": {"key": "state", "type": "str"}, "start_date_time": {"key": "startDateTime", "type": "iso-8601"}, - "recording_type": {"key": "recordingType", "type": "str"}, + "recording_kind": {"key": "recordingKind", "type": "str"}, "call_connection_id": {"key": "callConnectionId", "type": "str"}, "server_call_id": {"key": "serverCallId", "type": "str"}, "correlation_id": {"key": "correlationId", "type": "str"}, @@ -3758,20 +3971,21 @@ class RecordingStateChanged(_serialization.Model): self, *, state: Optional[Union[str, "_models.RecordingState"]] = None, - recording_type: Optional[Union[str, "_models.RecordingType"]] = None, + recording_kind: Optional[Union[str, "_models.RecordingKind"]] = None, **kwargs: Any ) -> None: """ :keyword state: Known values are: "active" and "inactive". :paramtype state: str or ~azure.communication.callautomation.models.RecordingState - :keyword recording_type: Known values are: "acs", "teams", and "teamsCompliance". - :paramtype recording_type: str or ~azure.communication.callautomation.models.RecordingType + :keyword recording_kind: Known values are: "azureCommunicationServices", "teams", and + "teamsCompliance". + :paramtype recording_kind: str or ~azure.communication.callautomation.models.RecordingKind """ super().__init__(**kwargs) self.recording_id = None self.state = state self.start_date_time = None - self.recording_type = recording_type + self.recording_kind = recording_kind self.call_connection_id = None self.server_call_id = None self.correlation_id = None @@ -3784,14 +3998,15 @@ class RecordingStateResponse(_serialization.Model): :vartype recording_id: str :ivar recording_state: Known values are: "active" and "inactive". :vartype recording_state: str or ~azure.communication.callautomation.models.RecordingState - :ivar recording_type: Known values are: "acs", "teams", and "teamsCompliance". - :vartype recording_type: str or ~azure.communication.callautomation.models.RecordingType + :ivar recording_kind: Known values are: "azureCommunicationServices", "teams", and + "teamsCompliance". + :vartype recording_kind: str or ~azure.communication.callautomation.models.RecordingKind """ _attribute_map = { "recording_id": {"key": "recordingId", "type": "str"}, "recording_state": {"key": "recordingState", "type": "str"}, - "recording_type": {"key": "recordingType", "type": "str"}, + "recording_kind": {"key": "recordingKind", "type": "str"}, } def __init__( @@ -3799,7 +4014,7 @@ class RecordingStateResponse(_serialization.Model): *, recording_id: Optional[str] = None, recording_state: Optional[Union[str, "_models.RecordingState"]] = None, - recording_type: Optional[Union[str, "_models.RecordingType"]] = None, + recording_kind: Optional[Union[str, "_models.RecordingKind"]] = None, **kwargs: Any ) -> None: """ @@ -3807,13 +4022,14 @@ class RecordingStateResponse(_serialization.Model): :paramtype recording_id: str :keyword recording_state: Known values are: "active" and "inactive". :paramtype recording_state: str or ~azure.communication.callautomation.models.RecordingState - :keyword recording_type: Known values are: "acs", "teams", and "teamsCompliance". - :paramtype recording_type: str or ~azure.communication.callautomation.models.RecordingType + :keyword recording_kind: Known values are: "azureCommunicationServices", "teams", and + "teamsCompliance". + :paramtype recording_kind: str or ~azure.communication.callautomation.models.RecordingKind """ super().__init__(**kwargs) self.recording_id = recording_id self.recording_state = recording_state - self.recording_type = recording_type + self.recording_kind = recording_kind class RedirectCallRequest(_serialization.Model): @@ -4407,7 +4623,7 @@ class StartCallRecordingRequest(_serialization.Model): :vartype channel_affinity: list[~azure.communication.callautomation.models.ChannelAffinity] :ivar external_storage: Optional property to specify location where recording will be stored. :vartype external_storage: ~azure.communication.callautomation.models.ExternalStorage - :ivar pause_on_start: When set to true will start recording in Pause mode, which could be + :ivar pause_on_start: When set to true will start recording in Pause mode, which can be resumed. :vartype pause_on_start: bool """ @@ -4481,7 +4697,7 @@ class StartCallRecordingRequest(_serialization.Model): :keyword external_storage: Optional property to specify location where recording will be stored. :paramtype external_storage: ~azure.communication.callautomation.models.ExternalStorage - :keyword pause_on_start: When set to true will start recording in Pause mode, which could be + :keyword pause_on_start: When set to true will start recording in Pause mode, which can be resumed. :paramtype pause_on_start: bool """ @@ -4610,6 +4826,40 @@ class StartHoldMusicRequest(_serialization.Model): self.operation_callback_uri = operation_callback_uri +class StartMediaStreamingRequest(_serialization.Model): + """StartMediaStreamingRequest. + + :ivar operation_callback_uri: Set a callback URI that overrides the default callback URI set by + CreateCall/AnswerCall for this operation. + This setup is per-action. If this is not set, the default callback URI set by + CreateCall/AnswerCall will be used. + :vartype operation_callback_uri: str + :ivar operation_context: The value to identify context of the operation. + :vartype operation_context: str + """ + + _attribute_map = { + "operation_callback_uri": {"key": "operationCallbackUri", "type": "str"}, + "operation_context": {"key": "operationContext", "type": "str"}, + } + + def __init__( + self, *, operation_callback_uri: Optional[str] = None, operation_context: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword operation_callback_uri: Set a callback URI that overrides the default callback URI set + by CreateCall/AnswerCall for this operation. + This setup is per-action. If this is not set, the default callback URI set by + CreateCall/AnswerCall will be used. + :paramtype operation_callback_uri: str + :keyword operation_context: The value to identify context of the operation. + :paramtype operation_context: str + """ + super().__init__(**kwargs) + self.operation_callback_uri = operation_callback_uri + self.operation_context = operation_context + + class StartTranscriptionRequest(_serialization.Model): """StartTranscriptionRequest. @@ -4680,6 +4930,32 @@ class StopHoldMusicRequest(_serialization.Model): self.operation_context = operation_context +class StopMediaStreamingRequest(_serialization.Model): + """StopMediaStreamingRequest. + + :ivar operation_callback_uri: Set a callback URI that overrides the default callback URI set by + CreateCall/AnswerCall for this operation. + This setup is per-action. If this is not set, the default callback URI set by + CreateCall/AnswerCall will be used. + :vartype operation_callback_uri: str + """ + + _attribute_map = { + "operation_callback_uri": {"key": "operationCallbackUri", "type": "str"}, + } + + def __init__(self, *, operation_callback_uri: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword operation_callback_uri: Set a callback URI that overrides the default callback URI set + by CreateCall/AnswerCall for this operation. + This setup is per-action. If this is not set, the default callback URI set by + CreateCall/AnswerCall will be used. + :paramtype operation_callback_uri: str + """ + super().__init__(**kwargs) + self.operation_callback_uri = operation_callback_uri + + class StopTranscriptionRequest(_serialization.Model): """StopTranscriptionRequest. @@ -4700,132 +4976,6 @@ class StopTranscriptionRequest(_serialization.Model): self.operation_context = operation_context -class TeamsComplianceRecordingStateChanged(_serialization.Model): - """TeamsComplianceRecordingStateChanged. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar recording_id: The call recording id. - :vartype recording_id: str - :ivar state: Known values are: "active" and "inactive". - :vartype state: str or ~azure.communication.callautomation.models.RecordingState - :ivar start_date_time: The time of the recording started. - :vartype start_date_time: ~datetime.datetime - :ivar recording_type: Known values are: "acs", "teams", and "teamsCompliance". - :vartype recording_type: str or ~azure.communication.callautomation.models.RecordingType - :ivar call_connection_id: Call connection ID. - :vartype call_connection_id: str - :ivar server_call_id: Server call ID. - :vartype server_call_id: str - :ivar correlation_id: Correlation ID for event to call correlation. Also called ChainId for - skype chain ID. - :vartype correlation_id: str - """ - - _validation = { - "recording_id": {"readonly": True}, - "start_date_time": {"readonly": True}, - "call_connection_id": {"readonly": True}, - "server_call_id": {"readonly": True}, - "correlation_id": {"readonly": True}, - } - - _attribute_map = { - "recording_id": {"key": "recordingId", "type": "str"}, - "state": {"key": "state", "type": "str"}, - "start_date_time": {"key": "startDateTime", "type": "iso-8601"}, - "recording_type": {"key": "recordingType", "type": "str"}, - "call_connection_id": {"key": "callConnectionId", "type": "str"}, - "server_call_id": {"key": "serverCallId", "type": "str"}, - "correlation_id": {"key": "correlationId", "type": "str"}, - } - - def __init__( - self, - *, - state: Optional[Union[str, "_models.RecordingState"]] = None, - recording_type: Optional[Union[str, "_models.RecordingType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword state: Known values are: "active" and "inactive". - :paramtype state: str or ~azure.communication.callautomation.models.RecordingState - :keyword recording_type: Known values are: "acs", "teams", and "teamsCompliance". - :paramtype recording_type: str or ~azure.communication.callautomation.models.RecordingType - """ - super().__init__(**kwargs) - self.recording_id = None - self.state = state - self.start_date_time = None - self.recording_type = recording_type - self.call_connection_id = None - self.server_call_id = None - self.correlation_id = None - - -class TeamsRecordingStateChanged(_serialization.Model): - """TeamsRecordingStateChanged. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar recording_id: The call recording id. - :vartype recording_id: str - :ivar state: Known values are: "active" and "inactive". - :vartype state: str or ~azure.communication.callautomation.models.RecordingState - :ivar start_date_time: The time of the recording started. - :vartype start_date_time: ~datetime.datetime - :ivar recording_type: Known values are: "acs", "teams", and "teamsCompliance". - :vartype recording_type: str or ~azure.communication.callautomation.models.RecordingType - :ivar call_connection_id: Call connection ID. - :vartype call_connection_id: str - :ivar server_call_id: Server call ID. - :vartype server_call_id: str - :ivar correlation_id: Correlation ID for event to call correlation. Also called ChainId for - skype chain ID. - :vartype correlation_id: str - """ - - _validation = { - "recording_id": {"readonly": True}, - "start_date_time": {"readonly": True}, - "call_connection_id": {"readonly": True}, - "server_call_id": {"readonly": True}, - "correlation_id": {"readonly": True}, - } - - _attribute_map = { - "recording_id": {"key": "recordingId", "type": "str"}, - "state": {"key": "state", "type": "str"}, - "start_date_time": {"key": "startDateTime", "type": "iso-8601"}, - "recording_type": {"key": "recordingType", "type": "str"}, - "call_connection_id": {"key": "callConnectionId", "type": "str"}, - "server_call_id": {"key": "serverCallId", "type": "str"}, - "correlation_id": {"key": "correlationId", "type": "str"}, - } - - def __init__( - self, - *, - state: Optional[Union[str, "_models.RecordingState"]] = None, - recording_type: Optional[Union[str, "_models.RecordingType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword state: Known values are: "active" and "inactive". - :paramtype state: str or ~azure.communication.callautomation.models.RecordingState - :keyword recording_type: Known values are: "acs", "teams", and "teamsCompliance". - :paramtype recording_type: str or ~azure.communication.callautomation.models.RecordingType - """ - super().__init__(**kwargs) - self.recording_id = None - self.state = state - self.start_date_time = None - self.recording_type = recording_type - self.call_connection_id = None - self.server_call_id = None - self.correlation_id = None - - class TextSource(_serialization.Model): """TextSource. @@ -5250,8 +5400,8 @@ class TransferToParticipantRequest(_serialization.Model): This setup is per-action. If this is not set, the default callback URI set by CreateCall/AnswerCall will be used. :vartype operation_callback_uri: str - :ivar source_caller_id_number: The source caller Id, a phone number, that's will be used as the - transferor's(Contoso) caller id when transfering a call a pstn target. + :ivar source_caller_id_number: The source caller Id, a phone number, that will be used as the + transferor's caller Id when transferring a call to a Pstn target. :vartype source_caller_id_number: ~azure.communication.callautomation.models.PhoneNumberIdentifierModel """ @@ -5298,8 +5448,8 @@ class TransferToParticipantRequest(_serialization.Model): This setup is per-action. If this is not set, the default callback URI set by CreateCall/AnswerCall will be used. :paramtype operation_callback_uri: str - :keyword source_caller_id_number: The source caller Id, a phone number, that's will be used as - the transferor's(Contoso) caller id when transfering a call a pstn target. + :keyword source_caller_id_number: The source caller Id, a phone number, that will be used as + the transferor's caller Id when transferring a call to a Pstn target. :paramtype source_caller_id_number: ~azure.communication.callautomation.models.PhoneNumberIdentifierModel """ @@ -5356,50 +5506,6 @@ class UnholdRequest(_serialization.Model): self.operation_context = operation_context -class UnholdRequest(_serialization.Model): - """The request payload for holding participant from the call. - - All required parameters must be populated in order to send to server. - - :ivar target_participant: Participants to be hold from the call. - Only ACS Users are supported. Required. - :vartype target_participant: - ~azure.communication.callautomation.models.CommunicationIdentifierModel - :ivar operation_context: Used by customers when calling mid-call actions to correlate the - request to the response event. - :vartype operation_context: str - """ - - _validation = { - "target_participant": {"required": True}, - } - - _attribute_map = { - "target_participant": {"key": "targetParticipant", "type": "CommunicationIdentifierModel"}, - "operation_context": {"key": "operationContext", "type": "str"}, - } - - def __init__( - self, - *, - target_participant: "_models.CommunicationIdentifierModel", - operation_context: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword target_participant: Participants to be hold from the call. - Only ACS Users are supported. Required. - :paramtype target_participant: - ~azure.communication.callautomation.models.CommunicationIdentifierModel - :keyword operation_context: Used by customers when calling mid-call actions to correlate the - request to the response event. - :paramtype operation_context: str - """ - super().__init__(**kwargs) - self.target_participant = target_participant - self.operation_context = operation_context - - class UnmuteParticipantsRequest(_serialization.Model): """The request payload for unmuting participant from the call. diff --git a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/models/_patch.py b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/models/_patch.py index f7dd3251033..5755fd181b3 100644 --- a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/models/_patch.py +++ b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/models/_patch.py @@ -2,6 +2,8 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ + + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/operations/_operations.py b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/operations/_operations.py index 2c81a352984..7a9fa5c7370 100644 --- a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/operations/_operations.py +++ b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/operations/_operations.py @@ -8,7 +8,8 @@ # -------------------------------------------------------------------------- import datetime from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse import uuid @@ -30,6 +31,10 @@ from .. import models as _models from .._serialization import Serializer from .._vendor import AzureCommunicationCallAutomationServiceMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -866,6 +871,64 @@ def build_call_media_stop_hold_music_request(call_connection_id: str, **kwargs: return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) +def build_call_media_start_media_streaming_request( # pylint: disable=name-too-long + call_connection_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-03-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/calling/callConnections/{callConnectionId}:startMediaStreaming" + path_format_arguments = { + "callConnectionId": _SERIALIZER.url("call_connection_id", call_connection_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_call_media_stop_media_streaming_request( # pylint: disable=name-too-long + call_connection_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-03-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/calling/callConnections/{callConnectionId}:stopMediaStreaming" + path_format_arguments = { + "callConnectionId": _SERIALIZER.url("call_connection_id", call_connection_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + def build_call_dialog_start_dialog_request(call_connection_id: str, dialog_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1086,6 +1149,7 @@ def build_call_recording_resume_recording_request( # pylint: disable=name-too-l class AzureCommunicationCallAutomationServiceOperationsMixin( # pylint: disable=name-too-long AzureCommunicationCallAutomationServiceMixinABC ): + @overload def create_call( self, create_call_request: _models.CreateCallRequest, *, content_type: str = "application/json", **kwargs: Any @@ -1138,7 +1202,7 @@ class AzureCommunicationCallAutomationServiceOperationsMixin( # pylint: disable :rtype: ~azure.communication.callautomation.models.CallConnectionProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1246,7 +1310,7 @@ class AzureCommunicationCallAutomationServiceOperationsMixin( # pylint: disable :rtype: ~azure.communication.callautomation.models.CallConnectionProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1358,7 +1422,7 @@ class AzureCommunicationCallAutomationServiceOperationsMixin( # pylint: disable :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1462,7 +1526,7 @@ class AzureCommunicationCallAutomationServiceOperationsMixin( # pylint: disable :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1546,7 +1610,7 @@ class CallConnectionOperations: :rtype: ~azure.communication.callautomation.models.CallConnectionProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1607,7 +1671,7 @@ class CallConnectionOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1662,7 +1726,7 @@ class CallConnectionOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1775,7 +1839,7 @@ class CallConnectionOperations: :rtype: ~azure.communication.callautomation.models.TransferCallResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1852,7 +1916,7 @@ class CallConnectionOperations: "cls", None ) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1998,7 +2062,7 @@ class CallConnectionOperations: :rtype: ~azure.communication.callautomation.models.AddParticipantResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2127,7 +2191,7 @@ class CallConnectionOperations: :rtype: ~azure.communication.callautomation.models.RemoveParticipantResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2256,7 +2320,7 @@ class CallConnectionOperations: :rtype: ~azure.communication.callautomation.models.MuteParticipantsResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2385,7 +2449,7 @@ class CallConnectionOperations: :rtype: ~azure.communication.callautomation.models.UnmuteParticipantsResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2514,7 +2578,7 @@ class CallConnectionOperations: :rtype: ~azure.communication.callautomation.models.CancelAddParticipantResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2587,7 +2651,7 @@ class CallConnectionOperations: :rtype: ~azure.communication.callautomation.models.CallParticipant :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2715,7 +2779,7 @@ class CallMediaOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2840,7 +2904,7 @@ class CallMediaOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2965,7 +3029,7 @@ class CallMediaOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3032,7 +3096,7 @@ class CallMediaOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3141,7 +3205,7 @@ class CallMediaOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3266,7 +3330,7 @@ class CallMediaOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3391,7 +3455,7 @@ class CallMediaOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3515,7 +3579,7 @@ class CallMediaOperations: :rtype: ~azure.communication.callautomation.models.SendDtmfTonesResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3644,7 +3708,7 @@ class CallMediaOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3759,7 +3823,7 @@ class CallMediaOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3879,7 +3943,7 @@ class CallMediaOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4004,7 +4068,7 @@ class CallMediaOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4128,7 +4192,7 @@ class CallMediaOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4181,6 +4245,256 @@ class CallMediaOperations: if cls: return cls(pipeline_response, None, {}) # type: ignore + @overload + def start_media_streaming( # pylint: disable=inconsistent-return-statements + self, + call_connection_id: str, + start_media_streaming_request: _models.StartMediaStreamingRequest, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """Starts media streaming in the call. + + Starts media streaming in the call. + + :param call_connection_id: The call connection id. Required. + :type call_connection_id: str + :param start_media_streaming_request: Required. + :type start_media_streaming_request: + ~azure.communication.callautomation.models.StartMediaStreamingRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def start_media_streaming( # pylint: disable=inconsistent-return-statements + self, + call_connection_id: str, + start_media_streaming_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """Starts media streaming in the call. + + Starts media streaming in the call. + + :param call_connection_id: The call connection id. Required. + :type call_connection_id: str + :param start_media_streaming_request: Required. + :type start_media_streaming_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def start_media_streaming( # pylint: disable=inconsistent-return-statements + self, + call_connection_id: str, + start_media_streaming_request: Union[_models.StartMediaStreamingRequest, IO[bytes]], + **kwargs: Any, + ) -> None: + """Starts media streaming in the call. + + Starts media streaming in the call. + + :param call_connection_id: The call connection id. Required. + :type call_connection_id: str + :param start_media_streaming_request: Is either a StartMediaStreamingRequest type or a + IO[bytes] type. Required. + :type start_media_streaming_request: + ~azure.communication.callautomation.models.StartMediaStreamingRequest or IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(start_media_streaming_request, (IOBase, bytes)): + _content = start_media_streaming_request + else: + _json = self._serialize.body(start_media_streaming_request, "StartMediaStreamingRequest") + + _request = build_call_media_start_media_streaming_request( + call_connection_id=call_connection_id, + content_type=content_type, + api_version=self._config.api_version, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CommunicationErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def stop_media_streaming( # pylint: disable=inconsistent-return-statements + self, + call_connection_id: str, + stop_media_streaming_request: _models.StopMediaStreamingRequest, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """Stops media streaming in the call. + + Stops media streaming in the call. + + :param call_connection_id: The call connection id. Required. + :type call_connection_id: str + :param stop_media_streaming_request: stop media streaming request payload. Required. + :type stop_media_streaming_request: + ~azure.communication.callautomation.models.StopMediaStreamingRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def stop_media_streaming( # pylint: disable=inconsistent-return-statements + self, + call_connection_id: str, + stop_media_streaming_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """Stops media streaming in the call. + + Stops media streaming in the call. + + :param call_connection_id: The call connection id. Required. + :type call_connection_id: str + :param stop_media_streaming_request: stop media streaming request payload. Required. + :type stop_media_streaming_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def stop_media_streaming( # pylint: disable=inconsistent-return-statements + self, + call_connection_id: str, + stop_media_streaming_request: Union[_models.StopMediaStreamingRequest, IO[bytes]], + **kwargs: Any, + ) -> None: + """Stops media streaming in the call. + + Stops media streaming in the call. + + :param call_connection_id: The call connection id. Required. + :type call_connection_id: str + :param stop_media_streaming_request: stop media streaming request payload. Is either a + StopMediaStreamingRequest type or a IO[bytes] type. Required. + :type stop_media_streaming_request: + ~azure.communication.callautomation.models.StopMediaStreamingRequest or IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(stop_media_streaming_request, (IOBase, bytes)): + _content = stop_media_streaming_request + else: + _json = self._serialize.body(stop_media_streaming_request, "StopMediaStreamingRequest") + + _request = build_call_media_stop_media_streaming_request( + call_connection_id=call_connection_id, + content_type=content_type, + api_version=self._config.api_version, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CommunicationErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + class CallDialogOperations: """ @@ -4281,7 +4595,7 @@ class CallDialogOperations: :rtype: ~azure.communication.callautomation.models.DialogStateResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4357,7 +4671,7 @@ class CallDialogOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4480,7 +4794,7 @@ class CallDialogOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4611,7 +4925,7 @@ class CallRecordingOperations: :rtype: ~azure.communication.callautomation.models.RecordingStateResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4679,7 +4993,7 @@ class CallRecordingOperations: :rtype: ~azure.communication.callautomation.models.RecordingStateResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4738,7 +5052,7 @@ class CallRecordingOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4793,7 +5107,7 @@ class CallRecordingOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4848,7 +5162,7 @@ class CallRecordingOperations: :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/operations/_patch.py b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/operations/_patch.py index f7dd3251033..5755fd181b3 100644 --- a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/operations/_patch.py +++ b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/operations/_patch.py @@ -2,6 +2,8 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ + + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_models.py b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_models.py index 211c175c3cb..b22a40600d4 100644 --- a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_models.py +++ b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_models.py @@ -4,6 +4,7 @@ # license information. # -------------------------------------------------------------------------- from typing import List, Optional, Union, TYPE_CHECKING +from typing_extensions import Literal from ._generated.models import ( CallLocator, MediaStreamingConfiguration as MediaStreamingConfigurationRest, @@ -21,6 +22,7 @@ from ._shared.models import ( PhoneNumberIdentifier, ) from ._generated.models._enums import PlaySourceType +from ._generated.models._enums import RecordingStorageKind from ._utils import ( deserialize_phone_identifier, deserialize_identifier, @@ -35,6 +37,7 @@ if TYPE_CHECKING: TranscriptionTransportType, CallConnectionState, RecordingState, + RecordingKind, VoiceKind, DtmfTone ) @@ -136,6 +139,39 @@ class GroupCallLocator: def _to_generated(self): return CallLocator(kind=self.kind, group_call_id=self.group_call_id) + class RecordingStorage: + """Recording Storage for the recording. + :param kind: Defines the kind of external storage. + :type kind: str + """ + kind: str + """The recording storage kind""" + + class AzureCommunicationsRecordingStorage(RecordingStorage): + """ + Recording Storage for the recording. + :param kind: Defines the kind of external storage. + :type kind: ~azure.communication.callautomation.RecordingStorageKind or str + """ + kind: Literal[RecordingStorageKind + .AZURE_COMMUNICATION_SERVICES + ] = RecordingStorageKind.AZURE_COMMUNICATION_SERVICES + """The kind of recording storage is set to AZURE_COMMUNICATION_SERVICES""" + + class AzureBlobContainerRecordingStorage(RecordingStorage): + """Recording Storage for the recording. + :param kind: Defines the kind of external storage. + :type kind: ~azure.communication.callautomation.RecordingStorageKind or str + :param container_url: Defines the kind of external storage. Required. + :type container_url: str + """ + kind: Literal[RecordingStorageKind.AZURE_BLOB_STORAGE] = RecordingStorageKind.AZURE_BLOB_STORAGE + """The kind of recording storage is set to AZURE_BLOB_STORAGE""" + container_url: str + """The container url for the AZURE_BLOB_STORAGE type""" + def __init__(self, container_url: str): + self.container_url = container_url + class ChannelAffinity: """Channel affinity for a participant. diff --git a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/aio/_call_automation_client_async.py b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/aio/_call_automation_client_async.py index f646787c1e7..30c4bbcc944 100644 --- a/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/aio/_call_automation_client_async.py +++ b/sdk/communication/azure-communication-callautomation/azure/communication/callautomation/aio/_call_automation_client_async.py @@ -61,7 +61,7 @@ if TYPE_CHECKING: RecordingContent, RecordingChannel, RecordingFormat, - RecordingStorage + RecordingStorageKind ) @@ -456,7 +456,7 @@ class CallAutomationClient: recording_format_type: Optional[Union[str, 'RecordingFormat']] = None, audio_channel_participant_ordering: Optional[List['CommunicationIdentifier']] = None, channel_affinity: Optional[List['ChannelAffinity']] = None, - recording_storage_type: Optional[Union[str, 'RecordingStorage']] = None, + recording_storage_kind: Optional[Union[str, 'RecordingStorageKind']] = None, external_storage_location: Optional[str] = None, pause_on_start: Optional[bool] = None, **kwargs @@ -489,7 +489,7 @@ class CallAutomationClient: ``External`` enables bring your own storage. :paramtype recording_storage_type: str or None :keyword external_storage_location: The location where recording is stored, - when RecordingStorageType is set to 'BlobStorage'. + when RecordingStorageKind is set to 'AzureBlobStorage'. :paramtype external_storage_location: str or ~azure.communication.callautomation.RecordingStorage or None :keyword pause_on_start: The state of the pause on start option. :paramtype pause_on_start: bool or None @@ -509,7 +509,7 @@ class CallAutomationClient: recording_format_type: Optional[Union[str, 'RecordingFormat']] = None, audio_channel_participant_ordering: Optional[List['CommunicationIdentifier']] = None, channel_affinity: Optional[List['ChannelAffinity']] = None, - recording_storage_type: Optional[Union[str, 'RecordingStorage']] = None, + recording_storage_type: Optional[Union[str, 'RecordingStorageKind']] = None, external_storage_location: Optional[str] = None, pause_on_start: Optional[bool] = None, **kwargs @@ -542,7 +542,7 @@ class CallAutomationClient: ``External`` enables bring your own storage. :paramtype recording_storage_type: str or None :keyword external_storage_location: The location where recording is stored, - when RecordingStorageType is set to 'BlobStorage'. + when RecordingStorageType is set to 'AzureBlobStorage'. :paramtype external_storage_location: str or ~azure.communication.callautomation.RecordingStorage or None :keyword pause_on_start: The state of the pause on start option. :paramtype pause_on_start: bool or None diff --git a/sdk/communication/azure-communication-callautomation/swagger/SWAGGER.md b/sdk/communication/azure-communication-callautomation/swagger/SWAGGER.md index c6db94a10c8..11a2fa32dc4 100644 --- a/sdk/communication/azure-communication-callautomation/swagger/SWAGGER.md +++ b/sdk/communication/azure-communication-callautomation/swagger/SWAGGER.md @@ -17,7 +17,7 @@ autorest SWAGGER.md ```yaml tag: package-2023-10-03-preview -require: https://github.com/Azure/azure-rest-api-specs/blob/77d25dd8426c4ba1619d15582a8c9d9b2f6890e8/specification/communication/data-plane/CallAutomation/readme.md +require: https://github.com/Azure/azure-rest-api-specs/blob/30137c8fce3cc0974cf3fc7c234215bc27e88001/specification/communication/data-plane/CallAutomation/readme.md output-folder: ../azure/communication/callautomation/_generated models-mode: msrest namespace: azure.communication.callautomation @@ -51,7 +51,7 @@ directive: - from: swagger-document where: $.definitions.RecordingStorageType.x-ms-enum transform: > - $["name"] = "RecordingStorage"; + $["name"] = "RecordingStorageKind"; - from: swagger-document where: $.definitions.Tone.x-ms-enum transform: >