diff --git a/sdk/communication/Azure.Communication.CallAutomation/api/Azure.Communication.CallAutomation.netstandard2.0.cs b/sdk/communication/Azure.Communication.CallAutomation/api/Azure.Communication.CallAutomation.netstandard2.0.cs index 73362fd98928..abf6e3d08cfd 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/api/Azure.Communication.CallAutomation.netstandard2.0.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/api/Azure.Communication.CallAutomation.netstandard2.0.cs @@ -274,10 +274,14 @@ protected CallMedia() { } public virtual System.Threading.Tasks.Task> SendDtmfAsync(System.Collections.Generic.IEnumerable tones, Azure.Communication.CommunicationIdentifier targetParticipant, string operationContext = null, System.Uri callbackUri = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response StartContinuousDtmfRecognition(Azure.Communication.CommunicationIdentifier targetParticipant, string operationContext = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task StartContinuousDtmfRecognitionAsync(Azure.Communication.CommunicationIdentifier targetParticipant, string operationContext = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response StartHoldMusic(Azure.Communication.CallAutomation.StartHoldMusicOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task StartHoldMusicAsync(Azure.Communication.CallAutomation.StartHoldMusicOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response StartRecognizing(Azure.Communication.CallAutomation.CallMediaRecognizeOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> StartRecognizingAsync(Azure.Communication.CallAutomation.CallMediaRecognizeOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response StopContinuousDtmfRecognition(Azure.Communication.CommunicationIdentifier targetParticipant, string operationContext = null, System.Uri callbackUri = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task StopContinuousDtmfRecognitionAsync(Azure.Communication.CommunicationIdentifier targetParticipant, string operationContext = null, System.Uri callbackUri = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response StopHoldMusic(Azure.Communication.CallAutomation.StopHoldMusicOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task StopHoldMusicAsync(Azure.Communication.CallAutomation.StopHoldMusicOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct CallMediaRecognitionType : System.IEquatable @@ -633,6 +637,7 @@ internal DialogHangup() { } private readonly object _dummy; private readonly int _dummyPrimitive; public DialogInputType(string value) { throw null; } + public static Azure.Communication.CallAutomation.DialogInputType AzureOpenAI { get { throw null; } } public static Azure.Communication.CallAutomation.DialogInputType PowerVirtualAgents { get { throw null; } } public bool Equals(Azure.Communication.CallAutomation.DialogInputType other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] @@ -1270,6 +1275,14 @@ public StartDialogOptions(string dialogId, Azure.Communication.CallAutomation.Di public Azure.Communication.CallAutomation.DialogInputType DialogInputType { get { throw null; } } public string OperationContext { get { throw null; } set { } } } + public partial class StartHoldMusicOptions + { + public StartHoldMusicOptions(Azure.Communication.CommunicationIdentifier targetParticipant, Azure.Communication.CallAutomation.PlaySource playSourceInfo) { } + public bool Loop { get { throw null; } set { } } + public string OperationContext { get { throw null; } set { } } + public Azure.Communication.CallAutomation.PlaySource PlaySourceInfo { get { throw null; } set { } } + public Azure.Communication.CommunicationIdentifier TargetParticipant { get { throw null; } } + } public partial class StartRecognizingCallMediaResult { internal StartRecognizingCallMediaResult() { } @@ -1294,6 +1307,23 @@ public StartRecordingOptions(Azure.Communication.CallAutomation.CallLocator call public Azure.Communication.CallAutomation.RecordingFormat RecordingFormat { get { throw null; } set { } } public System.Uri RecordingStateCallbackUri { get { throw null; } set { } } } + public partial class StartTranscriptionRequest + { + public StartTranscriptionRequest() { } + public string Locale { get { throw null; } set { } } + public string OperationContext { get { throw null; } set { } } + } + public partial class StopHoldMusicOptions + { + public StopHoldMusicOptions(Azure.Communication.CommunicationIdentifier targetParticipant) { } + public string OperationContext { get { throw null; } set { } } + public Azure.Communication.CommunicationIdentifier TargetParticipant { get { throw null; } } + } + public partial class StopTranscriptionRequest + { + public StopTranscriptionRequest() { } + public string OperationContext { get { throw null; } set { } } + } public partial class TextSource : Azure.Communication.CallAutomation.PlaySource { public TextSource(string text) { } @@ -1372,6 +1402,11 @@ public partial class UnmuteParticipantsResult internal UnmuteParticipantsResult() { } public string OperationContext { get { throw null; } } } + public partial class UpdateTranscriptionDataRequest + { + public UpdateTranscriptionDataRequest(string locale) { } + public string Locale { get { throw null; } } + } public partial class UserConsent { internal UserConsent() { } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/CallMedia.cs b/sdk/communication/Azure.Communication.CallAutomation/src/CallMedia.cs index 52ccc63ba087..8355bed4a967 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/CallMedia.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/CallMedia.cs @@ -393,6 +393,110 @@ public virtual Response StartRecognizing(CallMe } } + /// + /// Hold participant from the call. + /// + /// The options. + /// + /// + public virtual Response StartHoldMusic(StartHoldMusicOptions options, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(StartHoldMusic)}"); + scope.Start(); + try + { + var request = new StartHoldMusicRequestInternal( + CommunicationIdentifierSerializer.Serialize(options.TargetParticipant), + TranslatePlaySourceToInternal(options.PlaySourceInfo)) + { + Loop = options.Loop, + OperationContext = options.OperationContext, + }; + + return CallMediaRestClient.StartHoldMusic(CallConnectionId, request, cancellationToken: cancellationToken); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// + /// Hold participant from the call. + /// + /// The options. + /// + /// + public virtual async Task StartHoldMusicAsync(StartHoldMusicOptions options, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(StartHoldMusicAsync)}"); + scope.Start(); + try + { + var request = new StartHoldMusicRequestInternal( + CommunicationIdentifierSerializer.Serialize(options.TargetParticipant), + TranslatePlaySourceToInternal(options.PlaySourceInfo)) + { + Loop = options.Loop, + OperationContext = options.OperationContext, + }; + + return await CallMediaRestClient.StartHoldMusicAsync(CallConnectionId, request, cancellationToken: cancellationToken).ConfigureAwait(false); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// + /// Remove hold from participant. + /// + /// The options. + /// + /// + public virtual async Task StopHoldMusicAsync(StopHoldMusicOptions options, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(StopHoldMusicAsync)}"); + scope.Start(); + try + { + StopHoldMusicRequestInternal request = new StopHoldMusicRequestInternal(CommunicationIdentifierSerializer.Serialize(options.TargetParticipant)); + + return await CallMediaRestClient.StopHoldMusicAsync(CallConnectionId, request, cancellationToken: cancellationToken).ConfigureAwait(false); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// + /// Remove hold from participant. + /// + /// The options. + /// + /// + public virtual Response StopHoldMusic(StopHoldMusicOptions options, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(StopHoldMusicAsync)}"); + scope.Start(); + try + { + StopHoldMusicRequestInternal request = new StopHoldMusicRequestInternal(CommunicationIdentifierSerializer.Serialize(options.TargetParticipant)); + + return CallMediaRestClient.StopHoldMusic(CallConnectionId, request, cancellationToken: cancellationToken); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + private static RecognizeRequestInternal CreateRecognizeRequest(CallMediaRecognizeOptions recognizeOptions) { if (recognizeOptions == null) diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallMediaRestClient.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallMediaRestClient.cs index c518ab9f4cf0..1cb5b08d7477 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallMediaRestClient.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallMediaRestClient.cs @@ -111,6 +111,154 @@ public Response Play(string callConnectionId, PlayRequestInternal playRequest, C } } + internal HttpMessage CreateStartTranscriptionRequest(string callConnectionId, StartTranscriptionRequest startTranscriptionRequest) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/calling/callConnections/", false); + uri.AppendPath(callConnectionId, true); + uri.AppendPath(":StartTranscription", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(startTranscriptionRequest); + request.Content = content; + return message; + } + + /// Starts transcription in the call. + /// The call connection id. + /// The StartTranscriptionRequest to use. + /// The cancellation token to use. + /// or is null. + public async Task StartTranscriptionAsync(string callConnectionId, StartTranscriptionRequest startTranscriptionRequest, CancellationToken cancellationToken = default) + { + if (callConnectionId == null) + { + throw new ArgumentNullException(nameof(callConnectionId)); + } + if (startTranscriptionRequest == null) + { + throw new ArgumentNullException(nameof(startTranscriptionRequest)); + } + + using var message = CreateStartTranscriptionRequest(callConnectionId, startTranscriptionRequest); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Starts transcription in the call. + /// The call connection id. + /// The StartTranscriptionRequest to use. + /// The cancellation token to use. + /// or is null. + public Response StartTranscription(string callConnectionId, StartTranscriptionRequest startTranscriptionRequest, CancellationToken cancellationToken = default) + { + if (callConnectionId == null) + { + throw new ArgumentNullException(nameof(callConnectionId)); + } + if (startTranscriptionRequest == null) + { + throw new ArgumentNullException(nameof(startTranscriptionRequest)); + } + + using var message = CreateStartTranscriptionRequest(callConnectionId, startTranscriptionRequest); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateStopTranscriptionRequest(string callConnectionId, StopTranscriptionRequest stopTranscriptionRequest) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/calling/callConnections/", false); + uri.AppendPath(callConnectionId, true); + uri.AppendPath(":StopTranscripition", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(stopTranscriptionRequest); + request.Content = content; + return message; + } + + /// Stops transcription in the call. + /// The call connection id. + /// stop transcription request payload. + /// The cancellation token to use. + /// or is null. + public async Task StopTranscriptionAsync(string callConnectionId, StopTranscriptionRequest stopTranscriptionRequest, CancellationToken cancellationToken = default) + { + if (callConnectionId == null) + { + throw new ArgumentNullException(nameof(callConnectionId)); + } + if (stopTranscriptionRequest == null) + { + throw new ArgumentNullException(nameof(stopTranscriptionRequest)); + } + + using var message = CreateStopTranscriptionRequest(callConnectionId, stopTranscriptionRequest); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Stops transcription in the call. + /// The call connection id. + /// stop transcription request payload. + /// The cancellation token to use. + /// or is null. + public Response StopTranscription(string callConnectionId, StopTranscriptionRequest stopTranscriptionRequest, CancellationToken cancellationToken = default) + { + if (callConnectionId == null) + { + throw new ArgumentNullException(nameof(callConnectionId)); + } + if (stopTranscriptionRequest == null) + { + throw new ArgumentNullException(nameof(stopTranscriptionRequest)); + } + + using var message = CreateStopTranscriptionRequest(callConnectionId, stopTranscriptionRequest); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + internal HttpMessage CreateCancelAllMediaOperationsRequest(string callConnectionId) { var message = _pipeline.CreateMessage(); @@ -466,5 +614,229 @@ public Response SendDtmf(string callConnectionId, SendDtmfRequestInternal sendDt throw new RequestFailedException(message.Response); } } + + internal HttpMessage CreateUpdateTranscriptionDataRequest(string callConnectionId, UpdateTranscriptionDataRequest updateTranscriptionDataRequest) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/calling/callConnections/", false); + uri.AppendPath(callConnectionId, true); + uri.AppendPath(":updateTranscriptionData", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(updateTranscriptionDataRequest); + request.Content = content; + return message; + } + + /// UpdateTranscriptionData Api. + /// The call connection id. + /// The updateTranscriptionData request. + /// The cancellation token to use. + /// or is null. + /// API to change transcription language. + public async Task UpdateTranscriptionDataAsync(string callConnectionId, UpdateTranscriptionDataRequest updateTranscriptionDataRequest, CancellationToken cancellationToken = default) + { + if (callConnectionId == null) + { + throw new ArgumentNullException(nameof(callConnectionId)); + } + if (updateTranscriptionDataRequest == null) + { + throw new ArgumentNullException(nameof(updateTranscriptionDataRequest)); + } + + using var message = CreateUpdateTranscriptionDataRequest(callConnectionId, updateTranscriptionDataRequest); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// UpdateTranscriptionData Api. + /// The call connection id. + /// The updateTranscriptionData request. + /// The cancellation token to use. + /// or is null. + /// API to change transcription language. + public Response UpdateTranscriptionData(string callConnectionId, UpdateTranscriptionDataRequest updateTranscriptionDataRequest, CancellationToken cancellationToken = default) + { + if (callConnectionId == null) + { + throw new ArgumentNullException(nameof(callConnectionId)); + } + if (updateTranscriptionDataRequest == null) + { + throw new ArgumentNullException(nameof(updateTranscriptionDataRequest)); + } + + using var message = CreateUpdateTranscriptionDataRequest(callConnectionId, updateTranscriptionDataRequest); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateStartHoldMusicRequest(string callConnectionId, StartHoldMusicRequestInternal startHoldMusicRequest) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/calling/callConnections/", false); + uri.AppendPath(callConnectionId, true); + uri.AppendPath(":startHoldMusic", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(startHoldMusicRequest); + request.Content = content; + return message; + } + + /// Hold participant from the call using identifier. + /// The call connection id. + /// The participants to be hold from the call. + /// The cancellation token to use. + /// or is null. + public async Task StartHoldMusicAsync(string callConnectionId, StartHoldMusicRequestInternal startHoldMusicRequest, CancellationToken cancellationToken = default) + { + if (callConnectionId == null) + { + throw new ArgumentNullException(nameof(callConnectionId)); + } + if (startHoldMusicRequest == null) + { + throw new ArgumentNullException(nameof(startHoldMusicRequest)); + } + + using var message = CreateStartHoldMusicRequest(callConnectionId, startHoldMusicRequest); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Hold participant from the call using identifier. + /// The call connection id. + /// The participants to be hold from the call. + /// The cancellation token to use. + /// or is null. + public Response StartHoldMusic(string callConnectionId, StartHoldMusicRequestInternal startHoldMusicRequest, CancellationToken cancellationToken = default) + { + if (callConnectionId == null) + { + throw new ArgumentNullException(nameof(callConnectionId)); + } + if (startHoldMusicRequest == null) + { + throw new ArgumentNullException(nameof(startHoldMusicRequest)); + } + + using var message = CreateStartHoldMusicRequest(callConnectionId, startHoldMusicRequest); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateStopHoldMusicRequest(string callConnectionId, StopHoldMusicRequestInternal stopHoldMusicRequest) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/calling/callConnections/", false); + uri.AppendPath(callConnectionId, true); + uri.AppendPath(":stopHoldMusic", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(stopHoldMusicRequest); + request.Content = content; + return message; + } + + /// Unhold participants from the call using identifier. + /// The call connection id. + /// The participants to be hold from the call. + /// The cancellation token to use. + /// or is null. + public async Task StopHoldMusicAsync(string callConnectionId, StopHoldMusicRequestInternal stopHoldMusicRequest, CancellationToken cancellationToken = default) + { + if (callConnectionId == null) + { + throw new ArgumentNullException(nameof(callConnectionId)); + } + if (stopHoldMusicRequest == null) + { + throw new ArgumentNullException(nameof(stopHoldMusicRequest)); + } + + using var message = CreateStopHoldMusicRequest(callConnectionId, stopHoldMusicRequest); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Unhold participants from the call using identifier. + /// The call connection id. + /// The participants to be hold from the call. + /// The cancellation token to use. + /// or is null. + public Response StopHoldMusic(string callConnectionId, StopHoldMusicRequestInternal stopHoldMusicRequest, CancellationToken cancellationToken = default) + { + if (callConnectionId == null) + { + throw new ArgumentNullException(nameof(callConnectionId)); + } + if (stopHoldMusicRequest == null) + { + throw new ArgumentNullException(nameof(stopHoldMusicRequest)); + } + + using var message = CreateStopHoldMusicRequest(callConnectionId, stopHoldMusicRequest); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnectionPropertiesInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnectionPropertiesInternal.Serialization.cs index c423598401c6..9efba12cb9b9 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnectionPropertiesInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnectionPropertiesInternal.Serialization.cs @@ -26,6 +26,7 @@ internal static CallConnectionPropertiesInternal DeserializeCallConnectionProper Optional callConnectionState = default; Optional callbackUri = default; Optional mediaSubscriptionId = default; + Optional dataSubscriptionId = default; Optional sourceCallerIdNumber = default; Optional sourceDisplayName = default; Optional sourceIdentity = default; @@ -76,6 +77,11 @@ internal static CallConnectionPropertiesInternal DeserializeCallConnectionProper mediaSubscriptionId = property.Value.GetString(); continue; } + if (property.NameEquals("dataSubscriptionId"u8)) + { + dataSubscriptionId = property.Value.GetString(); + continue; + } if (property.NameEquals("sourceCallerIdNumber"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -114,7 +120,7 @@ internal static CallConnectionPropertiesInternal DeserializeCallConnectionProper continue; } } - return new CallConnectionPropertiesInternal(callConnectionId.Value, serverCallId.Value, Optional.ToList(targets), Optional.ToNullable(callConnectionState), callbackUri.Value, mediaSubscriptionId.Value, sourceCallerIdNumber.Value, sourceDisplayName.Value, sourceIdentity.Value, correlationId.Value, answeredByIdentifier.Value); + return new CallConnectionPropertiesInternal(callConnectionId.Value, serverCallId.Value, Optional.ToList(targets), Optional.ToNullable(callConnectionState), callbackUri.Value, mediaSubscriptionId.Value, dataSubscriptionId.Value, sourceCallerIdNumber.Value, sourceDisplayName.Value, sourceIdentity.Value, correlationId.Value, answeredByIdentifier.Value); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnectionPropertiesInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnectionPropertiesInternal.cs index 923217d55125..7decc5334736 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnectionPropertiesInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnectionPropertiesInternal.cs @@ -27,6 +27,7 @@ internal CallConnectionPropertiesInternal() /// The state of the call connection. /// The callback URI. /// SubscriptionId for media streaming. + /// SubscriptionId for transcription. /// /// The source caller Id, a phone number, that's shown to the PSTN participant being invited. /// Required only when calling a PSTN callee. @@ -35,7 +36,7 @@ internal CallConnectionPropertiesInternal() /// Source identity. /// The correlation ID. /// Identity of the answering entity. Only populated when identity is provided in the request. - internal CallConnectionPropertiesInternal(string callConnectionId, string serverCallId, IReadOnlyList targets, CallConnectionState? callConnectionState, string callbackUri, string mediaSubscriptionId, PhoneNumberIdentifierModel sourceCallerIdNumber, string sourceDisplayName, CommunicationIdentifierModel sourceIdentity, string correlationId, CommunicationUserIdentifierModel answeredByIdentifier) + internal CallConnectionPropertiesInternal(string callConnectionId, string serverCallId, IReadOnlyList targets, CallConnectionState? callConnectionState, string callbackUri, string mediaSubscriptionId, string dataSubscriptionId, PhoneNumberIdentifierModel sourceCallerIdNumber, string sourceDisplayName, CommunicationIdentifierModel sourceIdentity, string correlationId, CommunicationUserIdentifierModel answeredByIdentifier) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; @@ -43,6 +44,7 @@ internal CallConnectionPropertiesInternal(string callConnectionId, string server CallConnectionState = callConnectionState; CallbackUri = callbackUri; MediaSubscriptionId = mediaSubscriptionId; + DataSubscriptionId = dataSubscriptionId; SourceCallerIdNumber = sourceCallerIdNumber; SourceDisplayName = sourceDisplayName; SourceIdentity = sourceIdentity; @@ -62,6 +64,8 @@ internal CallConnectionPropertiesInternal(string callConnectionId, string server public string CallbackUri { get; } /// SubscriptionId for media streaming. public string MediaSubscriptionId { get; } + /// SubscriptionId for transcription. + public string DataSubscriptionId { get; } /// /// The source caller Id, a phone number, that's shown to the PSTN participant being invited. /// Required only when calling a PSTN callee. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogInputType.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogInputType.cs index d6e981702996..a05ee979cc16 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogInputType.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogInputType.cs @@ -23,9 +23,12 @@ public DialogInputType(string value) } private const string PowerVirtualAgentsValue = "powerVirtualAgents"; + private const string AzureOpenAIValue = "azureOpenAI"; /// powerVirtualAgents. public static DialogInputType PowerVirtualAgents { get; } = new DialogInputType(PowerVirtualAgentsValue); + /// azureOpenAI. + public static DialogInputType AzureOpenAI { get; } = new DialogInputType(AzureOpenAIValue); /// Determines if two values are the same. public static bool operator ==(DialogInputType left, DialogInputType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogOptionsInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogOptionsInternal.Serialization.cs index 623f68f6f34d..29e69af21a0f 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogOptionsInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogOptionsInternal.Serialization.cs @@ -16,8 +16,11 @@ internal partial class DialogOptionsInternal : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - writer.WritePropertyName("botAppId"u8); - writer.WriteStringValue(BotAppId); + if (Optional.IsDefined(BotAppId)) + { + writer.WritePropertyName("botAppId"u8); + writer.WriteStringValue(BotAppId); + } writer.WritePropertyName("dialogContext"u8); writer.WriteStartObject(); foreach (var item in DialogContext) @@ -40,7 +43,7 @@ internal static DialogOptionsInternal DeserializeDialogOptionsInternal(JsonEleme { return null; } - string botAppId = default; + Optional botAppId = default; IDictionary dialogContext = default; foreach (var property in element.EnumerateObject()) { @@ -67,7 +70,7 @@ internal static DialogOptionsInternal DeserializeDialogOptionsInternal(JsonEleme continue; } } - return new DialogOptionsInternal(botAppId, dialogContext); + return new DialogOptionsInternal(botAppId.Value, dialogContext); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogOptionsInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogOptionsInternal.cs index ace1e2de2f6b..f323508028e3 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogOptionsInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogOptionsInternal.cs @@ -15,14 +15,20 @@ namespace Azure.Communication.CallAutomation internal partial class DialogOptionsInternal { /// Initializes a new instance of DialogOptionsInternal. - /// Bot identifier. /// Dialog context. - /// or is null. - public DialogOptionsInternal(string botAppId, IDictionary dialogContext) + /// is null. + public DialogOptionsInternal(IDictionary dialogContext) { - Argument.AssertNotNull(botAppId, nameof(botAppId)); Argument.AssertNotNull(dialogContext, nameof(dialogContext)); + DialogContext = dialogContext; + } + + /// Initializes a new instance of DialogOptionsInternal. + /// Bot identifier. + /// Dialog context. + internal DialogOptionsInternal(string botAppId, IDictionary dialogContext) + { BotAppId = botAppId; DialogContext = dialogContext; } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartHoldMusicRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartHoldMusicRequestInternal.Serialization.cs new file mode 100644 index 000000000000..e4103773fc86 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartHoldMusicRequestInternal.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.CallAutomation +{ + internal partial class StartHoldMusicRequestInternal : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("targetParticipant"u8); + writer.WriteObjectValue(TargetParticipant); + writer.WritePropertyName("playSourceInfo"u8); + writer.WriteObjectValue(PlaySourceInfo); + if (Optional.IsDefined(Loop)) + { + writer.WritePropertyName("loop"u8); + writer.WriteBooleanValue(Loop.Value); + } + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartHoldMusicRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartHoldMusicRequestInternal.cs new file mode 100644 index 000000000000..2332bb6c1ce1 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartHoldMusicRequestInternal.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Communication; +using Azure.Core; + +namespace Azure.Communication.CallAutomation +{ + /// The request payload for holding participant from the call. + internal partial class StartHoldMusicRequestInternal + { + /// Initializes a new instance of StartHoldMusicRequestInternal. + /// Participant to be held from the call. + /// Prompt to play while in hold. + /// or is null. + public StartHoldMusicRequestInternal(CommunicationIdentifierModel targetParticipant, PlaySourceInternal playSourceInfo) + { + Argument.AssertNotNull(targetParticipant, nameof(targetParticipant)); + Argument.AssertNotNull(playSourceInfo, nameof(playSourceInfo)); + + TargetParticipant = targetParticipant; + PlaySourceInfo = playSourceInfo; + } + + /// Participant to be held from the call. + public CommunicationIdentifierModel TargetParticipant { get; } + /// Prompt to play while in hold. + public PlaySourceInternal PlaySourceInfo { get; } + /// If the prompt will be looped or not. + public bool? Loop { get; set; } + /// Used by customers when calling mid-call actions to correlate the request to the response event. + public string OperationContext { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartTranscriptionRequest.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartTranscriptionRequest.Serialization.cs new file mode 100644 index 000000000000..59b2f0476102 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartTranscriptionRequest.Serialization.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.CallAutomation +{ + public partial class StartTranscriptionRequest : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Locale)) + { + writer.WritePropertyName("locale"u8); + writer.WriteStringValue(Locale); + } + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartTranscriptionRequest.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartTranscriptionRequest.cs new file mode 100644 index 000000000000..7d08c51e2484 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartTranscriptionRequest.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.CallAutomation +{ + /// The StartTranscriptionRequest. + public partial class StartTranscriptionRequest + { + /// Initializes a new instance of StartTranscriptionRequest. + public StartTranscriptionRequest() + { + } + + /// Defines Locale for the transcription e,g en-US. + public string Locale { get; set; } + /// The value to identify context of the operation. + public string OperationContext { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopHoldMusicRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopHoldMusicRequestInternal.Serialization.cs new file mode 100644 index 000000000000..c2b1c0006903 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopHoldMusicRequestInternal.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.CallAutomation +{ + internal partial class StopHoldMusicRequestInternal : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("targetParticipant"u8); + writer.WriteObjectValue(TargetParticipant); + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopHoldMusicRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopHoldMusicRequestInternal.cs new file mode 100644 index 000000000000..c70bfc183680 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopHoldMusicRequestInternal.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Communication; +using Azure.Core; + +namespace Azure.Communication.CallAutomation +{ + /// The request payload for holding participant from the call. + internal partial class StopHoldMusicRequestInternal + { + /// Initializes a new instance of StopHoldMusicRequestInternal. + /// + /// Participants to be hold from the call. + /// Only ACS Users are supported. + /// + /// is null. + public StopHoldMusicRequestInternal(CommunicationIdentifierModel targetParticipant) + { + Argument.AssertNotNull(targetParticipant, nameof(targetParticipant)); + + TargetParticipant = targetParticipant; + } + + /// + /// Participants to be hold from the call. + /// Only ACS Users are supported. + /// + public CommunicationIdentifierModel TargetParticipant { get; } + /// Used by customers when calling mid-call actions to correlate the request to the response event. + public string OperationContext { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopTranscriptionRequest.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopTranscriptionRequest.Serialization.cs new file mode 100644 index 000000000000..fdaebe2606e5 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopTranscriptionRequest.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.CallAutomation +{ + public partial class StopTranscriptionRequest : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopTranscriptionRequest.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopTranscriptionRequest.cs new file mode 100644 index 000000000000..362026753910 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopTranscriptionRequest.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.CallAutomation +{ + /// The StopTranscriptionRequest. + public partial class StopTranscriptionRequest + { + /// Initializes a new instance of StopTranscriptionRequest. + public StopTranscriptionRequest() + { + } + + /// The value to identify context of the operation. + public string OperationContext { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionFailed.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionFailed.cs new file mode 100644 index 000000000000..1f29ea9a23c5 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionFailed.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.CallAutomation +{ + /// The TranscriptionFailed. + internal partial class TranscriptionFailed + { + /// Initializes a new instance of TranscriptionFailed. + internal TranscriptionFailed() + { + } + + /// Call connection ID. + public string CallConnectionId { get; } + /// Server call ID. + public string ServerCallId { get; } + /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + public string CorrelationId { get; } + /// Used by customers when calling answerCall action to correlate the request to the response event. + public string OperationContext { get; } + /// Contains the resulting SIP code/sub-code and message from NGC services. + public ResultInformation ResultInformation { get; } + /// Defines the result for TranscriptionUpdate with the current status and the details about the status. + public TranscriptionUpdate TranscriptionUpdateResult { get; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionResumed.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionResumed.cs new file mode 100644 index 000000000000..b94d62cc9fd0 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionResumed.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.CallAutomation +{ + /// The TranscriptionResumed. + internal partial class TranscriptionResumed + { + /// Initializes a new instance of TranscriptionResumed. + internal TranscriptionResumed() + { + } + + /// Call connection ID. + public string CallConnectionId { get; } + /// Server call ID. + public string ServerCallId { get; } + /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + public string CorrelationId { get; } + /// Used by customers when calling answerCall action to correlate the request to the response event. + public string OperationContext { get; } + /// Contains the resulting SIP code/sub-code and message from NGC services. + public ResultInformation ResultInformation { get; } + /// Defines the result for TranscriptionUpdate with the current status and the details about the status. + public TranscriptionUpdate TranscriptionUpdateResult { get; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionStarted.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionStarted.cs new file mode 100644 index 000000000000..c97f91d1530e --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionStarted.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.CallAutomation +{ + /// The TranscriptionStarted. + internal partial class TranscriptionStarted + { + /// Initializes a new instance of TranscriptionStarted. + internal TranscriptionStarted() + { + } + + /// Call connection ID. + public string CallConnectionId { get; } + /// Server call ID. + public string ServerCallId { get; } + /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + public string CorrelationId { get; } + /// Used by customers when calling answerCall action to correlate the request to the response event. + public string OperationContext { get; } + /// Contains the resulting SIP code/sub-code and message from NGC services. + public ResultInformation ResultInformation { get; } + /// Defines the result for TranscriptionUpdate with the current status and the details about the status. + public TranscriptionUpdate TranscriptionUpdateResult { get; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionStopped.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionStopped.cs new file mode 100644 index 000000000000..82a7cb32cc47 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionStopped.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.CallAutomation +{ + /// The TranscriptionStopped. + internal partial class TranscriptionStopped + { + /// Initializes a new instance of TranscriptionStopped. + internal TranscriptionStopped() + { + } + + /// Call connection ID. + public string CallConnectionId { get; } + /// Server call ID. + public string ServerCallId { get; } + /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + public string CorrelationId { get; } + /// Used by customers when calling answerCall action to correlate the request to the response event. + public string OperationContext { get; } + /// Contains the resulting SIP code/sub-code and message from NGC services. + public ResultInformation ResultInformation { get; } + /// Defines the result for TranscriptionUpdate with the current status and the details about the status. + public TranscriptionUpdate TranscriptionUpdateResult { get; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionUpdate.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionUpdate.cs new file mode 100644 index 000000000000..25237c7ab8a3 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionUpdate.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.CallAutomation +{ + /// The TranscriptionUpdate. + internal partial class TranscriptionUpdate + { + /// Initializes a new instance of TranscriptionUpdate. + internal TranscriptionUpdate() + { + } + + /// Gets the transcription status. + public string TranscriptionStatus { get; } + /// Gets the transcription status details. + public string TranscriptionStatusDetails { get; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UpdateTranscriptionDataRequest.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UpdateTranscriptionDataRequest.Serialization.cs new file mode 100644 index 000000000000..0f76b6afdc77 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UpdateTranscriptionDataRequest.Serialization.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.CallAutomation +{ + public partial class UpdateTranscriptionDataRequest : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("locale"u8); + writer.WriteStringValue(Locale); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UpdateTranscriptionDataRequest.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UpdateTranscriptionDataRequest.cs new file mode 100644 index 000000000000..abc8246a960b --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UpdateTranscriptionDataRequest.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Communication.CallAutomation +{ + /// The UpdateTranscriptionDataRequest. + public partial class UpdateTranscriptionDataRequest + { + /// Initializes a new instance of UpdateTranscriptionDataRequest. + /// Defines new locale for transcription. + /// is null. + public UpdateTranscriptionDataRequest(string locale) + { + Argument.AssertNotNull(locale, nameof(locale)); + + Locale = locale; + } + + /// Defines new locale for transcription. + public string Locale { get; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/StartHoldMusicOptions.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/StartHoldMusicOptions.cs new file mode 100644 index 000000000000..3caef136ee80 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/StartHoldMusicOptions.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Azure.Communication.CallAutomation +{ + /// + /// Options for the Start Hold Music Request. + /// + public class StartHoldMusicOptions + { + /// + /// Creates a new StartHoldMusicOptions object. + /// + public StartHoldMusicOptions(CommunicationIdentifier targetParticipant, PlaySource playSourceInfo) + { + TargetParticipant = targetParticipant; + PlaySourceInfo = playSourceInfo; + Loop = true; + } + + /// + /// The participant that is going to be put on hold. + /// + public CommunicationIdentifier TargetParticipant { get; } + + /// + /// Prompt to play while on hold. + /// + public PlaySource PlaySourceInfo { get; set; } + + /// + /// If the prompt will be looped or not. + /// + public bool Loop { get; set; } + + /// + /// The operation context to correlate the request to the response event. + /// + public string OperationContext { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/StartHoldMusicRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/StartHoldMusicRequestInternal.cs new file mode 100644 index 000000000000..2f398fb6831d --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/StartHoldMusicRequestInternal.cs @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core; + +namespace Azure.Communication.CallAutomation +{ + [CodeGenModel("StartHoldMusicRequest")] + internal partial class StartHoldMusicRequestInternal + { + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/StopHoldMusicOptions.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/StopHoldMusicOptions.cs new file mode 100644 index 000000000000..bdcd88688c4f --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/StopHoldMusicOptions.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Azure.Communication.CallAutomation +{ + /// + /// Options for the Stop Hold Music Request. + /// + public class StopHoldMusicOptions + { + /// + /// Creates a new StopHoldMusicOptions object. + /// + public StopHoldMusicOptions(CommunicationIdentifier targetParticipant) + { + TargetParticipant = targetParticipant; + } + + /// + /// The participant that is currently on hold. + /// + public CommunicationIdentifier TargetParticipant { get; } + + /// + /// The operation context. + /// + public string OperationContext { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/StopHoldMusicRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/StopHoldMusicRequestInternal.cs new file mode 100644 index 000000000000..5e2e53f3a70e --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/StopHoldMusicRequestInternal.cs @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core; + +namespace Azure.Communication.CallAutomation +{ + [CodeGenModel("StopHoldMusicRequest")] + internal partial class StopHoldMusicRequestInternal + { + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/autorest.md b/sdk/communication/Azure.Communication.CallAutomation/src/autorest.md index 314e22d127ba..63aa64e69eda 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/autorest.md +++ b/sdk/communication/Azure.Communication.CallAutomation/src/autorest.md @@ -10,7 +10,7 @@ model-namespace: false tag: package-2023-01-15-preview require: - - https://github.com/williamzhao87/azure-rest-api-specs/blob/7b172efc00642d65e81aefbd7685bc356dac6759/specification/communication/data-plane/CallAutomation/readme.md + - https://github.com/williamzhao87/azure-rest-api-specs/blob/8f5bd72f81f7fa9020f6834f06f3db54a475ee68/specification/communication/data-plane/CallAutomation/readme.md title: Azure Communication Services diff --git a/sdk/communication/Azure.Communication.CallAutomation/tests/CallMedias/CallMediaTests.cs b/sdk/communication/Azure.Communication.CallAutomation/tests/CallMedias/CallMediaTests.cs index ede7e47b1346..016f0d8118e0 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/tests/CallMedias/CallMediaTests.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/tests/CallMedias/CallMediaTests.cs @@ -141,6 +141,16 @@ public class CallMediaTests : CallAutomationTestBase private static readonly CallMediaRecognizeOptions _emptyRecognizeOptions = new CallMediaRecognizeDtmfOptions(new CommunicationUserIdentifier("targetUserId"), maxTonesToCollect: 1); + private static readonly StartHoldMusicOptions _startHoldMusicOptions = new StartHoldMusicOptions(new CommunicationUserIdentifier("targetUserId"), _textSource) + { + OperationContext = "operationContext" + }; + + private static readonly StopHoldMusicOptions _stopHoldMusicOptions = new StopHoldMusicOptions(new CommunicationUserIdentifier("targetUserId")) + { + OperationContext = "operationContext" + }; + private static CallMedia? _callMedia; [SetUp] @@ -395,6 +405,24 @@ public void StopContinuousRecognizeOperations_Return404NotFound(Func> operation) + { + _callMedia = GetCallMedia(200); + var result = await operation(_callMedia); + Assert.IsNotNull(result); + Assert.AreEqual((int)HttpStatusCode.OK, result.Status); + } + + [TestCaseSource(nameof(TestData_HoldOperations))] + public void HoldMusicOperations_Return200Ok(Func operation) + { + _callMedia = GetCallMedia(200); + var result = operation(_callMedia); + Assert.IsNotNull(result); + Assert.AreEqual((int)HttpStatusCode.OK, result.Status); + } + private static IEnumerable TestData_PlayOperationsAsync() { return new[] @@ -605,5 +633,35 @@ public void StopContinuousRecognizeOperations_Return404NotFound(Func TestData_HoldOperationsAsync() + { + return new[] + { + new Func>?[] + { + callMedia => callMedia.StartHoldMusicAsync(_startHoldMusicOptions) + }, + new Func>?[] + { + callMedia => callMedia.StopHoldMusicAsync(_stopHoldMusicOptions) + } + }; + } + + private static IEnumerable TestData_HoldOperations() + { + return new[] + { + new Func?[] + { + callMedia => callMedia.StartHoldMusic(_startHoldMusicOptions) + }, + new Func?[] + { + callMedia => callMedia.StopHoldMusic(_stopHoldMusicOptions) + } + }; + } } }