diff --git a/sdk/communication/Azure.Communication.CallAutomation/CHANGELOG.md b/sdk/communication/Azure.Communication.CallAutomation/CHANGELOG.md index bbcb85fb77a1..8f626279745c 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/CHANGELOG.md +++ b/sdk/communication/Azure.Communication.CallAutomation/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.3.0-beta.1 (Unreleased) +## 1.4.0-beta.2 (Unreleased) ### Features Added @@ -10,6 +10,54 @@ ### Other Changes +## 1.4.0-beta.1 (2024-11-22) + +### Features Added + +- Added support for ConnectAPI to enable streaming and real-time transcription +- Enhanced media streaming with bidirectional capabilities, enabling support for audio formats in both directions. Currently, it supports sample rates of 24kHz and 16kHz + +### Other Changes + +- Introduced audio streaming and transcription data parsing capabilities. + +## 1.3.0 (2024-11-22) + +### Features Added + +- Support multiple play sources for Play and Recognize +- Support for PlayStarted event in Play/Recognize +- Hold and Unhold the participant +- CallDisconnected now includes more information on why the call has ended +- Support to manage the rooms/servercall/group call using connect API +- Expose original PSTN number target from incoming call event in call connection properties +- Support for VoIP to PSTN transfer scenario + +### Other Changes + +- Added CreateCallFailed event to signify when create call API fails to establish a call +- Added AnswerFailed event to signify when answer call API fails to answer a call + +## 1.3.0-beta.2 (2024-10-28) + +### Features Added + +- Added CreateCallFailed event to signify when create call API fails to establish a call + +## 1.3.0-beta.1 (2024-08-02) + +### Features Added + +- Support multiple play sources for Play and Recognize +- Support for PlayStarted event in Play/Recognize +- Support for the real time transcription +- Monetization for real-time transcription and audio streaming +- Hold and Unhold the participant +- Support to manage the rooms/servercall/group call using connect API +- Support for the audio streaming +- Expose original PSTN number target from incoming call event in call connection properties +- Support for VoIP to PSTN transfer scenario + ## 1.2.0 (2024-04-15) ### Features Added diff --git a/sdk/communication/Azure.Communication.CallAutomation/api/Azure.Communication.CallAutomation.net8.0.cs b/sdk/communication/Azure.Communication.CallAutomation/api/Azure.Communication.CallAutomation.net8.0.cs index b3f4c66ed5a6..77a46229fdbb 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/api/Azure.Communication.CallAutomation.net8.0.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/api/Azure.Communication.CallAutomation.net8.0.cs @@ -69,26 +69,45 @@ public partial class AnswerFailed : Azure.Communication.CallAutomation.CallAutom internal AnswerFailed() { } public static Azure.Communication.CallAutomation.AnswerFailed Deserialize(string content) { throw null; } } + [System.Text.Json.Serialization.JsonConverterAttribute(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public enum AudioChannel + { + Unknown = 0, + Mono = 1, + } public partial class AudioData : Azure.Communication.CallAutomation.StreamingData { - internal AudioData() { } - public string Data { get { throw null; } } + public AudioData(byte[] data) { } + public byte[] Data { get { throw null; } } public bool IsSilent { get { throw null; } } public Azure.Communication.CommunicationIdentifier Participant { get { throw null; } } - public System.DateTime Timestamp { get { throw null; } } + public System.DateTimeOffset Timestamp { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AudioFormat : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AudioFormat(string value) { throw null; } + public static Azure.Communication.CallAutomation.AudioFormat Pcm16KMono { get { throw null; } } + public static Azure.Communication.CallAutomation.AudioFormat Pcm24KMono { get { throw null; } } + public bool Equals(Azure.Communication.CallAutomation.AudioFormat other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Communication.CallAutomation.AudioFormat left, Azure.Communication.CallAutomation.AudioFormat right) { throw null; } + public static implicit operator Azure.Communication.CallAutomation.AudioFormat (string value) { throw null; } + public static bool operator !=(Azure.Communication.CallAutomation.AudioFormat left, Azure.Communication.CallAutomation.AudioFormat right) { throw null; } + public override string ToString() { throw null; } } public partial class AudioMetadata : Azure.Communication.CallAutomation.StreamingData { - public AudioMetadata() { } - [System.Text.Json.Serialization.JsonPropertyNameAttribute("channels")] - public int Channels { get { throw null; } set { } } - [System.Text.Json.Serialization.JsonPropertyNameAttribute("encoding")] + internal AudioMetadata() { } + public Azure.Communication.CallAutomation.AudioChannel Channels { get { throw null; } set { } } public string Encoding { get { throw null; } set { } } - [System.Text.Json.Serialization.JsonPropertyNameAttribute("length")] public int Length { get { throw null; } set { } } - [System.Text.Json.Serialization.JsonPropertyNameAttribute("subscriptionId")] public string MediaSubscriptionId { get { throw null; } set { } } - [System.Text.Json.Serialization.JsonPropertyNameAttribute("sampleRate")] public int SampleRate { get { throw null; } set { } } } public partial class AzureOpenAIDialog : Azure.Communication.CallAutomation.BaseDialog @@ -118,6 +137,10 @@ public CallAutomationClient(System.Uri pmaEndpoint, System.Uri acsEndpoint, Azur public virtual Azure.Response AnswerCall(string incomingCallContext, System.Uri callbackUri, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> AnswerCallAsync(Azure.Communication.CallAutomation.AnswerCallOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> AnswerCallAsync(string incomingCallContext, System.Uri callbackUri, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ConnectCall(Azure.Communication.CallAutomation.CallLocator callLocator, System.Uri callbackUri, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ConnectCall(Azure.Communication.CallAutomation.ConnectCallOptions connectCallOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ConnectCallAsync(Azure.Communication.CallAutomation.CallLocator callLocator, System.Uri callbackUri, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ConnectCallAsync(Azure.Communication.CallAutomation.ConnectCallOptions connectCallOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response CreateCall(Azure.Communication.CallAutomation.CallInvite callInvite, System.Uri callbackUri, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response CreateCall(Azure.Communication.CallAutomation.CreateCallOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> CreateCallAsync(Azure.Communication.CallAutomation.CallInvite callInvite, System.Uri callbackUri, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -138,7 +161,7 @@ public CallAutomationClient(System.Uri pmaEndpoint, System.Uri acsEndpoint, Azur } public partial class CallAutomationClientOptions : Azure.Core.ClientOptions { - public CallAutomationClientOptions(Azure.Communication.CallAutomation.CallAutomationClientOptions.ServiceVersion version = Azure.Communication.CallAutomation.CallAutomationClientOptions.ServiceVersion.V2023_10_03_Preview) { } + public CallAutomationClientOptions(Azure.Communication.CallAutomation.CallAutomationClientOptions.ServiceVersion version = Azure.Communication.CallAutomation.CallAutomationClientOptions.ServiceVersion.V2024_09_01_Preview) { } public Azure.Communication.MicrosoftTeamsAppIdentifier OPSSource { get { throw null; } set { } } public Azure.Communication.CommunicationUserIdentifier Source { get { throw null; } set { } } public enum ServiceVersion @@ -147,6 +170,7 @@ public enum ServiceVersion V2023_06_15_Preview = 2, V2023_10_15 = 3, V2023_10_03_Preview = 4, + V2024_09_01_Preview = 5, } } public abstract partial class CallAutomationEventBase @@ -185,17 +209,16 @@ public static partial class CallAutomationModelFactory public static Azure.Communication.CallAutomation.AddParticipantSucceeded AddParticipantSucceeded(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, Azure.Communication.CommunicationIdentifier participant = null) { throw null; } public static Azure.Communication.CallAutomation.AnswerCallResult AnswerCallResult(Azure.Communication.CallAutomation.CallConnection callConnection = null, Azure.Communication.CallAutomation.CallConnectionProperties callConnectionProperties = null) { throw null; } public static Azure.Communication.CallAutomation.AnswerFailed AnswerFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, string operationContext = null) { throw null; } - public static Azure.Communication.CallAutomation.CallConnected CallConnected(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null) { throw null; } - public static Azure.Communication.CallAutomation.CallConnectionProperties CallConnectionProperties(string callConnectionId = null, string serverCallId = null, System.Collections.Generic.IEnumerable targets = null, Azure.Communication.CallAutomation.CallConnectionState callConnectionState = default(Azure.Communication.CallAutomation.CallConnectionState), System.Uri callbackUri = null, Azure.Communication.CommunicationIdentifier sourceIdentity = null, Azure.Communication.PhoneNumberIdentifier sourceCallerIdNumber = null, string sourceDisplayName = null, Azure.Communication.CommunicationUserIdentifier answeredBy = null, string mediaSubscriptionId = null, string dataSubscriptionId = null) { throw null; } - public static Azure.Communication.CallAutomation.CallDisconnected CallDisconnected(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null) { throw null; } + public static Azure.Communication.CallAutomation.CallConnected CallConnected(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } + public static Azure.Communication.CallAutomation.CallConnectionProperties CallConnectionProperties(string callConnectionId = null, string serverCallId = null, System.Collections.Generic.IEnumerable targets = null, Azure.Communication.CallAutomation.CallConnectionState callConnectionState = default(Azure.Communication.CallAutomation.CallConnectionState), System.Uri callbackUri = null, Azure.Communication.CommunicationIdentifier sourceIdentity = null, Azure.Communication.PhoneNumberIdentifier sourceCallerIdNumber = null, string sourceDisplayName = null, Azure.Communication.CommunicationUserIdentifier answeredBy = null, Azure.Communication.CallAutomation.MediaStreamingSubscription mediaStreamingSubscription = null, Azure.Communication.CallAutomation.TranscriptionSubscription transcriptionSubscription = null, Azure.Communication.PhoneNumberIdentifier answeredFor = null) { throw null; } + public static Azure.Communication.CallAutomation.CallDisconnected CallDisconnected(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } public static Azure.Communication.CallAutomation.CallParticipant CallParticipant(Azure.Communication.CommunicationIdentifier identifier = null, bool isMuted = false, bool isOnHold = false) { throw null; } public static Azure.Communication.CallAutomation.CallTransferAccepted CallTransferAccepted(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, Azure.Communication.CommunicationIdentifier transferee = null, Azure.Communication.CommunicationIdentifier transferTarget = null) { throw null; } public static Azure.Communication.CallAutomation.CallTransferFailed CallTransferFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } public static Azure.Communication.CallAutomation.CancelAddParticipantFailed CancelAddParticipantFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, string invitationId = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, string operationContext = null) { throw null; } public static Azure.Communication.CallAutomation.CancelAddParticipantOperationResult CancelAddParticipantResult(string invitationId = null, string operationContext = null) { throw null; } - public static Azure.Communication.CallAutomation.CancelAddParticipantSucceeded CancelAddParticipantSucceeded(string callConnectionId = null, string serverCallId = null, string correlationId = null, string invitationId = null, Azure.Communication.CommunicationIdentifier participant = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } + public static Azure.Communication.CallAutomation.CancelAddParticipantSucceeded CancelAddParticipantSucceeded(string callConnectionId = null, string serverCallId = null, string correlationId = null, string invitationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } public static Azure.Communication.CallAutomation.ChoiceResult ChoiceResult(string label = null, string recognizedPhrase = null) { throw null; } - public static Azure.Communication.CallAutomation.CollectTonesResult CollectTonesResult(System.Collections.Generic.IEnumerable tones = null) { throw null; } public static Azure.Communication.CallAutomation.ContinuousDtmfRecognitionStopped ContinuousDtmfRecognitionStopped(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } public static Azure.Communication.CallAutomation.ContinuousDtmfRecognitionToneFailed ContinuousDtmfRecognitionToneFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, string operationContext = null) { throw null; } public static Azure.Communication.CallAutomation.ContinuousDtmfRecognitionToneReceived ContinuousDtmfRecognitionToneReceived(int? sequenceId = default(int?), Azure.Communication.CallAutomation.DtmfTone? tone = default(Azure.Communication.CallAutomation.DtmfTone?), string callConnectionId = null, string serverCallId = null, string correlationId = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, string operationContext = null) { throw null; } @@ -203,21 +226,19 @@ public static partial class CallAutomationModelFactory public static Azure.Communication.CallAutomation.CreateCallResult CreateCallResult(Azure.Communication.CallAutomation.CallConnection callConnection = null, Azure.Communication.CallAutomation.CallConnectionProperties callConnectionProperties = null) { throw null; } public static Azure.Communication.CallAutomation.DtmfResult DtmfResult(System.Collections.Generic.IEnumerable tones = null) { throw null; } public static Azure.Communication.CallAutomation.HoldFailed HoldFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } - public static Azure.Communication.CallAutomation.MediaStreamingFailed MediaStreamingFailed(string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, Azure.Communication.CallAutomation.MediaStreamingUpdate mediaStreamingUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null) { throw null; } - public static Azure.Communication.CallAutomation.MediaStreamingStarted MediaStreamingStarted(string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, Azure.Communication.CallAutomation.MediaStreamingUpdate mediaStreamingUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null) { throw null; } - public static Azure.Communication.CallAutomation.MediaStreamingStopped MediaStreamingStopped(string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, Azure.Communication.CallAutomation.MediaStreamingUpdate mediaStreamingUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null) { throw null; } + public static Azure.Communication.CallAutomation.MediaStreamingFailed MediaStreamingFailed(Azure.Communication.CallAutomation.MediaStreamingUpdate mediaStreamingUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } + public static Azure.Communication.CallAutomation.MediaStreamingStarted MediaStreamingStarted(Azure.Communication.CallAutomation.MediaStreamingUpdate mediaStreamingUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } + public static Azure.Communication.CallAutomation.MediaStreamingStopped MediaStreamingStopped(Azure.Communication.CallAutomation.MediaStreamingUpdate mediaStreamingUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } public static Azure.Communication.CallAutomation.MediaStreamingUpdate MediaStreamingUpdate(string contentType = null, Azure.Communication.CallAutomation.MediaStreamingStatus? mediaStreamingStatus = default(Azure.Communication.CallAutomation.MediaStreamingStatus?), Azure.Communication.CallAutomation.MediaStreamingStatusDetails? mediaStreamingStatusDetails = default(Azure.Communication.CallAutomation.MediaStreamingStatusDetails?)) { throw null; } public static Azure.Communication.CallAutomation.MuteParticipantResult MuteParticipantResult(string operationContext = null) { throw null; } - public static Azure.Communication.CallAutomation.ParticipantsUpdated ParticipantsUpdated(string callConnectionId = null, string serverCallId = null, string correlationId = null, System.Collections.Generic.IEnumerable participants = null, int sequenceNumber = 0) { throw null; } - public static Azure.Communication.CallAutomation.PlayCanceled PlayCanceled(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null) { throw null; } + public static Azure.Communication.CallAutomation.ParticipantsUpdated ParticipantsUpdated(string callConnectionId = null, string serverCallId = null, string correlationId = null, System.Collections.Generic.IEnumerable participants = null, int sequenceNumber = 0, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } + public static Azure.Communication.CallAutomation.PlayCanceled PlayCanceled(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } public static Azure.Communication.CallAutomation.PlayCompleted PlayCompleted(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } - public static Azure.Communication.CallAutomation.PlayFailed PlayFailed(string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, int? failedPlaySourceIndex = default(int?), string callConnectionId = null, string serverCallId = null, string correlationId = null) { throw null; } - public static Azure.Communication.CallAutomation.PlayFailed PlayFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } - public static Azure.Communication.CallAutomation.RecognizeCanceled RecognizeCanceled(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null) { throw null; } + public static Azure.Communication.CallAutomation.PlayFailed PlayFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, int? failedPlaySourceIndex = default(int?)) { throw null; } + public static Azure.Communication.CallAutomation.RecognizeCanceled RecognizeCanceled(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } public static Azure.Communication.CallAutomation.RecognizeCompleted RecognizeCompleted(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, Azure.Communication.CallAutomation.CallMediaRecognitionType recognitionType = default(Azure.Communication.CallAutomation.CallMediaRecognitionType), Azure.Communication.CallAutomation.RecognizeResult recognizeResult = null) { throw null; } - public static Azure.Communication.CallAutomation.RecognizeFailed RecognizeFailed(string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, int? failedPlaySourceIndex = default(int?), string callConnectionId = null, string serverCallId = null, string correlationId = null) { throw null; } - public static Azure.Communication.CallAutomation.RecognizeFailed RecognizeFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } - public static Azure.Communication.CallAutomation.RecordingStateChanged RecordingStateChanged(string callConnectionId = null, string serverCallId = null, string correlationId = null, string recordingId = null, Azure.Communication.CallAutomation.RecordingState state = default(Azure.Communication.CallAutomation.RecordingState), System.DateTimeOffset? startDateTime = default(System.DateTimeOffset?), Azure.Communication.CallAutomation.RecordingKind? recordingKind = default(Azure.Communication.CallAutomation.RecordingKind?)) { throw null; } + public static Azure.Communication.CallAutomation.RecognizeFailed RecognizeFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, int? failedPlaySourceIndex = default(int?)) { throw null; } + public static Azure.Communication.CallAutomation.RecordingStateChanged RecordingStateChanged(string callConnectionId = null, string serverCallId = null, string correlationId = null, string recordingId = null, Azure.Communication.CallAutomation.RecordingState state = default(Azure.Communication.CallAutomation.RecordingState), System.DateTimeOffset? startDateTime = default(System.DateTimeOffset?), Azure.Communication.CallAutomation.RecordingKind? recordingKind = default(Azure.Communication.CallAutomation.RecordingKind?), Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } public static Azure.Communication.CallAutomation.RecordingStateResult RecordingStateResult(string recordingId = null, Azure.Communication.CallAutomation.RecordingState? recordingState = default(Azure.Communication.CallAutomation.RecordingState?), Azure.Communication.CallAutomation.RecordingKind? recordingKind = default(Azure.Communication.CallAutomation.RecordingKind?)) { throw null; } public static Azure.Communication.CallAutomation.RemoveParticipantFailed RemoveParticipantFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, Azure.Communication.CommunicationIdentifier participant = null) { throw null; } public static Azure.Communication.CallAutomation.RemoveParticipantResult RemoveParticipantResult(string operationContext = null) { throw null; } @@ -227,11 +248,11 @@ public static partial class CallAutomationModelFactory public static Azure.Communication.CallAutomation.SendDtmfTonesFailed SendDtmfTonesFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } public static Azure.Communication.CallAutomation.SendDtmfTonesResult SendDtmfTonesResult(string operationContext = null) { throw null; } public static Azure.Communication.CallAutomation.SpeechResult SpeechResult(string speech = null) { throw null; } - public static Azure.Communication.CallAutomation.TranscriptionFailed TranscriptionFailed(string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, Azure.Communication.CallAutomation.TranscriptionUpdate transcriptionUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null) { throw null; } - public static Azure.Communication.CallAutomation.TranscriptionStarted TranscriptionStarted(string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, Azure.Communication.CallAutomation.TranscriptionUpdate transcriptionUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null) { throw null; } - public static Azure.Communication.CallAutomation.TranscriptionStopped TranscriptionStopped(string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, Azure.Communication.CallAutomation.TranscriptionUpdate transcriptionUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null) { throw null; } + public static Azure.Communication.CallAutomation.TranscriptionFailed TranscriptionFailed(Azure.Communication.CallAutomation.TranscriptionUpdate transcriptionUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } + public static Azure.Communication.CallAutomation.TranscriptionStarted TranscriptionStarted(Azure.Communication.CallAutomation.TranscriptionUpdate transcriptionUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } + public static Azure.Communication.CallAutomation.TranscriptionStopped TranscriptionStopped(Azure.Communication.CallAutomation.TranscriptionUpdate transcriptionUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } public static Azure.Communication.CallAutomation.TranscriptionUpdate TranscriptionUpdate(Azure.Communication.CallAutomation.TranscriptionStatus? transcriptionStatus = default(Azure.Communication.CallAutomation.TranscriptionStatus?), Azure.Communication.CallAutomation.TranscriptionStatusDetails? transcriptionStatusDetails = default(Azure.Communication.CallAutomation.TranscriptionStatusDetails?)) { throw null; } - public static Azure.Communication.CallAutomation.TranscriptionUpdated TranscriptionUpdated(string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, Azure.Communication.CallAutomation.TranscriptionUpdate transcriptionUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null) { throw null; } + public static Azure.Communication.CallAutomation.TranscriptionUpdated TranscriptionUpdated(Azure.Communication.CallAutomation.TranscriptionUpdate transcriptionUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } public static Azure.Communication.CallAutomation.TransferCallToParticipantResult TransferCallToParticipantResult(string operationContext = null) { throw null; } public static Azure.Communication.CallAutomation.UnmuteParticipantResult UnmuteParticipantResult(string operationContext = null) { throw null; } public static Azure.Communication.CallAutomation.UserConsent UserConsent(int? recording = default(int?)) { throw null; } @@ -284,17 +305,18 @@ public partial class CallConnectionProperties { internal CallConnectionProperties() { } public Azure.Communication.CommunicationUserIdentifier AnsweredBy { get { throw null; } } + public Azure.Communication.PhoneNumberIdentifier AnsweredFor { get { throw null; } } public System.Uri CallbackUri { get { throw null; } } public string CallConnectionId { get { throw null; } } public Azure.Communication.CallAutomation.CallConnectionState CallConnectionState { get { throw null; } } public string CorrelationId { get { throw null; } } - public string DataSubscriptionId { get { throw null; } } - public string MediaSubscriptionId { get { throw null; } } + public Azure.Communication.CallAutomation.MediaStreamingSubscription MediaStreamingSubscription { get { throw null; } } public string ServerCallId { get { throw null; } } public Azure.Communication.CommunicationIdentifier Source { get { throw null; } } public Azure.Communication.PhoneNumberIdentifier SourceCallerIdNumber { get { throw null; } } public string SourceDisplayName { get { throw null; } } public System.Collections.Generic.IReadOnlyList Targets { get { throw null; } } + public Azure.Communication.CallAutomation.TranscriptionSubscription TranscriptionSubscription { get { throw null; } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct CallConnectionState : System.IEquatable @@ -366,15 +388,23 @@ protected CallMedia() { } public virtual Azure.Response CancelAllMediaOperations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> CancelAllMediaOperationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Hold(Azure.Communication.CallAutomation.HoldOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Hold(Azure.Communication.CommunicationIdentifier targetParticipant, Azure.Communication.CallAutomation.PlaySource playSource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Hold(Azure.Communication.CommunicationIdentifier targetParticipant, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task HoldAsync(Azure.Communication.CallAutomation.HoldOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task HoldAsync(Azure.Communication.CommunicationIdentifier targetParticipant, Azure.Communication.CallAutomation.PlaySource playSource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task HoldAsync(Azure.Communication.CommunicationIdentifier targetParticipant, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Play(Azure.Communication.CallAutomation.PlayOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Play(Azure.Communication.CallAutomation.PlaySource playSource, System.Collections.Generic.IEnumerable playTo, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Play(System.Collections.Generic.IEnumerable playSources, System.Collections.Generic.IEnumerable playTo, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> PlayAsync(Azure.Communication.CallAutomation.PlayOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> PlayAsync(Azure.Communication.CallAutomation.PlaySource playSource, System.Collections.Generic.IEnumerable playTo, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> PlayAsync(System.Collections.Generic.IEnumerable playSources, System.Collections.Generic.IEnumerable playTo, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response PlayToAll(Azure.Communication.CallAutomation.PlaySource playSource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response PlayToAll(Azure.Communication.CallAutomation.PlayToAllOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response PlayToAll(System.Collections.Generic.IEnumerable playSources, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> PlayToAllAsync(Azure.Communication.CallAutomation.PlaySource playSource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> PlayToAllAsync(Azure.Communication.CallAutomation.PlayToAllOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> PlayToAllAsync(System.Collections.Generic.IEnumerable playSources, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response SendDtmfTones(Azure.Communication.CallAutomation.SendDtmfTonesOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response SendDtmfTones(System.Collections.Generic.IEnumerable tones, Azure.Communication.CommunicationIdentifier targetParticipant, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> SendDtmfTonesAsync(Azure.Communication.CallAutomation.SendDtmfTonesOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -383,10 +413,8 @@ protected CallMedia() { } public virtual Azure.Response StartContinuousDtmfRecognition(Azure.Communication.CommunicationIdentifier targetParticipant, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task StartContinuousDtmfRecognitionAsync(Azure.Communication.CallAutomation.ContinuousDtmfRecognitionOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task StartContinuousDtmfRecognitionAsync(Azure.Communication.CommunicationIdentifier targetParticipant, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - [System.ObsoleteAttribute("This operations is deprecated, please us Hold instead.")] - public virtual Azure.Response StartHoldMusic(Azure.Communication.CallAutomation.StartHoldMusicOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - [System.ObsoleteAttribute("This operations is deprecated, please us HoldAsync instead.")] - 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 StartMediaStreaming(Azure.Communication.CallAutomation.StartMediaStreamingOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task StartMediaStreamingAsync(Azure.Communication.CallAutomation.StartMediaStreamingOptions options = null, 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 StartTranscription(Azure.Communication.CallAutomation.StartTranscriptionOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -395,15 +423,17 @@ protected CallMedia() { } public virtual Azure.Response StopContinuousDtmfRecognition(Azure.Communication.CommunicationIdentifier targetParticipant, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task StopContinuousDtmfRecognitionAsync(Azure.Communication.CallAutomation.ContinuousDtmfRecognitionOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task StopContinuousDtmfRecognitionAsync(Azure.Communication.CommunicationIdentifier targetParticipant, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - [System.ObsoleteAttribute("This operations is deprecated, please us Unhold instead.")] - public virtual Azure.Response StopHoldMusic(Azure.Communication.CallAutomation.StopHoldMusicOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - [System.ObsoleteAttribute("This operations is deprecated, please us UnholdAsync instead.")] - public virtual System.Threading.Tasks.Task StopHoldMusicAsync(Azure.Communication.CallAutomation.StopHoldMusicOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response StopMediaStreaming(Azure.Communication.CallAutomation.StopMediaStreamingOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task StopMediaStreamingAsync(Azure.Communication.CallAutomation.StopMediaStreamingOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response StopTranscription(Azure.Communication.CallAutomation.StopTranscriptionOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task StopTranscriptionAsync(Azure.Communication.CallAutomation.StopTranscriptionOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Unhold(Azure.Communication.CallAutomation.UnholdOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Unhold(Azure.Communication.CommunicationIdentifier targetParticipant, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task UnholdAsync(Azure.Communication.CallAutomation.UnholdOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task UnholdAsync(Azure.Communication.CommunicationIdentifier targetParticipant, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response UpdateTranscription(Azure.Communication.CallAutomation.UpdateTranscriptionOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response UpdateTranscription(string locale, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task UpdateTranscriptionAsync(Azure.Communication.CallAutomation.UpdateTranscriptionOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task UpdateTranscriptionAsync(string locale, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] @@ -446,6 +476,7 @@ protected CallMediaRecognizeOptions(Azure.Communication.CallAutomation.Recognize public bool InterruptPrompt { get { throw null; } set { } } public System.Uri OperationCallbackUri { get { throw null; } set { } } public string OperationContext { get { throw null; } set { } } + public System.Collections.Generic.IList PlayPrompts { get { throw null; } set { } } public Azure.Communication.CallAutomation.PlaySource Prompt { get { throw null; } set { } } public string SpeechLanguage { get { throw null; } set { } } public string SpeechModelEndpointId { get { throw null; } set { } } @@ -586,12 +617,35 @@ internal ChoiceResult() { } public string RecognizedPhrase { get { throw null; } } public override Azure.Communication.CallAutomation.RecognizeResultType ResultType { get { throw null; } } } - public partial class CollectTonesResult : Azure.Communication.CallAutomation.RecognizeResult + public partial class ConnectCallEventResult { - internal CollectTonesResult() { } - public override Azure.Communication.CallAutomation.RecognizeResultType ResultType { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Tones { get { throw null; } } - public string ConvertToString() { throw null; } + internal ConnectCallEventResult() { } + public Azure.Communication.CallAutomation.ConnectFailed FailureResult { get { throw null; } } + public bool IsSuccess { get { throw null; } } + public Azure.Communication.CallAutomation.CallConnected SuccessResult { get { throw null; } } + } + public partial class ConnectCallOptions + { + public ConnectCallOptions(Azure.Communication.CallAutomation.CallLocator callLocator, System.Uri callbackUri) { } + public System.Uri CallbackUri { get { throw null; } } + public Azure.Communication.CallAutomation.CallIntelligenceOptions CallIntelligenceOptions { get { throw null; } set { } } + public Azure.Communication.CallAutomation.CallLocator CallLocator { get { throw null; } } + public Azure.Communication.CallAutomation.MediaStreamingOptions MediaStreamingOptions { get { throw null; } set { } } + public string OperationContext { get { throw null; } set { } } + public Azure.Communication.CallAutomation.TranscriptionOptions TranscriptionOptions { get { throw null; } set { } } + } + public partial class ConnectCallResult + { + internal ConnectCallResult() { } + public Azure.Communication.CallAutomation.CallConnection CallConnection { get { throw null; } } + public Azure.Communication.CallAutomation.CallConnectionProperties CallConnectionProperties { get { throw null; } } + public Azure.Communication.CallAutomation.ConnectCallEventResult WaitForEventProcessor(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public System.Threading.Tasks.Task WaitForEventProcessorAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ConnectFailed : Azure.Communication.CallAutomation.CallAutomationEventBase + { + internal ConnectFailed() { } + public static Azure.Communication.CallAutomation.ConnectFailed Deserialize(string content) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public partial struct ContentTransferOptions : System.IEquatable @@ -857,6 +911,12 @@ public GroupCallLocator(string id) { } public override int GetHashCode() { throw null; } public override string ToString() { throw null; } } + public partial class HoldEventResult + { + internal HoldEventResult() { } + public Azure.Communication.CallAutomation.HoldFailed FailureResult { get { throw null; } } + public bool IsSuccess { get { throw null; } } + } public partial class HoldFailed : Azure.Communication.CallAutomation.CallAutomationEventBase { internal HoldFailed() { } @@ -868,9 +928,15 @@ public partial class HoldOptions public HoldOptions(Azure.Communication.CommunicationIdentifier targetParticipant) { } public System.Uri OperationCallbackUri { get { throw null; } set { } } public string OperationContext { get { throw null; } set { } } - public Azure.Communication.CallAutomation.PlaySource PlaySourceInfo { get { throw null; } set { } } + public Azure.Communication.CallAutomation.PlaySource PlaySource { get { throw null; } set { } } public Azure.Communication.CommunicationIdentifier TargetParticipant { get { throw null; } } } + public partial class HoldResult + { + internal HoldResult() { } + public Azure.Communication.CallAutomation.HoldEventResult WaitForEventProcessor(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public System.Threading.Tasks.Task WaitForEventProcessorAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } public partial class IncomingCall : Azure.Communication.CallAutomation.CallAutomationEventBase { internal IncomingCall() { } @@ -916,6 +982,12 @@ internal IncomingCall() { } public static bool operator !=(Azure.Communication.CallAutomation.MediaEventReasonCode left, Azure.Communication.CallAutomation.MediaEventReasonCode right) { throw null; } public override string ToString() { throw null; } } + [System.Text.Json.Serialization.JsonConverterAttribute(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public enum MediaKind + { + AudioData = 0, + StopAudio = 1, + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct MediaStreamingAudioChannel : System.IEquatable { @@ -934,14 +1006,6 @@ internal IncomingCall() { } public static bool operator !=(Azure.Communication.CallAutomation.MediaStreamingAudioChannel left, Azure.Communication.CallAutomation.MediaStreamingAudioChannel right) { throw null; } public override string ToString() { throw null; } } - public partial class MediaStreamingConfiguration - { - public MediaStreamingConfiguration(System.Uri transportUrl, Azure.Communication.CallAutomation.MediaStreamingTransport transportType, Azure.Communication.CallAutomation.MediaStreamingContent contentType, Azure.Communication.CallAutomation.MediaStreamingAudioChannel audioChannelType) { } - public Azure.Communication.CallAutomation.MediaStreamingAudioChannel AudioChannelType { get { throw null; } } - public Azure.Communication.CallAutomation.MediaStreamingContent ContentType { get { throw null; } } - public Azure.Communication.CallAutomation.MediaStreamingTransport TransportType { get { throw null; } } - public System.Uri TransportUrl { get { throw null; } } - } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct MediaStreamingContent : System.IEquatable { @@ -967,10 +1031,13 @@ internal MediaStreamingFailed() { } } public partial class MediaStreamingOptions { - public MediaStreamingOptions(System.Uri transportUri, Azure.Communication.CallAutomation.MediaStreamingTransport transportType, Azure.Communication.CallAutomation.MediaStreamingContent contentType, Azure.Communication.CallAutomation.MediaStreamingAudioChannel audioChannelType) { } + public MediaStreamingOptions(System.Uri transportUri, Azure.Communication.CallAutomation.MediaStreamingContent contentType, Azure.Communication.CallAutomation.MediaStreamingAudioChannel audioChannelType, Azure.Communication.CallAutomation.MediaStreamingTransport transportType = default(Azure.Communication.CallAutomation.MediaStreamingTransport), bool? startMediaStreaming = default(bool?)) { } + public Azure.Communication.CallAutomation.AudioFormat? AudioFormat { get { throw null; } set { } } + public bool? EnableBidirectional { get { throw null; } set { } } public Azure.Communication.CallAutomation.MediaStreamingAudioChannel MediaStreamingAudioChannel { get { throw null; } } public Azure.Communication.CallAutomation.MediaStreamingContent MediaStreamingContent { get { throw null; } } public Azure.Communication.CallAutomation.MediaStreamingTransport MediaStreamingTransport { get { throw null; } } + public bool? StartMediaStreaming { get { throw null; } set { } } public System.Uri TransportUri { get { throw null; } } } public partial class MediaStreamingStarted : Azure.Communication.CallAutomation.CallAutomationEventBase @@ -1036,6 +1103,32 @@ internal MediaStreamingStopped() { } public Azure.Communication.CallAutomation.MediaStreamingUpdate MediaStreamingUpdate { get { throw null; } } public static Azure.Communication.CallAutomation.MediaStreamingStopped Deserialize(string content) { throw null; } } + public partial class MediaStreamingSubscription + { + public MediaStreamingSubscription(string id, Azure.Communication.CallAutomation.MediaStreamingSubscriptionState? state, System.Collections.Generic.IReadOnlyList subscribedContentTypes) { } + public string Id { get { throw null; } } + public Azure.Communication.CallAutomation.MediaStreamingSubscriptionState? State { get { throw null; } } + public System.Collections.Generic.IReadOnlyList SubscribedContentTypes { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct MediaStreamingSubscriptionState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public MediaStreamingSubscriptionState(string value) { throw null; } + public static Azure.Communication.CallAutomation.MediaStreamingSubscriptionState Active { get { throw null; } } + public static Azure.Communication.CallAutomation.MediaStreamingSubscriptionState Disabled { get { throw null; } } + public static Azure.Communication.CallAutomation.MediaStreamingSubscriptionState Inactive { get { throw null; } } + public bool Equals(Azure.Communication.CallAutomation.MediaStreamingSubscriptionState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Communication.CallAutomation.MediaStreamingSubscriptionState left, Azure.Communication.CallAutomation.MediaStreamingSubscriptionState right) { throw null; } + public static implicit operator Azure.Communication.CallAutomation.MediaStreamingSubscriptionState (string value) { throw null; } + public static bool operator !=(Azure.Communication.CallAutomation.MediaStreamingSubscriptionState left, Azure.Communication.CallAutomation.MediaStreamingSubscriptionState right) { throw null; } + public override string ToString() { throw null; } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct MediaStreamingTransport : System.IEquatable { @@ -1071,6 +1164,15 @@ public partial class MuteParticipantResult internal MuteParticipantResult() { } public string OperationContext { get { throw null; } } } + public partial class OutStreamingData + { + internal OutStreamingData() { } + public Azure.Communication.CallAutomation.AudioData AudioData { get { throw null; } } + public Azure.Communication.CallAutomation.MediaKind Kind { get { throw null; } } + public Azure.Communication.CallAutomation.StopAudio StopAudio { get { throw null; } } + public static string GetAudioDataForOutbound(byte[] audioData) { throw null; } + public static string GetStopAudioForOutbound() { throw null; } + } public partial class ParticipantsUpdated : Azure.Communication.CallAutomation.CallAutomationEventBase { internal ParticipantsUpdated() { } @@ -1124,6 +1226,11 @@ public abstract partial class PlaySource protected PlaySource() { } public string PlaySourceCacheId { get { throw null; } set { } } } + public partial class PlayStarted : Azure.Communication.CallAutomation.CallAutomationEventBase + { + internal PlayStarted() { } + public static Azure.Communication.CallAutomation.PlayStarted Deserialize(string content) { throw null; } + } public partial class PlayToAllOptions { public PlayToAllOptions(Azure.Communication.CallAutomation.PlaySource playSource) { } @@ -1398,10 +1505,12 @@ internal ResultInformation() { } public string Message { get { throw null; } } public int? SubCode { get { throw null; } } } - public enum ResultStatus + public partial class RoomCallLocator : Azure.Communication.CallAutomation.CallLocator { - Intermediate = 0, - Final = 1, + public RoomCallLocator(string id) { } + public override bool Equals(Azure.Communication.CallAutomation.CallLocator other) { throw null; } + public override int GetHashCode() { throw null; } + public override string ToString() { throw null; } } public partial class SendDtmfTonesCompleted : Azure.Communication.CallAutomation.CallAutomationEventBase { @@ -1470,6 +1579,12 @@ public StartHoldMusicOptions(Azure.Communication.CommunicationIdentifier targetP public Azure.Communication.CallAutomation.PlaySource PlaySourceInfo { get { throw null; } set { } } public Azure.Communication.CommunicationIdentifier TargetParticipant { get { throw null; } } } + public partial class StartMediaStreamingOptions + { + public StartMediaStreamingOptions() { } + public System.Uri OperationCallbackUri { get { throw null; } set { } } + public string OperationContext { get { throw null; } set { } } + } public partial class StartRecognizingCallMediaResult { internal StartRecognizingCallMediaResult() { } @@ -1499,7 +1614,13 @@ public partial class StartTranscriptionOptions { public StartTranscriptionOptions() { } public string Locale { get { throw null; } set { } } + public string OperationCallbackUri { get { throw null; } set { } } public string OperationContext { get { throw null; } set { } } + public string SpeechRecognitionModelEndpointId { get { throw null; } set { } } + } + public partial class StopAudio + { + public StopAudio() { } } public partial class StopHoldMusicOptions { @@ -1507,18 +1628,37 @@ public StopHoldMusicOptions(Azure.Communication.CommunicationIdentifier targetPa public string OperationContext { get { throw null; } set { } } public Azure.Communication.CommunicationIdentifier TargetParticipant { get { throw null; } } } + public partial class StopMediaStreamingOptions + { + public StopMediaStreamingOptions() { } + public System.Uri OperationCallbackUri { get { throw null; } set { } } + public string OperationContext { get { throw null; } set { } } + } public partial class StopTranscriptionOptions { public StopTranscriptionOptions() { } + public string OperationCallbackUri { get { throw null; } set { } } public string OperationContext { get { throw null; } set { } } + public string SpeechRecognitionModelEndpointId { get { throw null; } set { } } } public abstract partial class StreamingData { protected StreamingData() { } + public static Azure.Communication.CallAutomation.StreamingDataKind Kind { get { throw null; } } + public static Azure.Communication.CallAutomation.StreamingData Parse(string data) { throw null; } + public static T Parse(string data) where T : Azure.Communication.CallAutomation.StreamingData { throw null; } + } + [System.Text.Json.Serialization.JsonConverterAttribute(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public enum StreamingDataKind + { + AudioData = 0, + AudioMetadata = 1, + TranscriptionData = 2, + TranscriptionMetadata = 3, } public static partial class StreamingDataParser { - public static Azure.Communication.CallAutomation.StreamingData Parse(System.BinaryData json) { throw null; } + public static Azure.Communication.CallAutomation.StreamingData Parse(System.BinaryData binaryData) { throw null; } public static Azure.Communication.CallAutomation.StreamingData Parse(byte[] receivedBytes) { throw null; } public static Azure.Communication.CallAutomation.StreamingData Parse(string stringJson) { throw null; } } @@ -1541,17 +1681,18 @@ public partial class TranscriptionData : Azure.Communication.CallAutomation.Stre { internal TranscriptionData() { } public double Confidence { get { throw null; } set { } } - public ulong Duration { get { throw null; } set { } } + public System.TimeSpan Duration { get { throw null; } set { } } public Azure.Communication.CallAutomation.TextFormat Format { get { throw null; } set { } } - public ulong Offset { get { throw null; } set { } } + public System.TimeSpan Offset { get { throw null; } set { } } public Azure.Communication.CommunicationIdentifier Participant { get { throw null; } set { } } - public Azure.Communication.CallAutomation.ResultStatus ResultStatus { get { throw null; } set { } } + public Azure.Communication.CallAutomation.TranscriptionResultState ResultState { get { throw null; } set { } } public string Text { get { throw null; } set { } } public System.Collections.Generic.IEnumerable Words { get { throw null; } set { } } } public partial class TranscriptionFailed : Azure.Communication.CallAutomation.CallAutomationEventBase { internal TranscriptionFailed() { } + public Azure.Communication.CallAutomation.MediaEventReasonCode ReasonCode { get { throw null; } } public Azure.Communication.CallAutomation.TranscriptionUpdate TranscriptionUpdate { get { throw null; } } public static Azure.Communication.CallAutomation.TranscriptionFailed Deserialize(string content) { throw null; } } @@ -1569,12 +1710,32 @@ public TranscriptionMetadata() { } } public partial class TranscriptionOptions { - public TranscriptionOptions(System.Uri transportUri, Azure.Communication.CallAutomation.TranscriptionTransport transportType, string locale, bool startTranscription) { } + public TranscriptionOptions(System.Uri transportUri, string locale, bool? startTranscription = default(bool?), Azure.Communication.CallAutomation.TranscriptionTransport transcriptionTransport = default(Azure.Communication.CallAutomation.TranscriptionTransport)) { } + public bool? EnableIntermediateResults { get { throw null; } set { } } public string Locale { get { throw null; } } - public bool StartTranscription { get { throw null; } } + public string SpeechRecognitionModelEndpointId { get { throw null; } set { } } + public bool? StartTranscription { get { throw null; } } public Azure.Communication.CallAutomation.TranscriptionTransport TranscriptionTransport { get { throw null; } } public System.Uri TransportUrl { get { throw null; } } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct TranscriptionResultState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public TranscriptionResultState(string value) { throw null; } + public static Azure.Communication.CallAutomation.TranscriptionResultState Final { get { throw null; } } + public static Azure.Communication.CallAutomation.TranscriptionResultState Intermediate { get { throw null; } } + public bool Equals(Azure.Communication.CallAutomation.TranscriptionResultState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Communication.CallAutomation.TranscriptionResultState left, Azure.Communication.CallAutomation.TranscriptionResultState right) { throw null; } + public static implicit operator Azure.Communication.CallAutomation.TranscriptionResultState (string value) { throw null; } + public static bool operator !=(Azure.Communication.CallAutomation.TranscriptionResultState left, Azure.Communication.CallAutomation.TranscriptionResultState right) { throw null; } + public override string ToString() { throw null; } + } public partial class TranscriptionStarted : Azure.Communication.CallAutomation.CallAutomationEventBase { internal TranscriptionStarted() { } @@ -1640,6 +1801,32 @@ internal TranscriptionStopped() { } public Azure.Communication.CallAutomation.TranscriptionUpdate TranscriptionUpdate { get { throw null; } } public static Azure.Communication.CallAutomation.TranscriptionStopped Deserialize(string content) { throw null; } } + public partial class TranscriptionSubscription + { + internal TranscriptionSubscription() { } + public string Id { get { throw null; } } + public Azure.Communication.CallAutomation.TranscriptionSubscriptionState? State { get { throw null; } } + public System.Collections.Generic.IReadOnlyList SubscribedResultStates { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct TranscriptionSubscriptionState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public TranscriptionSubscriptionState(string value) { throw null; } + public static Azure.Communication.CallAutomation.TranscriptionSubscriptionState Active { get { throw null; } } + public static Azure.Communication.CallAutomation.TranscriptionSubscriptionState Disabled { get { throw null; } } + public static Azure.Communication.CallAutomation.TranscriptionSubscriptionState Inactive { get { throw null; } } + public bool Equals(Azure.Communication.CallAutomation.TranscriptionSubscriptionState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Communication.CallAutomation.TranscriptionSubscriptionState left, Azure.Communication.CallAutomation.TranscriptionSubscriptionState right) { throw null; } + public static implicit operator Azure.Communication.CallAutomation.TranscriptionSubscriptionState (string value) { throw null; } + public static bool operator !=(Azure.Communication.CallAutomation.TranscriptionSubscriptionState left, Azure.Communication.CallAutomation.TranscriptionSubscriptionState right) { throw null; } + public override string ToString() { throw null; } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct TranscriptionTransport : System.IEquatable { @@ -1719,6 +1906,13 @@ public UpdateDialogOptions(string dialogId, Azure.Communication.CallAutomation.D public string DialogId { get { throw null; } } public string OperationContext { get { throw null; } set { } } } + public partial class UpdateTranscriptionOptions + { + public UpdateTranscriptionOptions(string locale) { } + public string OperationCallbackUri { get { throw null; } set { } } + public string OperationContext { get { throw null; } set { } } + public string SpeechRecognitionModelEndpointId { get { throw null; } set { } } + } public partial class UserConsent { internal UserConsent() { } @@ -1744,11 +1938,11 @@ internal UserConsent() { } } public partial class WordData { - public WordData() { } + internal WordData() { } [System.Text.Json.Serialization.JsonPropertyNameAttribute("duration")] - public ulong Duration { get { throw null; } set { } } + public System.TimeSpan Duration { get { throw null; } set { } } [System.Text.Json.Serialization.JsonPropertyNameAttribute("offset")] - public ulong Offset { get { throw null; } set { } } + public System.TimeSpan Offset { get { throw null; } set { } } [System.Text.Json.Serialization.JsonPropertyNameAttribute("text")] public string Text { get { throw null; } set { } } } 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 ff91e052e698..75e482538a76 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 @@ -69,26 +69,45 @@ public partial class AnswerFailed : Azure.Communication.CallAutomation.CallAutom internal AnswerFailed() { } public static Azure.Communication.CallAutomation.AnswerFailed Deserialize(string content) { throw null; } } + [System.Text.Json.Serialization.JsonConverterAttribute(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public enum AudioChannel + { + Unknown = 0, + Mono = 1, + } public partial class AudioData : Azure.Communication.CallAutomation.StreamingData { - internal AudioData() { } - public string Data { get { throw null; } } + public AudioData(byte[] data) { } + public byte[] Data { get { throw null; } } public bool IsSilent { get { throw null; } } public Azure.Communication.CommunicationIdentifier Participant { get { throw null; } } - public System.DateTime Timestamp { get { throw null; } } + public System.DateTimeOffset Timestamp { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AudioFormat : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AudioFormat(string value) { throw null; } + public static Azure.Communication.CallAutomation.AudioFormat Pcm16KMono { get { throw null; } } + public static Azure.Communication.CallAutomation.AudioFormat Pcm24KMono { get { throw null; } } + public bool Equals(Azure.Communication.CallAutomation.AudioFormat other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Communication.CallAutomation.AudioFormat left, Azure.Communication.CallAutomation.AudioFormat right) { throw null; } + public static implicit operator Azure.Communication.CallAutomation.AudioFormat (string value) { throw null; } + public static bool operator !=(Azure.Communication.CallAutomation.AudioFormat left, Azure.Communication.CallAutomation.AudioFormat right) { throw null; } + public override string ToString() { throw null; } } public partial class AudioMetadata : Azure.Communication.CallAutomation.StreamingData { - public AudioMetadata() { } - [System.Text.Json.Serialization.JsonPropertyNameAttribute("channels")] - public int Channels { get { throw null; } set { } } - [System.Text.Json.Serialization.JsonPropertyNameAttribute("encoding")] + internal AudioMetadata() { } + public Azure.Communication.CallAutomation.AudioChannel Channels { get { throw null; } set { } } public string Encoding { get { throw null; } set { } } - [System.Text.Json.Serialization.JsonPropertyNameAttribute("length")] public int Length { get { throw null; } set { } } - [System.Text.Json.Serialization.JsonPropertyNameAttribute("subscriptionId")] public string MediaSubscriptionId { get { throw null; } set { } } - [System.Text.Json.Serialization.JsonPropertyNameAttribute("sampleRate")] public int SampleRate { get { throw null; } set { } } } public partial class AzureOpenAIDialog : Azure.Communication.CallAutomation.BaseDialog @@ -118,6 +137,10 @@ public CallAutomationClient(System.Uri pmaEndpoint, System.Uri acsEndpoint, Azur public virtual Azure.Response AnswerCall(string incomingCallContext, System.Uri callbackUri, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> AnswerCallAsync(Azure.Communication.CallAutomation.AnswerCallOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> AnswerCallAsync(string incomingCallContext, System.Uri callbackUri, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ConnectCall(Azure.Communication.CallAutomation.CallLocator callLocator, System.Uri callbackUri, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ConnectCall(Azure.Communication.CallAutomation.ConnectCallOptions connectCallOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ConnectCallAsync(Azure.Communication.CallAutomation.CallLocator callLocator, System.Uri callbackUri, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ConnectCallAsync(Azure.Communication.CallAutomation.ConnectCallOptions connectCallOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response CreateCall(Azure.Communication.CallAutomation.CallInvite callInvite, System.Uri callbackUri, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response CreateCall(Azure.Communication.CallAutomation.CreateCallOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> CreateCallAsync(Azure.Communication.CallAutomation.CallInvite callInvite, System.Uri callbackUri, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -138,7 +161,7 @@ public CallAutomationClient(System.Uri pmaEndpoint, System.Uri acsEndpoint, Azur } public partial class CallAutomationClientOptions : Azure.Core.ClientOptions { - public CallAutomationClientOptions(Azure.Communication.CallAutomation.CallAutomationClientOptions.ServiceVersion version = Azure.Communication.CallAutomation.CallAutomationClientOptions.ServiceVersion.V2023_10_03_Preview) { } + public CallAutomationClientOptions(Azure.Communication.CallAutomation.CallAutomationClientOptions.ServiceVersion version = Azure.Communication.CallAutomation.CallAutomationClientOptions.ServiceVersion.V2024_09_01_Preview) { } public Azure.Communication.MicrosoftTeamsAppIdentifier OPSSource { get { throw null; } set { } } public Azure.Communication.CommunicationUserIdentifier Source { get { throw null; } set { } } public enum ServiceVersion @@ -147,6 +170,7 @@ public enum ServiceVersion V2023_06_15_Preview = 2, V2023_10_15 = 3, V2023_10_03_Preview = 4, + V2024_09_01_Preview = 5, } } public abstract partial class CallAutomationEventBase @@ -185,17 +209,16 @@ public static partial class CallAutomationModelFactory public static Azure.Communication.CallAutomation.AddParticipantSucceeded AddParticipantSucceeded(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, Azure.Communication.CommunicationIdentifier participant = null) { throw null; } public static Azure.Communication.CallAutomation.AnswerCallResult AnswerCallResult(Azure.Communication.CallAutomation.CallConnection callConnection = null, Azure.Communication.CallAutomation.CallConnectionProperties callConnectionProperties = null) { throw null; } public static Azure.Communication.CallAutomation.AnswerFailed AnswerFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, string operationContext = null) { throw null; } - public static Azure.Communication.CallAutomation.CallConnected CallConnected(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null) { throw null; } - public static Azure.Communication.CallAutomation.CallConnectionProperties CallConnectionProperties(string callConnectionId = null, string serverCallId = null, System.Collections.Generic.IEnumerable targets = null, Azure.Communication.CallAutomation.CallConnectionState callConnectionState = default(Azure.Communication.CallAutomation.CallConnectionState), System.Uri callbackUri = null, Azure.Communication.CommunicationIdentifier sourceIdentity = null, Azure.Communication.PhoneNumberIdentifier sourceCallerIdNumber = null, string sourceDisplayName = null, Azure.Communication.CommunicationUserIdentifier answeredBy = null, string mediaSubscriptionId = null, string dataSubscriptionId = null) { throw null; } - public static Azure.Communication.CallAutomation.CallDisconnected CallDisconnected(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null) { throw null; } + public static Azure.Communication.CallAutomation.CallConnected CallConnected(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } + public static Azure.Communication.CallAutomation.CallConnectionProperties CallConnectionProperties(string callConnectionId = null, string serverCallId = null, System.Collections.Generic.IEnumerable targets = null, Azure.Communication.CallAutomation.CallConnectionState callConnectionState = default(Azure.Communication.CallAutomation.CallConnectionState), System.Uri callbackUri = null, Azure.Communication.CommunicationIdentifier sourceIdentity = null, Azure.Communication.PhoneNumberIdentifier sourceCallerIdNumber = null, string sourceDisplayName = null, Azure.Communication.CommunicationUserIdentifier answeredBy = null, Azure.Communication.CallAutomation.MediaStreamingSubscription mediaStreamingSubscription = null, Azure.Communication.CallAutomation.TranscriptionSubscription transcriptionSubscription = null, Azure.Communication.PhoneNumberIdentifier answeredFor = null) { throw null; } + public static Azure.Communication.CallAutomation.CallDisconnected CallDisconnected(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } public static Azure.Communication.CallAutomation.CallParticipant CallParticipant(Azure.Communication.CommunicationIdentifier identifier = null, bool isMuted = false, bool isOnHold = false) { throw null; } public static Azure.Communication.CallAutomation.CallTransferAccepted CallTransferAccepted(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, Azure.Communication.CommunicationIdentifier transferee = null, Azure.Communication.CommunicationIdentifier transferTarget = null) { throw null; } public static Azure.Communication.CallAutomation.CallTransferFailed CallTransferFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } public static Azure.Communication.CallAutomation.CancelAddParticipantFailed CancelAddParticipantFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, string invitationId = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, string operationContext = null) { throw null; } public static Azure.Communication.CallAutomation.CancelAddParticipantOperationResult CancelAddParticipantResult(string invitationId = null, string operationContext = null) { throw null; } - public static Azure.Communication.CallAutomation.CancelAddParticipantSucceeded CancelAddParticipantSucceeded(string callConnectionId = null, string serverCallId = null, string correlationId = null, string invitationId = null, Azure.Communication.CommunicationIdentifier participant = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } + public static Azure.Communication.CallAutomation.CancelAddParticipantSucceeded CancelAddParticipantSucceeded(string callConnectionId = null, string serverCallId = null, string correlationId = null, string invitationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } public static Azure.Communication.CallAutomation.ChoiceResult ChoiceResult(string label = null, string recognizedPhrase = null) { throw null; } - public static Azure.Communication.CallAutomation.CollectTonesResult CollectTonesResult(System.Collections.Generic.IEnumerable tones = null) { throw null; } public static Azure.Communication.CallAutomation.ContinuousDtmfRecognitionStopped ContinuousDtmfRecognitionStopped(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } public static Azure.Communication.CallAutomation.ContinuousDtmfRecognitionToneFailed ContinuousDtmfRecognitionToneFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, string operationContext = null) { throw null; } public static Azure.Communication.CallAutomation.ContinuousDtmfRecognitionToneReceived ContinuousDtmfRecognitionToneReceived(int? sequenceId = default(int?), Azure.Communication.CallAutomation.DtmfTone? tone = default(Azure.Communication.CallAutomation.DtmfTone?), string callConnectionId = null, string serverCallId = null, string correlationId = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, string operationContext = null) { throw null; } @@ -203,21 +226,19 @@ public static partial class CallAutomationModelFactory public static Azure.Communication.CallAutomation.CreateCallResult CreateCallResult(Azure.Communication.CallAutomation.CallConnection callConnection = null, Azure.Communication.CallAutomation.CallConnectionProperties callConnectionProperties = null) { throw null; } public static Azure.Communication.CallAutomation.DtmfResult DtmfResult(System.Collections.Generic.IEnumerable tones = null) { throw null; } public static Azure.Communication.CallAutomation.HoldFailed HoldFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } - public static Azure.Communication.CallAutomation.MediaStreamingFailed MediaStreamingFailed(string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, Azure.Communication.CallAutomation.MediaStreamingUpdate mediaStreamingUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null) { throw null; } - public static Azure.Communication.CallAutomation.MediaStreamingStarted MediaStreamingStarted(string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, Azure.Communication.CallAutomation.MediaStreamingUpdate mediaStreamingUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null) { throw null; } - public static Azure.Communication.CallAutomation.MediaStreamingStopped MediaStreamingStopped(string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, Azure.Communication.CallAutomation.MediaStreamingUpdate mediaStreamingUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null) { throw null; } + public static Azure.Communication.CallAutomation.MediaStreamingFailed MediaStreamingFailed(Azure.Communication.CallAutomation.MediaStreamingUpdate mediaStreamingUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } + public static Azure.Communication.CallAutomation.MediaStreamingStarted MediaStreamingStarted(Azure.Communication.CallAutomation.MediaStreamingUpdate mediaStreamingUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } + public static Azure.Communication.CallAutomation.MediaStreamingStopped MediaStreamingStopped(Azure.Communication.CallAutomation.MediaStreamingUpdate mediaStreamingUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } public static Azure.Communication.CallAutomation.MediaStreamingUpdate MediaStreamingUpdate(string contentType = null, Azure.Communication.CallAutomation.MediaStreamingStatus? mediaStreamingStatus = default(Azure.Communication.CallAutomation.MediaStreamingStatus?), Azure.Communication.CallAutomation.MediaStreamingStatusDetails? mediaStreamingStatusDetails = default(Azure.Communication.CallAutomation.MediaStreamingStatusDetails?)) { throw null; } public static Azure.Communication.CallAutomation.MuteParticipantResult MuteParticipantResult(string operationContext = null) { throw null; } - public static Azure.Communication.CallAutomation.ParticipantsUpdated ParticipantsUpdated(string callConnectionId = null, string serverCallId = null, string correlationId = null, System.Collections.Generic.IEnumerable participants = null, int sequenceNumber = 0) { throw null; } - public static Azure.Communication.CallAutomation.PlayCanceled PlayCanceled(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null) { throw null; } + public static Azure.Communication.CallAutomation.ParticipantsUpdated ParticipantsUpdated(string callConnectionId = null, string serverCallId = null, string correlationId = null, System.Collections.Generic.IEnumerable participants = null, int sequenceNumber = 0, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } + public static Azure.Communication.CallAutomation.PlayCanceled PlayCanceled(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } public static Azure.Communication.CallAutomation.PlayCompleted PlayCompleted(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } - public static Azure.Communication.CallAutomation.PlayFailed PlayFailed(string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, int? failedPlaySourceIndex = default(int?), string callConnectionId = null, string serverCallId = null, string correlationId = null) { throw null; } - public static Azure.Communication.CallAutomation.PlayFailed PlayFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } - public static Azure.Communication.CallAutomation.RecognizeCanceled RecognizeCanceled(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null) { throw null; } + public static Azure.Communication.CallAutomation.PlayFailed PlayFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, int? failedPlaySourceIndex = default(int?)) { throw null; } + public static Azure.Communication.CallAutomation.RecognizeCanceled RecognizeCanceled(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } public static Azure.Communication.CallAutomation.RecognizeCompleted RecognizeCompleted(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, Azure.Communication.CallAutomation.CallMediaRecognitionType recognitionType = default(Azure.Communication.CallAutomation.CallMediaRecognitionType), Azure.Communication.CallAutomation.RecognizeResult recognizeResult = null) { throw null; } - public static Azure.Communication.CallAutomation.RecognizeFailed RecognizeFailed(string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, int? failedPlaySourceIndex = default(int?), string callConnectionId = null, string serverCallId = null, string correlationId = null) { throw null; } - public static Azure.Communication.CallAutomation.RecognizeFailed RecognizeFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } - public static Azure.Communication.CallAutomation.RecordingStateChanged RecordingStateChanged(string callConnectionId = null, string serverCallId = null, string correlationId = null, string recordingId = null, Azure.Communication.CallAutomation.RecordingState state = default(Azure.Communication.CallAutomation.RecordingState), System.DateTimeOffset? startDateTime = default(System.DateTimeOffset?), Azure.Communication.CallAutomation.RecordingKind? recordingKind = default(Azure.Communication.CallAutomation.RecordingKind?)) { throw null; } + public static Azure.Communication.CallAutomation.RecognizeFailed RecognizeFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, int? failedPlaySourceIndex = default(int?)) { throw null; } + public static Azure.Communication.CallAutomation.RecordingStateChanged RecordingStateChanged(string callConnectionId = null, string serverCallId = null, string correlationId = null, string recordingId = null, Azure.Communication.CallAutomation.RecordingState state = default(Azure.Communication.CallAutomation.RecordingState), System.DateTimeOffset? startDateTime = default(System.DateTimeOffset?), Azure.Communication.CallAutomation.RecordingKind? recordingKind = default(Azure.Communication.CallAutomation.RecordingKind?), Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } public static Azure.Communication.CallAutomation.RecordingStateResult RecordingStateResult(string recordingId = null, Azure.Communication.CallAutomation.RecordingState? recordingState = default(Azure.Communication.CallAutomation.RecordingState?), Azure.Communication.CallAutomation.RecordingKind? recordingKind = default(Azure.Communication.CallAutomation.RecordingKind?)) { throw null; } public static Azure.Communication.CallAutomation.RemoveParticipantFailed RemoveParticipantFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, Azure.Communication.CommunicationIdentifier participant = null) { throw null; } public static Azure.Communication.CallAutomation.RemoveParticipantResult RemoveParticipantResult(string operationContext = null) { throw null; } @@ -227,11 +248,11 @@ public static partial class CallAutomationModelFactory public static Azure.Communication.CallAutomation.SendDtmfTonesFailed SendDtmfTonesFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } public static Azure.Communication.CallAutomation.SendDtmfTonesResult SendDtmfTonesResult(string operationContext = null) { throw null; } public static Azure.Communication.CallAutomation.SpeechResult SpeechResult(string speech = null) { throw null; } - public static Azure.Communication.CallAutomation.TranscriptionFailed TranscriptionFailed(string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, Azure.Communication.CallAutomation.TranscriptionUpdate transcriptionUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null) { throw null; } - public static Azure.Communication.CallAutomation.TranscriptionStarted TranscriptionStarted(string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, Azure.Communication.CallAutomation.TranscriptionUpdate transcriptionUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null) { throw null; } - public static Azure.Communication.CallAutomation.TranscriptionStopped TranscriptionStopped(string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, Azure.Communication.CallAutomation.TranscriptionUpdate transcriptionUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null) { throw null; } + public static Azure.Communication.CallAutomation.TranscriptionFailed TranscriptionFailed(Azure.Communication.CallAutomation.TranscriptionUpdate transcriptionUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } + public static Azure.Communication.CallAutomation.TranscriptionStarted TranscriptionStarted(Azure.Communication.CallAutomation.TranscriptionUpdate transcriptionUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } + public static Azure.Communication.CallAutomation.TranscriptionStopped TranscriptionStopped(Azure.Communication.CallAutomation.TranscriptionUpdate transcriptionUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } public static Azure.Communication.CallAutomation.TranscriptionUpdate TranscriptionUpdate(Azure.Communication.CallAutomation.TranscriptionStatus? transcriptionStatus = default(Azure.Communication.CallAutomation.TranscriptionStatus?), Azure.Communication.CallAutomation.TranscriptionStatusDetails? transcriptionStatusDetails = default(Azure.Communication.CallAutomation.TranscriptionStatusDetails?)) { throw null; } - public static Azure.Communication.CallAutomation.TranscriptionUpdated TranscriptionUpdated(string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, Azure.Communication.CallAutomation.TranscriptionUpdate transcriptionUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null) { throw null; } + public static Azure.Communication.CallAutomation.TranscriptionUpdated TranscriptionUpdated(Azure.Communication.CallAutomation.TranscriptionUpdate transcriptionUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } public static Azure.Communication.CallAutomation.TransferCallToParticipantResult TransferCallToParticipantResult(string operationContext = null) { throw null; } public static Azure.Communication.CallAutomation.UnmuteParticipantResult UnmuteParticipantResult(string operationContext = null) { throw null; } public static Azure.Communication.CallAutomation.UserConsent UserConsent(int? recording = default(int?)) { throw null; } @@ -284,17 +305,18 @@ public partial class CallConnectionProperties { internal CallConnectionProperties() { } public Azure.Communication.CommunicationUserIdentifier AnsweredBy { get { throw null; } } + public Azure.Communication.PhoneNumberIdentifier AnsweredFor { get { throw null; } } public System.Uri CallbackUri { get { throw null; } } public string CallConnectionId { get { throw null; } } public Azure.Communication.CallAutomation.CallConnectionState CallConnectionState { get { throw null; } } public string CorrelationId { get { throw null; } } - public string DataSubscriptionId { get { throw null; } } - public string MediaSubscriptionId { get { throw null; } } + public Azure.Communication.CallAutomation.MediaStreamingSubscription MediaStreamingSubscription { get { throw null; } } public string ServerCallId { get { throw null; } } public Azure.Communication.CommunicationIdentifier Source { get { throw null; } } public Azure.Communication.PhoneNumberIdentifier SourceCallerIdNumber { get { throw null; } } public string SourceDisplayName { get { throw null; } } public System.Collections.Generic.IReadOnlyList Targets { get { throw null; } } + public Azure.Communication.CallAutomation.TranscriptionSubscription TranscriptionSubscription { get { throw null; } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct CallConnectionState : System.IEquatable @@ -366,15 +388,23 @@ protected CallMedia() { } public virtual Azure.Response CancelAllMediaOperations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> CancelAllMediaOperationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Hold(Azure.Communication.CallAutomation.HoldOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Hold(Azure.Communication.CommunicationIdentifier targetParticipant, Azure.Communication.CallAutomation.PlaySource playSource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Hold(Azure.Communication.CommunicationIdentifier targetParticipant, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task HoldAsync(Azure.Communication.CallAutomation.HoldOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task HoldAsync(Azure.Communication.CommunicationIdentifier targetParticipant, Azure.Communication.CallAutomation.PlaySource playSource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task HoldAsync(Azure.Communication.CommunicationIdentifier targetParticipant, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Play(Azure.Communication.CallAutomation.PlayOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Play(Azure.Communication.CallAutomation.PlaySource playSource, System.Collections.Generic.IEnumerable playTo, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Play(System.Collections.Generic.IEnumerable playSources, System.Collections.Generic.IEnumerable playTo, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> PlayAsync(Azure.Communication.CallAutomation.PlayOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> PlayAsync(Azure.Communication.CallAutomation.PlaySource playSource, System.Collections.Generic.IEnumerable playTo, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> PlayAsync(System.Collections.Generic.IEnumerable playSources, System.Collections.Generic.IEnumerable playTo, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response PlayToAll(Azure.Communication.CallAutomation.PlaySource playSource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response PlayToAll(Azure.Communication.CallAutomation.PlayToAllOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response PlayToAll(System.Collections.Generic.IEnumerable playSources, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> PlayToAllAsync(Azure.Communication.CallAutomation.PlaySource playSource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> PlayToAllAsync(Azure.Communication.CallAutomation.PlayToAllOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> PlayToAllAsync(System.Collections.Generic.IEnumerable playSources, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response SendDtmfTones(Azure.Communication.CallAutomation.SendDtmfTonesOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response SendDtmfTones(System.Collections.Generic.IEnumerable tones, Azure.Communication.CommunicationIdentifier targetParticipant, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> SendDtmfTonesAsync(Azure.Communication.CallAutomation.SendDtmfTonesOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -383,10 +413,8 @@ protected CallMedia() { } public virtual Azure.Response StartContinuousDtmfRecognition(Azure.Communication.CommunicationIdentifier targetParticipant, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task StartContinuousDtmfRecognitionAsync(Azure.Communication.CallAutomation.ContinuousDtmfRecognitionOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task StartContinuousDtmfRecognitionAsync(Azure.Communication.CommunicationIdentifier targetParticipant, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - [System.ObsoleteAttribute("This operations is deprecated, please us Hold instead.")] - public virtual Azure.Response StartHoldMusic(Azure.Communication.CallAutomation.StartHoldMusicOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - [System.ObsoleteAttribute("This operations is deprecated, please us HoldAsync instead.")] - 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 StartMediaStreaming(Azure.Communication.CallAutomation.StartMediaStreamingOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task StartMediaStreamingAsync(Azure.Communication.CallAutomation.StartMediaStreamingOptions options = null, 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 StartTranscription(Azure.Communication.CallAutomation.StartTranscriptionOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -395,15 +423,17 @@ protected CallMedia() { } public virtual Azure.Response StopContinuousDtmfRecognition(Azure.Communication.CommunicationIdentifier targetParticipant, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task StopContinuousDtmfRecognitionAsync(Azure.Communication.CallAutomation.ContinuousDtmfRecognitionOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task StopContinuousDtmfRecognitionAsync(Azure.Communication.CommunicationIdentifier targetParticipant, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - [System.ObsoleteAttribute("This operations is deprecated, please us Unhold instead.")] - public virtual Azure.Response StopHoldMusic(Azure.Communication.CallAutomation.StopHoldMusicOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - [System.ObsoleteAttribute("This operations is deprecated, please us UnholdAsync instead.")] - public virtual System.Threading.Tasks.Task StopHoldMusicAsync(Azure.Communication.CallAutomation.StopHoldMusicOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response StopMediaStreaming(Azure.Communication.CallAutomation.StopMediaStreamingOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task StopMediaStreamingAsync(Azure.Communication.CallAutomation.StopMediaStreamingOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response StopTranscription(Azure.Communication.CallAutomation.StopTranscriptionOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task StopTranscriptionAsync(Azure.Communication.CallAutomation.StopTranscriptionOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Unhold(Azure.Communication.CallAutomation.UnholdOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Unhold(Azure.Communication.CommunicationIdentifier targetParticipant, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task UnholdAsync(Azure.Communication.CallAutomation.UnholdOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task UnholdAsync(Azure.Communication.CommunicationIdentifier targetParticipant, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response UpdateTranscription(Azure.Communication.CallAutomation.UpdateTranscriptionOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response UpdateTranscription(string locale, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task UpdateTranscriptionAsync(Azure.Communication.CallAutomation.UpdateTranscriptionOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task UpdateTranscriptionAsync(string locale, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] @@ -446,6 +476,7 @@ protected CallMediaRecognizeOptions(Azure.Communication.CallAutomation.Recognize public bool InterruptPrompt { get { throw null; } set { } } public System.Uri OperationCallbackUri { get { throw null; } set { } } public string OperationContext { get { throw null; } set { } } + public System.Collections.Generic.IList PlayPrompts { get { throw null; } set { } } public Azure.Communication.CallAutomation.PlaySource Prompt { get { throw null; } set { } } public string SpeechLanguage { get { throw null; } set { } } public string SpeechModelEndpointId { get { throw null; } set { } } @@ -586,12 +617,35 @@ internal ChoiceResult() { } public string RecognizedPhrase { get { throw null; } } public override Azure.Communication.CallAutomation.RecognizeResultType ResultType { get { throw null; } } } - public partial class CollectTonesResult : Azure.Communication.CallAutomation.RecognizeResult + public partial class ConnectCallEventResult { - internal CollectTonesResult() { } - public override Azure.Communication.CallAutomation.RecognizeResultType ResultType { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Tones { get { throw null; } } - public string ConvertToString() { throw null; } + internal ConnectCallEventResult() { } + public Azure.Communication.CallAutomation.ConnectFailed FailureResult { get { throw null; } } + public bool IsSuccess { get { throw null; } } + public Azure.Communication.CallAutomation.CallConnected SuccessResult { get { throw null; } } + } + public partial class ConnectCallOptions + { + public ConnectCallOptions(Azure.Communication.CallAutomation.CallLocator callLocator, System.Uri callbackUri) { } + public System.Uri CallbackUri { get { throw null; } } + public Azure.Communication.CallAutomation.CallIntelligenceOptions CallIntelligenceOptions { get { throw null; } set { } } + public Azure.Communication.CallAutomation.CallLocator CallLocator { get { throw null; } } + public Azure.Communication.CallAutomation.MediaStreamingOptions MediaStreamingOptions { get { throw null; } set { } } + public string OperationContext { get { throw null; } set { } } + public Azure.Communication.CallAutomation.TranscriptionOptions TranscriptionOptions { get { throw null; } set { } } + } + public partial class ConnectCallResult + { + internal ConnectCallResult() { } + public Azure.Communication.CallAutomation.CallConnection CallConnection { get { throw null; } } + public Azure.Communication.CallAutomation.CallConnectionProperties CallConnectionProperties { get { throw null; } } + public Azure.Communication.CallAutomation.ConnectCallEventResult WaitForEventProcessor(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public System.Threading.Tasks.Task WaitForEventProcessorAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ConnectFailed : Azure.Communication.CallAutomation.CallAutomationEventBase + { + internal ConnectFailed() { } + public static Azure.Communication.CallAutomation.ConnectFailed Deserialize(string content) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public partial struct ContentTransferOptions : System.IEquatable @@ -856,6 +910,12 @@ public GroupCallLocator(string id) { } public override int GetHashCode() { throw null; } public override string ToString() { throw null; } } + public partial class HoldEventResult + { + internal HoldEventResult() { } + public Azure.Communication.CallAutomation.HoldFailed FailureResult { get { throw null; } } + public bool IsSuccess { get { throw null; } } + } public partial class HoldFailed : Azure.Communication.CallAutomation.CallAutomationEventBase { internal HoldFailed() { } @@ -867,9 +927,15 @@ public partial class HoldOptions public HoldOptions(Azure.Communication.CommunicationIdentifier targetParticipant) { } public System.Uri OperationCallbackUri { get { throw null; } set { } } public string OperationContext { get { throw null; } set { } } - public Azure.Communication.CallAutomation.PlaySource PlaySourceInfo { get { throw null; } set { } } + public Azure.Communication.CallAutomation.PlaySource PlaySource { get { throw null; } set { } } public Azure.Communication.CommunicationIdentifier TargetParticipant { get { throw null; } } } + public partial class HoldResult + { + internal HoldResult() { } + public Azure.Communication.CallAutomation.HoldEventResult WaitForEventProcessor(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public System.Threading.Tasks.Task WaitForEventProcessorAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } public partial class IncomingCall : Azure.Communication.CallAutomation.CallAutomationEventBase { internal IncomingCall() { } @@ -915,6 +981,12 @@ internal IncomingCall() { } public static bool operator !=(Azure.Communication.CallAutomation.MediaEventReasonCode left, Azure.Communication.CallAutomation.MediaEventReasonCode right) { throw null; } public override string ToString() { throw null; } } + [System.Text.Json.Serialization.JsonConverterAttribute(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public enum MediaKind + { + AudioData = 0, + StopAudio = 1, + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct MediaStreamingAudioChannel : System.IEquatable { @@ -933,14 +1005,6 @@ internal IncomingCall() { } public static bool operator !=(Azure.Communication.CallAutomation.MediaStreamingAudioChannel left, Azure.Communication.CallAutomation.MediaStreamingAudioChannel right) { throw null; } public override string ToString() { throw null; } } - public partial class MediaStreamingConfiguration - { - public MediaStreamingConfiguration(System.Uri transportUrl, Azure.Communication.CallAutomation.MediaStreamingTransport transportType, Azure.Communication.CallAutomation.MediaStreamingContent contentType, Azure.Communication.CallAutomation.MediaStreamingAudioChannel audioChannelType) { } - public Azure.Communication.CallAutomation.MediaStreamingAudioChannel AudioChannelType { get { throw null; } } - public Azure.Communication.CallAutomation.MediaStreamingContent ContentType { get { throw null; } } - public Azure.Communication.CallAutomation.MediaStreamingTransport TransportType { get { throw null; } } - public System.Uri TransportUrl { get { throw null; } } - } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct MediaStreamingContent : System.IEquatable { @@ -966,10 +1030,13 @@ internal MediaStreamingFailed() { } } public partial class MediaStreamingOptions { - public MediaStreamingOptions(System.Uri transportUri, Azure.Communication.CallAutomation.MediaStreamingTransport transportType, Azure.Communication.CallAutomation.MediaStreamingContent contentType, Azure.Communication.CallAutomation.MediaStreamingAudioChannel audioChannelType) { } + public MediaStreamingOptions(System.Uri transportUri, Azure.Communication.CallAutomation.MediaStreamingContent contentType, Azure.Communication.CallAutomation.MediaStreamingAudioChannel audioChannelType, Azure.Communication.CallAutomation.MediaStreamingTransport transportType = default(Azure.Communication.CallAutomation.MediaStreamingTransport), bool? startMediaStreaming = default(bool?)) { } + public Azure.Communication.CallAutomation.AudioFormat? AudioFormat { get { throw null; } set { } } + public bool? EnableBidirectional { get { throw null; } set { } } public Azure.Communication.CallAutomation.MediaStreamingAudioChannel MediaStreamingAudioChannel { get { throw null; } } public Azure.Communication.CallAutomation.MediaStreamingContent MediaStreamingContent { get { throw null; } } public Azure.Communication.CallAutomation.MediaStreamingTransport MediaStreamingTransport { get { throw null; } } + public bool? StartMediaStreaming { get { throw null; } set { } } public System.Uri TransportUri { get { throw null; } } } public partial class MediaStreamingStarted : Azure.Communication.CallAutomation.CallAutomationEventBase @@ -1035,6 +1102,32 @@ internal MediaStreamingStopped() { } public Azure.Communication.CallAutomation.MediaStreamingUpdate MediaStreamingUpdate { get { throw null; } } public static Azure.Communication.CallAutomation.MediaStreamingStopped Deserialize(string content) { throw null; } } + public partial class MediaStreamingSubscription + { + public MediaStreamingSubscription(string id, Azure.Communication.CallAutomation.MediaStreamingSubscriptionState? state, System.Collections.Generic.IReadOnlyList subscribedContentTypes) { } + public string Id { get { throw null; } } + public Azure.Communication.CallAutomation.MediaStreamingSubscriptionState? State { get { throw null; } } + public System.Collections.Generic.IReadOnlyList SubscribedContentTypes { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct MediaStreamingSubscriptionState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public MediaStreamingSubscriptionState(string value) { throw null; } + public static Azure.Communication.CallAutomation.MediaStreamingSubscriptionState Active { get { throw null; } } + public static Azure.Communication.CallAutomation.MediaStreamingSubscriptionState Disabled { get { throw null; } } + public static Azure.Communication.CallAutomation.MediaStreamingSubscriptionState Inactive { get { throw null; } } + public bool Equals(Azure.Communication.CallAutomation.MediaStreamingSubscriptionState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Communication.CallAutomation.MediaStreamingSubscriptionState left, Azure.Communication.CallAutomation.MediaStreamingSubscriptionState right) { throw null; } + public static implicit operator Azure.Communication.CallAutomation.MediaStreamingSubscriptionState (string value) { throw null; } + public static bool operator !=(Azure.Communication.CallAutomation.MediaStreamingSubscriptionState left, Azure.Communication.CallAutomation.MediaStreamingSubscriptionState right) { throw null; } + public override string ToString() { throw null; } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct MediaStreamingTransport : System.IEquatable { @@ -1070,6 +1163,15 @@ public partial class MuteParticipantResult internal MuteParticipantResult() { } public string OperationContext { get { throw null; } } } + public partial class OutStreamingData + { + internal OutStreamingData() { } + public Azure.Communication.CallAutomation.AudioData AudioData { get { throw null; } } + public Azure.Communication.CallAutomation.MediaKind Kind { get { throw null; } } + public Azure.Communication.CallAutomation.StopAudio StopAudio { get { throw null; } } + public static string GetAudioDataForOutbound(byte[] audioData) { throw null; } + public static string GetStopAudioForOutbound() { throw null; } + } public partial class ParticipantsUpdated : Azure.Communication.CallAutomation.CallAutomationEventBase { internal ParticipantsUpdated() { } @@ -1123,6 +1225,11 @@ public abstract partial class PlaySource protected PlaySource() { } public string PlaySourceCacheId { get { throw null; } set { } } } + public partial class PlayStarted : Azure.Communication.CallAutomation.CallAutomationEventBase + { + internal PlayStarted() { } + public static Azure.Communication.CallAutomation.PlayStarted Deserialize(string content) { throw null; } + } public partial class PlayToAllOptions { public PlayToAllOptions(Azure.Communication.CallAutomation.PlaySource playSource) { } @@ -1397,10 +1504,12 @@ internal ResultInformation() { } public string Message { get { throw null; } } public int? SubCode { get { throw null; } } } - public enum ResultStatus + public partial class RoomCallLocator : Azure.Communication.CallAutomation.CallLocator { - Intermediate = 0, - Final = 1, + public RoomCallLocator(string id) { } + public override bool Equals(Azure.Communication.CallAutomation.CallLocator other) { throw null; } + public override int GetHashCode() { throw null; } + public override string ToString() { throw null; } } public partial class SendDtmfTonesCompleted : Azure.Communication.CallAutomation.CallAutomationEventBase { @@ -1469,6 +1578,12 @@ public StartHoldMusicOptions(Azure.Communication.CommunicationIdentifier targetP public Azure.Communication.CallAutomation.PlaySource PlaySourceInfo { get { throw null; } set { } } public Azure.Communication.CommunicationIdentifier TargetParticipant { get { throw null; } } } + public partial class StartMediaStreamingOptions + { + public StartMediaStreamingOptions() { } + public System.Uri OperationCallbackUri { get { throw null; } set { } } + public string OperationContext { get { throw null; } set { } } + } public partial class StartRecognizingCallMediaResult { internal StartRecognizingCallMediaResult() { } @@ -1498,7 +1613,13 @@ public partial class StartTranscriptionOptions { public StartTranscriptionOptions() { } public string Locale { get { throw null; } set { } } + public string OperationCallbackUri { get { throw null; } set { } } public string OperationContext { get { throw null; } set { } } + public string SpeechRecognitionModelEndpointId { get { throw null; } set { } } + } + public partial class StopAudio + { + public StopAudio() { } } public partial class StopHoldMusicOptions { @@ -1506,18 +1627,37 @@ public StopHoldMusicOptions(Azure.Communication.CommunicationIdentifier targetPa public string OperationContext { get { throw null; } set { } } public Azure.Communication.CommunicationIdentifier TargetParticipant { get { throw null; } } } + public partial class StopMediaStreamingOptions + { + public StopMediaStreamingOptions() { } + public System.Uri OperationCallbackUri { get { throw null; } set { } } + public string OperationContext { get { throw null; } set { } } + } public partial class StopTranscriptionOptions { public StopTranscriptionOptions() { } + public string OperationCallbackUri { get { throw null; } set { } } public string OperationContext { get { throw null; } set { } } + public string SpeechRecognitionModelEndpointId { get { throw null; } set { } } } public abstract partial class StreamingData { protected StreamingData() { } + public static Azure.Communication.CallAutomation.StreamingDataKind Kind { get { throw null; } } + public static Azure.Communication.CallAutomation.StreamingData Parse(string data) { throw null; } + public static T Parse(string data) where T : Azure.Communication.CallAutomation.StreamingData { throw null; } + } + [System.Text.Json.Serialization.JsonConverterAttribute(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] + public enum StreamingDataKind + { + AudioData = 0, + AudioMetadata = 1, + TranscriptionData = 2, + TranscriptionMetadata = 3, } public static partial class StreamingDataParser { - public static Azure.Communication.CallAutomation.StreamingData Parse(System.BinaryData json) { throw null; } + public static Azure.Communication.CallAutomation.StreamingData Parse(System.BinaryData binaryData) { throw null; } public static Azure.Communication.CallAutomation.StreamingData Parse(byte[] receivedBytes) { throw null; } public static Azure.Communication.CallAutomation.StreamingData Parse(string stringJson) { throw null; } } @@ -1540,17 +1680,18 @@ public partial class TranscriptionData : Azure.Communication.CallAutomation.Stre { internal TranscriptionData() { } public double Confidence { get { throw null; } set { } } - public ulong Duration { get { throw null; } set { } } + public System.TimeSpan Duration { get { throw null; } set { } } public Azure.Communication.CallAutomation.TextFormat Format { get { throw null; } set { } } - public ulong Offset { get { throw null; } set { } } + public System.TimeSpan Offset { get { throw null; } set { } } public Azure.Communication.CommunicationIdentifier Participant { get { throw null; } set { } } - public Azure.Communication.CallAutomation.ResultStatus ResultStatus { get { throw null; } set { } } + public Azure.Communication.CallAutomation.TranscriptionResultState ResultState { get { throw null; } set { } } public string Text { get { throw null; } set { } } public System.Collections.Generic.IEnumerable Words { get { throw null; } set { } } } public partial class TranscriptionFailed : Azure.Communication.CallAutomation.CallAutomationEventBase { internal TranscriptionFailed() { } + public Azure.Communication.CallAutomation.MediaEventReasonCode ReasonCode { get { throw null; } } public Azure.Communication.CallAutomation.TranscriptionUpdate TranscriptionUpdate { get { throw null; } } public static Azure.Communication.CallAutomation.TranscriptionFailed Deserialize(string content) { throw null; } } @@ -1568,12 +1709,32 @@ public TranscriptionMetadata() { } } public partial class TranscriptionOptions { - public TranscriptionOptions(System.Uri transportUri, Azure.Communication.CallAutomation.TranscriptionTransport transportType, string locale, bool startTranscription) { } + public TranscriptionOptions(System.Uri transportUri, string locale, bool? startTranscription = default(bool?), Azure.Communication.CallAutomation.TranscriptionTransport transcriptionTransport = default(Azure.Communication.CallAutomation.TranscriptionTransport)) { } + public bool? EnableIntermediateResults { get { throw null; } set { } } public string Locale { get { throw null; } } - public bool StartTranscription { get { throw null; } } + public string SpeechRecognitionModelEndpointId { get { throw null; } set { } } + public bool? StartTranscription { get { throw null; } } public Azure.Communication.CallAutomation.TranscriptionTransport TranscriptionTransport { get { throw null; } } public System.Uri TransportUrl { get { throw null; } } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct TranscriptionResultState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public TranscriptionResultState(string value) { throw null; } + public static Azure.Communication.CallAutomation.TranscriptionResultState Final { get { throw null; } } + public static Azure.Communication.CallAutomation.TranscriptionResultState Intermediate { get { throw null; } } + public bool Equals(Azure.Communication.CallAutomation.TranscriptionResultState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Communication.CallAutomation.TranscriptionResultState left, Azure.Communication.CallAutomation.TranscriptionResultState right) { throw null; } + public static implicit operator Azure.Communication.CallAutomation.TranscriptionResultState (string value) { throw null; } + public static bool operator !=(Azure.Communication.CallAutomation.TranscriptionResultState left, Azure.Communication.CallAutomation.TranscriptionResultState right) { throw null; } + public override string ToString() { throw null; } + } public partial class TranscriptionStarted : Azure.Communication.CallAutomation.CallAutomationEventBase { internal TranscriptionStarted() { } @@ -1639,6 +1800,32 @@ internal TranscriptionStopped() { } public Azure.Communication.CallAutomation.TranscriptionUpdate TranscriptionUpdate { get { throw null; } } public static Azure.Communication.CallAutomation.TranscriptionStopped Deserialize(string content) { throw null; } } + public partial class TranscriptionSubscription + { + internal TranscriptionSubscription() { } + public string Id { get { throw null; } } + public Azure.Communication.CallAutomation.TranscriptionSubscriptionState? State { get { throw null; } } + public System.Collections.Generic.IReadOnlyList SubscribedResultStates { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct TranscriptionSubscriptionState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public TranscriptionSubscriptionState(string value) { throw null; } + public static Azure.Communication.CallAutomation.TranscriptionSubscriptionState Active { get { throw null; } } + public static Azure.Communication.CallAutomation.TranscriptionSubscriptionState Disabled { get { throw null; } } + public static Azure.Communication.CallAutomation.TranscriptionSubscriptionState Inactive { get { throw null; } } + public bool Equals(Azure.Communication.CallAutomation.TranscriptionSubscriptionState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Communication.CallAutomation.TranscriptionSubscriptionState left, Azure.Communication.CallAutomation.TranscriptionSubscriptionState right) { throw null; } + public static implicit operator Azure.Communication.CallAutomation.TranscriptionSubscriptionState (string value) { throw null; } + public static bool operator !=(Azure.Communication.CallAutomation.TranscriptionSubscriptionState left, Azure.Communication.CallAutomation.TranscriptionSubscriptionState right) { throw null; } + public override string ToString() { throw null; } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct TranscriptionTransport : System.IEquatable { @@ -1718,6 +1905,13 @@ public UpdateDialogOptions(string dialogId, Azure.Communication.CallAutomation.D public string DialogId { get { throw null; } } public string OperationContext { get { throw null; } set { } } } + public partial class UpdateTranscriptionOptions + { + public UpdateTranscriptionOptions(string locale) { } + public string OperationCallbackUri { get { throw null; } set { } } + public string OperationContext { get { throw null; } set { } } + public string SpeechRecognitionModelEndpointId { get { throw null; } set { } } + } public partial class UserConsent { internal UserConsent() { } @@ -1743,11 +1937,11 @@ internal UserConsent() { } } public partial class WordData { - public WordData() { } + internal WordData() { } [System.Text.Json.Serialization.JsonPropertyNameAttribute("duration")] - public ulong Duration { get { throw null; } set { } } + public System.TimeSpan Duration { get { throw null; } set { } } [System.Text.Json.Serialization.JsonPropertyNameAttribute("offset")] - public ulong Offset { get { throw null; } set { } } + public System.TimeSpan Offset { get { throw null; } set { } } [System.Text.Json.Serialization.JsonPropertyNameAttribute("text")] public string Text { get { throw null; } set { } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/assets.json b/sdk/communication/Azure.Communication.CallAutomation/assets.json index 5601d08ddd16..1137740ba4e0 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/assets.json +++ b/sdk/communication/Azure.Communication.CallAutomation/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/communication/Azure.Communication.CallAutomation", - "Tag": "net/communication/Azure.Communication.CallAutomation_a7eb7ffb4a" + "Tag": "net/communication/Azure.Communication.CallAutomation_c4f60a9554" } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Azure.Communication.CallAutomation.csproj b/sdk/communication/Azure.Communication.CallAutomation/src/Azure.Communication.CallAutomation.csproj index ed196849ec97..eca71289027f 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Azure.Communication.CallAutomation.csproj +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Azure.Communication.CallAutomation.csproj @@ -6,7 +6,7 @@ Microsoft Azure Communication Call Automation quickstart - https://learn.microsoft.com/azure/communication-services/quickstarts/voice-video-calling/callflows-for-customer-interactions?pivots=programming-language-csharp Azure Communication CallAutomation Service - 1.3.0-beta.1 + 1.4.0-beta.2 Microsoft Azure Communication CallAutomation Service;Microsoft;Azure;Azure Communication Service;Azure Communication CallAutomation Service;Calling;Communication;$(PackageCommonTags) $(RequiredTargetFrameworks) diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/CallAutomationClient.cs b/sdk/communication/Azure.Communication.CallAutomation/src/CallAutomationClient.cs index a63950ff4b85..cbadd864ee41 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/CallAutomationClient.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/CallAutomationClient.cs @@ -179,7 +179,8 @@ public virtual async Task> AnswerCallAsync(AnswerCall scope.Start(); try { - if (options == null) throw new ArgumentNullException(nameof(options)); + if (options == null) + throw new ArgumentNullException(nameof(options)); AnswerCallRequestInternal request = CreateAnswerCallRequest(options); @@ -226,7 +227,8 @@ public virtual Response AnswerCall(AnswerCallOptions options, scope.Start(); try { - if (options == null) throw new ArgumentNullException(nameof(options)); + if (options == null) + throw new ArgumentNullException(nameof(options)); AnswerCallRequestInternal request = CreateAnswerCallRequest(options); @@ -259,8 +261,8 @@ private AnswerCallRequestInternal CreateAnswerCallRequest(AnswerCallOptions opti }; } - request.MediaStreamingConfiguration = CreateMediaStreamingOptionsInternal(options.MediaStreamingOptions); - request.TranscriptionConfiguration = CreateTranscriptionOptionsInternal(options.TranscriptionOptions); + request.MediaStreamingOptions = CreateMediaStreamingOptionsInternal(options.MediaStreamingOptions); + request.TranscriptionOptions = CreateTranscriptionOptionsInternal(options.TranscriptionOptions); request.AnsweredBy = Source == null ? null : new CommunicationUserIdentifierModel(Source.Id); request.OperationContext = options.OperationContext; request.CustomCallingContext = new CustomCallingContextInternal( @@ -344,8 +346,8 @@ public virtual Response RedirectCall(RedirectCallOptions options, CancellationTo RedirectCallRequestInternal request = new RedirectCallRequestInternal(options.IncomingCallContext, CommunicationIdentifierSerializer.Serialize(options.CallInvite.Target)); request.CustomCallingContext = new CustomCallingContextInternal( - options.CallInvite.CustomCallingContext.SipHeaders == null ? new ChangeTrackingDictionary() : options.CallInvite.CustomCallingContext.SipHeaders, - options.CallInvite.CustomCallingContext.VoipHeaders == null ? new ChangeTrackingDictionary() : options.CallInvite.CustomCallingContext.VoipHeaders); + options.CallInvite.CustomCallingContext.SipHeaders == null ? new ChangeTrackingDictionary() : options.CallInvite.CustomCallingContext.SipHeaders, + options.CallInvite.CustomCallingContext.VoipHeaders == null ? new ChangeTrackingDictionary() : options.CallInvite.CustomCallingContext.VoipHeaders); return AzureCommunicationServicesRestClient.RedirectCall(request, cancellationToken); } @@ -519,7 +521,8 @@ public virtual Response CreateCall(CreateCallOptions options, scope.Start(); try { - if (options == null) throw new ArgumentNullException(nameof(options)); + if (options == null) + throw new ArgumentNullException(nameof(options)); CreateCallRequestInternal request = CreateCallRequest(options); @@ -618,6 +621,107 @@ public virtual Response CreateGroupCall(CreateGroupCallOptions } } + /// + /// Create a connect request. + /// + /// + /// + /// + /// is null. + /// callbackUrl is not formatted correctly or empty. + /// The server returned an error. See for details returned from the server. + /// + public virtual async Task> ConnectCallAsync(CallLocator callLocator, Uri callbackUri, CancellationToken cancellationToken = default) + { + ConnectCallOptions options = new ConnectCallOptions(callLocator, callbackUri); + + return await ConnectCallAsync(options, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create a connect request. + /// + /// ConnectOptions for connect request. + /// The cancellation token. + /// is null. + /// CallbackUrl is not formatted correctly. + /// The server returned an error. See for details returned from the server. + /// + public virtual async Task> ConnectCallAsync(ConnectCallOptions connectCallOptions, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallAutomationClient)}.{nameof(ConnectCall)}"); + scope.Start(); + try + { + if (connectCallOptions == null) + throw new ArgumentNullException(nameof(connectCallOptions)); + + ConnectRequestInternal connectRequest = ConnectRequest(connectCallOptions); + Response response = await AzureCommunicationServicesRestClient.ConnectAsync(connectRequest).ConfigureAwait(false); + + var callConnection = GetCallConnection(response.Value.CallConnectionId); + ConnectCallResult connectResult = new ConnectCallResult(new CallConnectionProperties(response.Value), callConnection); + connectResult.SetEventProcessor(EventProcessor, response.Value.CallConnectionId); + + return Response.FromValue(connectResult, response.GetRawResponse()); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// + /// Create a connect request. + /// + /// + /// + /// + /// is null. + /// callbackUrl is not formatted correctly or empty. + /// The server returned an error. See for details returned from the server. + /// + public virtual Response ConnectCall(CallLocator callLocator, Uri callbackUri, CancellationToken cancellationToken = default) + { + ConnectCallOptions options = new ConnectCallOptions(callLocator, callbackUri); + + return ConnectCall(options, cancellationToken); + } + + /// + /// Create a connect request. + /// + /// ConnectOptions for connect request. + /// The cancellation token. + /// is null. + /// CallbackUrl is not formatted correctly. + /// The server returned an error. See for details returned from the server. + /// + public virtual Response ConnectCall(ConnectCallOptions connectCallOptions, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallAutomationClient)}.{nameof(ConnectCall)}"); + scope.Start(); + try + { + if (connectCallOptions == null) + throw new ArgumentNullException(nameof(connectCallOptions)); + + ConnectRequestInternal connectRequest = ConnectRequest(connectCallOptions); + Response response = AzureCommunicationServicesRestClient.Connect(connectRequest); + + var callConnection = GetCallConnection(response.Value.CallConnectionId); + ConnectCallResult connectResult = new ConnectCallResult(new CallConnectionProperties(response.Value), callConnection); + connectResult.SetEventProcessor(EventProcessor, response.Value.CallConnectionId); + + return Response.FromValue(connectResult, response.GetRawResponse()); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } private CreateCallRequestInternal CreateCallRequest(CreateCallOptions options) { CreateCallRequestInternal request = new( @@ -647,8 +751,8 @@ private CreateCallRequestInternal CreateCallRequest(CreateCallOptions options) } request.OperationContext = options.OperationContext; - request.MediaStreamingConfiguration = CreateMediaStreamingOptionsInternal(options.MediaStreamingOptions); - request.TranscriptionConfiguration = CreateTranscriptionOptionsInternal(options.TranscriptionOptions); + request.MediaStreamingOptions = CreateMediaStreamingOptionsInternal(options.MediaStreamingOptions); + request.TranscriptionOptions = CreateTranscriptionOptionsInternal(options.TranscriptionOptions); return request; } @@ -682,18 +786,39 @@ private CreateCallRequestInternal CreateCallRequest(CreateGroupCallOptions optio } request.OperationContext = options.OperationContext; - request.MediaStreamingConfiguration = CreateMediaStreamingOptionsInternal(options.MediaStreamingOptions); - request.TranscriptionConfiguration = CreateTranscriptionOptionsInternal(options.TranscriptionOptions); + request.MediaStreamingOptions = CreateMediaStreamingOptionsInternal(options.MediaStreamingOptions); + request.TranscriptionOptions = CreateTranscriptionOptionsInternal(options.TranscriptionOptions); return request; } + private ConnectRequestInternal ConnectRequest(ConnectCallOptions options) + { + CallLocatorInternal callLocatorInternal = CallLocatorSerializer.Serialize(options.CallLocator); + ConnectRequestInternal connectRequest = new ConnectRequestInternal(callLocatorInternal, options.CallbackUri?.AbsoluteUri); + connectRequest.OperationContext = options.OperationContext; + connectRequest.MediaStreamingOptions = CreateMediaStreamingOptionsInternal(options.MediaStreamingOptions); + connectRequest.TranscriptionOptions = CreateTranscriptionOptionsInternal(options.TranscriptionOptions); + + if (options.CallIntelligenceOptions != null && options.CallIntelligenceOptions.CognitiveServicesEndpoint != null) + { + CallIntelligenceOptionsInternal callIntelligenceOptionsInternal = new CallIntelligenceOptionsInternal + { + CognitiveServicesEndpoint = options.CallIntelligenceOptions?.CognitiveServicesEndpoint?.AbsoluteUri + }; + connectRequest.CallIntelligenceOptions = callIntelligenceOptionsInternal; + } + + return connectRequest; + } + /// /// Validates an Https Uri. /// /// /// - private static bool IsValidHttpsUri(Uri uri) { + private static bool IsValidHttpsUri(Uri uri) + { if (uri == null) return false; var uriString = uri.AbsoluteUri; @@ -704,15 +829,20 @@ private static MediaStreamingOptionsInternal CreateMediaStreamingOptionsInternal { return configuration == default ? default - : new MediaStreamingOptionsInternal(configuration.TransportUri.AbsoluteUri, configuration.MediaStreamingTransport, configuration.MediaStreamingContent, - configuration.MediaStreamingAudioChannel); + : new MediaStreamingOptionsInternal(configuration.TransportUri.AbsoluteUri, configuration.MediaStreamingTransport, + configuration.MediaStreamingContent, configuration.MediaStreamingAudioChannel, configuration.StartMediaStreaming, + configuration.EnableBidirectional, configuration.AudioFormat == null ? AudioFormat.Pcm24KMono : configuration.AudioFormat); } private static TranscriptionOptionsInternal CreateTranscriptionOptionsInternal(TranscriptionOptions configuration) { return configuration == default ? default : new TranscriptionOptionsInternal(configuration.TransportUrl.AbsoluteUri, configuration.TranscriptionTransport, configuration.Locale, - configuration.StartTranscription); + configuration.StartTranscription.GetValueOrDefault()) + { + EnableIntermediateResults = configuration.EnableIntermediateResults, + SpeechRecognitionModelEndpointId = configuration.SpeechRecognitionModelEndpointId + }; } /// Initializes a new instance of CallConnection. . diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/CallAutomationClientOptions.cs b/sdk/communication/Azure.Communication.CallAutomation/src/CallAutomationClientOptions.cs index 6b04dd4a45a3..dad018e2d037 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/CallAutomationClientOptions.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/CallAutomationClientOptions.cs @@ -16,7 +16,7 @@ public class CallAutomationClientOptions : ClientOptions /// /// The latest version of the CallAutomation service. /// - internal const ServiceVersion LatestVersion = ServiceVersion.V2023_10_03_Preview; + internal const ServiceVersion LatestVersion = ServiceVersion.V2024_09_01_Preview; internal string ApiVersion { get; } @@ -43,6 +43,7 @@ public CallAutomationClientOptions(ServiceVersion version = LatestVersion) ServiceVersion.V2023_06_15_Preview => "2023-06-15-preview", ServiceVersion.V2023_10_15 => "2023-10-15", ServiceVersion.V2023_10_03_Preview => "2023-10-03-preview", + ServiceVersion.V2024_09_01_Preview => "2024-09-01-preview", _ => throw new ArgumentOutOfRangeException(nameof(version)), }; } @@ -71,7 +72,12 @@ public enum ServiceVersion /// /// Latest ALPHA3 (1.2.0-alpha) preview of the CallAutomation service. /// - V2023_10_03_Preview = 4 + V2023_10_03_Preview = 4, + + /// + /// Latest ALPHA4 (1.4.0-alpha) preview of the CallAutomation service. + /// + V2024_09_01_Preview = 5 #pragma warning restore CA1707 // Identifiers should not contain underscores } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/CallAutomationEventProcessor/EventResult/AnswerCallEventResult.cs b/sdk/communication/Azure.Communication.CallAutomation/src/CallAutomationEventProcessor/EventResult/AnswerCallEventResult.cs index 70a68b7da14f..4bd7ddca1b05 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/CallAutomationEventProcessor/EventResult/AnswerCallEventResult.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/CallAutomationEventProcessor/EventResult/AnswerCallEventResult.cs @@ -17,7 +17,7 @@ public class AnswerCallEventResult public CallConnected SuccessResult { get; } /// - /// evnet will be returned when the call was not answered. + /// event will be returned once the call is established with AnswerCall. /// /// public AnswerFailed FailureResult { get; } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/CallAutomationEventProcessor/EventResult/ConnectCallEventResult.cs b/sdk/communication/Azure.Communication.CallAutomation/src/CallAutomationEventProcessor/EventResult/ConnectCallEventResult.cs new file mode 100644 index 000000000000..f6b5534ee12a --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/CallAutomationEventProcessor/EventResult/ConnectCallEventResult.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Azure.Communication.CallAutomation +{ + /// is returned from WaitForEvent of . + public class ConnectCallEventResult + { + /// + /// Indicates whether the returned event is considered successful or not. + /// + public bool IsSuccess { get; internal set; } + + /// + /// event will be returned once the connect succeeded. + /// + public CallConnected SuccessResult { get; } + + /// + /// event will be returned once the connect failed. + /// + public ConnectFailed FailureResult { get; } + + internal ConnectCallEventResult(bool isSuccess, ConnectFailed failureResult, CallConnected successResult) + { + IsSuccess = isSuccess; + FailureResult = failureResult; + SuccessResult = successResult; + } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/CallAutomationEventProcessor/EventResult/HoldEventResult.cs b/sdk/communication/Azure.Communication.CallAutomation/src/CallAutomationEventProcessor/EventResult/HoldEventResult.cs new file mode 100644 index 000000000000..3cbbad5dc69b --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/CallAutomationEventProcessor/EventResult/HoldEventResult.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Azure.Communication.CallAutomation +{ + /// is returned from WaitForEvent of . + public class HoldEventResult + { + /// + /// Indicates whether the returned event is considered successful or not. + /// + public bool IsSuccess { get; internal set; } + + /// + /// event will be returned once the hold failed. + /// + public HoldFailed FailureResult { get; } + + internal HoldEventResult(bool isSuccess, HoldFailed failureResult) + { + IsSuccess = isSuccess; + FailureResult = failureResult; + } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/CallMedia.cs b/sdk/communication/Azure.Communication.CallAutomation/src/CallMedia.cs index bc151e39f2c3..39e46b74b292 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/CallMedia.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/CallMedia.cs @@ -104,6 +104,41 @@ public virtual async Task> PlayAsync(PlaySource playSource, } } + /// + /// Plays audio to specified participant(s) async. + /// + /// + /// + /// + /// Returns , which can be used to wait for Play's related events. + public virtual async Task> PlayAsync(IEnumerable playSources, IEnumerable playTo, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(Play)}"); + scope.Start(); + try + { + var playOptions = new PlayOptions(playSources, playTo) + { + Loop = false, + OperationContext = null + }; + + PlayRequestInternal request = CreatePlayRequest(playOptions); + + var response = await CallMediaRestClient.PlayAsync(CallConnectionId, request, cancellationToken).ConfigureAwait(false); + + var result = new PlayResult(); + result.SetEventProcessor(EventProcessor, CallConnectionId, request.OperationContext); + + return Response.FromValue(result, response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + /// /// Plays audio to specified participant(s). /// @@ -167,6 +202,41 @@ public virtual Response Play(PlaySource playSource, IEnumerable + /// Plays a file. + /// + /// + /// + /// + /// Returns , which can be used to wait for Play's related events. + public virtual Response Play(IEnumerable playSources, IEnumerable playTo, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(Play)}"); + scope.Start(); + try + { + var playOptions = new PlayOptions(playSources, playTo) + { + Loop = false, + OperationContext = null + }; + + PlayRequestInternal request = CreatePlayRequest(playOptions); + + var response = CallMediaRestClient.Play(CallConnectionId, request, cancellationToken); + + var result = new PlayResult(); + result.SetEventProcessor(EventProcessor, CallConnectionId, request.OperationContext); + + return Response.FromValue(result, response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + private static PlayRequestInternal CreatePlayRequest(PlayOptions options) { PlayRequestInternal request = new PlayRequestInternal(options.PlaySources.Select(t => TranslatePlaySourceToInternal(t)).ToList()); @@ -235,6 +305,27 @@ public virtual async Task> PlayToAllAsync(PlaySource playSo } } + /// + /// Play to all participants async. + /// + /// + /// + /// Returns , which can be used to wait for Play's related events. + public virtual async Task> PlayToAllAsync(IEnumerable playSources, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(PlayToAll)}"); + scope.Start(); + try + { + return await PlayAsync(playSources, Enumerable.Empty(), cancellationToken).ConfigureAwait(false); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + /// /// Play audio to all participants. /// @@ -281,6 +372,27 @@ public virtual Response PlayToAll(PlaySource playSource, Cancellatio } } + /// + /// Play to all participants. + /// + /// + /// + /// Returns , which can be used to wait for Play's related events. + public virtual Response PlayToAll(IEnumerable playSources, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(PlayToAll)}"); + scope.Start(); + try + { + return Play(playSources, Enumerable.Empty(), cancellationToken); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + /// /// Cancel any media operation to all participants. /// @@ -393,23 +505,21 @@ public virtual Response StartRecognizing(CallMe /// The options. /// /// - [Obsolete("This operations is deprecated, please us Hold instead.")] - public virtual Response StartHoldMusic(StartHoldMusicOptions options, CancellationToken cancellationToken = default) + public virtual async Task HoldAsync(HoldOptions options, CancellationToken cancellationToken = default) { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(StartHoldMusic)}"); + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(HoldAsync)}"); scope.Start(); try { - //ToDo: Media team needs to fix the options.Loop since StartHoldMusicRequestInternal does not have Lopp anymore. - // and work on the StartHoldMusicRequestInternal.operationCallbackUri - var request = new StartHoldMusicRequestInternal( + var request = new HoldRequestInternal( CommunicationIdentifierSerializer.Serialize(options.TargetParticipant)) { OperationContext = options.OperationContext, - PlaySourceInfo = TranslatePlaySourceToInternal(options.PlaySourceInfo), + PlaySourceInfo = TranslatePlaySourceToInternal(options.PlaySource), + OperationCallbackUri = options.OperationCallbackUri?.AbsoluteUri, }; - return CallMediaRestClient.StartHoldMusic(CallConnectionId, request, cancellationToken: cancellationToken); + return await CallMediaRestClient.HoldAsync(CallConnectionId, request, cancellationToken: cancellationToken).ConfigureAwait(false); } catch (Exception ex) { @@ -421,24 +531,19 @@ public virtual Response StartHoldMusic(StartHoldMusicOptions options, Cancellati /// /// Hold participant from the call. /// - /// The options. + /// The targetParticipant. /// /// - [Obsolete("This operations is deprecated, please us HoldAsync instead.")] - public virtual async Task StartHoldMusicAsync(StartHoldMusicOptions options, CancellationToken cancellationToken = default) + public virtual async Task HoldAsync(CommunicationIdentifier targetParticipant, CancellationToken cancellationToken = default) { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(StartHoldMusicAsync)}"); + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(HoldAsync)}"); scope.Start(); try { - var request = new StartHoldMusicRequestInternal( - CommunicationIdentifierSerializer.Serialize(options.TargetParticipant)) - { - OperationContext = options.OperationContext, - PlaySourceInfo = TranslatePlaySourceToInternal(options.PlaySourceInfo), - }; + var request = new HoldRequestInternal( + CommunicationIdentifierSerializer.Serialize(targetParticipant)); - return await CallMediaRestClient.StartHoldMusicAsync(CallConnectionId, request, cancellationToken: cancellationToken).ConfigureAwait(false); + return await CallMediaRestClient.HoldAsync(CallConnectionId, request, cancellationToken: cancellationToken).ConfigureAwait(false); } catch (Exception ex) { @@ -448,21 +553,25 @@ public virtual async Task StartHoldMusicAsync(StartHoldMusicOptions op } /// - /// Remove hold from participant. + /// Hold participant from the call. /// - /// The options. + /// The targetParticipant. + /// The playsource. /// /// - [Obsolete("This operations is deprecated, please us UnholdAsync instead.")] - public virtual async Task StopHoldMusicAsync(StopHoldMusicOptions options, CancellationToken cancellationToken = default) + public virtual async Task HoldAsync(CommunicationIdentifier targetParticipant, PlaySource playSource, CancellationToken cancellationToken = default) { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(StopHoldMusicAsync)}"); + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(HoldAsync)}"); scope.Start(); try { - StopHoldMusicRequestInternal request = new StopHoldMusicRequestInternal(CommunicationIdentifierSerializer.Serialize(options.TargetParticipant)); + var request = new HoldRequestInternal( + CommunicationIdentifierSerializer.Serialize(targetParticipant)) + { + PlaySourceInfo = TranslatePlaySourceToInternal(playSource), + }; - return await CallMediaRestClient.StopHoldMusicAsync(CallConnectionId, request, cancellationToken: cancellationToken).ConfigureAwait(false); + return await CallMediaRestClient.HoldAsync(CallConnectionId, request, cancellationToken: cancellationToken).ConfigureAwait(false); } catch (Exception ex) { @@ -472,21 +581,26 @@ public virtual async Task StopHoldMusicAsync(StopHoldMusicOptions opti } /// - /// Remove hold from participant. + /// Hold participant from the call. /// /// The options. /// /// - [Obsolete("This operations is deprecated, please us Unhold instead.")] - public virtual Response StopHoldMusic(StopHoldMusicOptions options, CancellationToken cancellationToken = default) + public virtual Response Hold(HoldOptions options, CancellationToken cancellationToken = default) { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(StopHoldMusicAsync)}"); + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(Hold)}"); scope.Start(); try { - StopHoldMusicRequestInternal request = new StopHoldMusicRequestInternal(CommunicationIdentifierSerializer.Serialize(options.TargetParticipant)); + var request = new HoldRequestInternal( + CommunicationIdentifierSerializer.Serialize(options.TargetParticipant)) + { + OperationContext = options.OperationContext, + PlaySourceInfo = TranslatePlaySourceToInternal(options.PlaySource), + OperationCallbackUri = options.OperationCallbackUri?.AbsoluteUri, + }; - return CallMediaRestClient.StopHoldMusic(CallConnectionId, request, cancellationToken: cancellationToken); + return CallMediaRestClient.Hold(CallConnectionId, request, cancellationToken: cancellationToken); } catch (Exception ex) { @@ -498,24 +612,19 @@ public virtual Response StopHoldMusic(StopHoldMusicOptions options, Cancellation /// /// Hold participant from the call. /// - /// The options. + /// The targetParticipant. /// /// - public virtual async Task HoldAsync(HoldOptions options, CancellationToken cancellationToken = default) + public virtual Response Hold(CommunicationIdentifier targetParticipant, CancellationToken cancellationToken = default) { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(StartHoldMusicAsync)}"); + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(Hold)}"); scope.Start(); try { var request = new HoldRequestInternal( - CommunicationIdentifierSerializer.Serialize(options.TargetParticipant)) - { - OperationContext = options.OperationContext, - PlaySourceInfo = TranslatePlaySourceToInternal(options.PlaySourceInfo), - OperationCallbackUri = options.OperationCallbackUri?.AbsoluteUri, - }; + CommunicationIdentifierSerializer.Serialize(targetParticipant)); - return await CallMediaRestClient.HoldAsync(CallConnectionId, request, cancellationToken: cancellationToken).ConfigureAwait(false); + return CallMediaRestClient.Hold(CallConnectionId, request, cancellationToken: cancellationToken); } catch (Exception ex) { @@ -527,21 +636,20 @@ public virtual async Task HoldAsync(HoldOptions options, CancellationT /// /// Hold participant from the call. /// - /// The options. + /// The targetParticipant. + /// The playsource. /// /// - public virtual Response Hold(HoldOptions options, CancellationToken cancellationToken = default) + public virtual Response Hold(CommunicationIdentifier targetParticipant, PlaySource playSource, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(Hold)}"); scope.Start(); try { var request = new HoldRequestInternal( - CommunicationIdentifierSerializer.Serialize(options.TargetParticipant)) + CommunicationIdentifierSerializer.Serialize(targetParticipant)) { - OperationContext = options.OperationContext, - PlaySourceInfo = TranslatePlaySourceToInternal(options.PlaySourceInfo), - OperationCallbackUri = options.OperationCallbackUri?.AbsoluteUri, + PlaySourceInfo = TranslatePlaySourceToInternal(playSource), }; return CallMediaRestClient.Hold(CallConnectionId, request, cancellationToken: cancellationToken); @@ -561,7 +669,7 @@ public virtual Response Hold(HoldOptions options, CancellationToken cancellation /// public virtual async Task UnholdAsync(UnholdOptions options, CancellationToken cancellationToken = default) { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(StopHoldMusicAsync)}"); + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(UnholdAsync)}"); scope.Start(); try { @@ -576,6 +684,29 @@ public virtual async Task UnholdAsync(UnholdOptions options, Cancellat } } + /// + /// Remove hold from participant. + /// + /// The targetParticipant. + /// + /// + public virtual async Task UnholdAsync(CommunicationIdentifier targetParticipant, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(UnholdAsync)}"); + scope.Start(); + try + { + var request = new UnholdRequestInternal(CommunicationIdentifierSerializer.Serialize(targetParticipant)); + + return await CallMediaRestClient.UnholdAsync(CallConnectionId, request, cancellationToken: cancellationToken).ConfigureAwait(false); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + /// /// Remove hold from participant. /// @@ -584,7 +715,7 @@ public virtual async Task UnholdAsync(UnholdOptions options, Cancellat /// public virtual Response Unhold(UnholdOptions options, CancellationToken cancellationToken = default) { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(StopHoldMusicAsync)}"); + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(Unhold)}"); scope.Start(); try { @@ -599,6 +730,29 @@ public virtual Response Unhold(UnholdOptions options, CancellationToken cancella } } + /// + /// Remove hold from participant. + /// + /// The targetParticipant. + /// + /// + public virtual Response Unhold(CommunicationIdentifier targetParticipant, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(Unhold)}"); + scope.Start(); + try + { + var request = new UnholdRequestInternal(CommunicationIdentifierSerializer.Serialize(targetParticipant)); + + return CallMediaRestClient.Unhold(CallConnectionId, request, cancellationToken: cancellationToken); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + private static RecognizeRequestInternal CreateRecognizeRequest(CallMediaRecognizeOptions recognizeOptions) { if (recognizeOptions == null) @@ -623,6 +777,8 @@ private static RecognizeRequestInternal CreateRecognizeRequest(CallMediaRecogniz RecognizeRequestInternal request = new RecognizeRequestInternal(recognizeDtmfOptions.InputType, recognizeConfigurationsInternal); request.PlayPrompt = TranslatePlaySourceToInternal(recognizeDtmfOptions.Prompt); + if (recognizeOptions.PlayPrompts != null && recognizeOptions.PlayPrompts.Any()) + request.PlayPrompts = recognizeOptions.PlayPrompts.Select(t => TranslatePlaySourceToInternal(t)).ToList(); request.InterruptCallMediaOperation = recognizeOptions.InterruptCallMediaOperation; request.OperationContext = recognizeOptions.OperationContext == default ? Guid.NewGuid().ToString() : recognizeOptions.OperationContext; request.OperationCallbackUri = recognizeOptions.OperationCallbackUri?.AbsoluteUri; @@ -653,6 +809,8 @@ private static RecognizeRequestInternal CreateRecognizeRequest(CallMediaRecogniz RecognizeRequestInternal request = new RecognizeRequestInternal(recognizeChoiceOptions.InputType, recognizeConfigurationsInternal); request.PlayPrompt = TranslatePlaySourceToInternal(recognizeChoiceOptions.Prompt); + if (recognizeOptions.PlayPrompts != null && recognizeOptions.PlayPrompts.Any()) + request.PlayPrompts = recognizeOptions.PlayPrompts.Select(t => TranslatePlaySourceToInternal(t)).ToList(); request.InterruptCallMediaOperation = recognizeOptions.InterruptCallMediaOperation; request.OperationContext = recognizeOptions.OperationContext == default ? Guid.NewGuid().ToString() : recognizeOptions.OperationContext; request.OperationCallbackUri = recognizeOptions.OperationCallbackUri?.AbsoluteUri; @@ -686,6 +844,8 @@ private static RecognizeRequestInternal CreateRecognizeRequest(CallMediaRecogniz RecognizeRequestInternal request = new RecognizeRequestInternal(recognizeSpeechOptions.InputType, recognizeConfigurationsInternal); request.PlayPrompt = TranslatePlaySourceToInternal(recognizeSpeechOptions.Prompt); + if (recognizeOptions.PlayPrompts != null && recognizeOptions.PlayPrompts.Any()) + request.PlayPrompts = recognizeOptions.PlayPrompts.Select(t => TranslatePlaySourceToInternal(t)).ToList(); request.InterruptCallMediaOperation = recognizeOptions.InterruptCallMediaOperation; request.OperationContext = recognizeOptions.OperationContext == default ? Guid.NewGuid().ToString() : recognizeOptions.OperationContext; request.OperationCallbackUri = recognizeOptions.OperationCallbackUri?.AbsoluteUri; @@ -727,6 +887,8 @@ private static RecognizeRequestInternal CreateRecognizeRequest(CallMediaRecogniz RecognizeRequestInternal request = new RecognizeRequestInternal(recognizeSpeechOrDtmfOptions.InputType, recognizeConfigurationsInternal); request.PlayPrompt = TranslatePlaySourceToInternal(recognizeSpeechOrDtmfOptions.Prompt); + if (recognizeOptions.PlayPrompts != null && recognizeOptions.PlayPrompts.Any()) + request.PlayPrompts = recognizeOptions.PlayPrompts.Select(t => TranslatePlaySourceToInternal(t)).ToList(); request.InterruptCallMediaOperation = recognizeOptions.InterruptCallMediaOperation; request.OperationContext = recognizeOptions.OperationContext == default ? Guid.NewGuid().ToString() : recognizeOptions.OperationContext; request.OperationCallbackUri = recognizeOptions.OperationCallbackUri?.AbsoluteUri; @@ -1108,7 +1270,7 @@ public virtual Response StartTranscription(StartTranscriptionOptions options = d { var request = options == default ? new StartTranscriptionRequestInternal() - : new StartTranscriptionRequestInternal() { Locale = options.Locale, OperationContext = options.OperationContext }; + : new StartTranscriptionRequestInternal() { Locale = options.Locale, OperationContext = options.OperationContext, OperationCallbackUri=options.OperationCallbackUri, SpeechRecognitionModelEndpointId=options.SpeechRecognitionModelEndpointId }; return CallMediaRestClient.StartTranscription(CallConnectionId, request, cancellationToken); } @@ -1133,7 +1295,7 @@ public virtual async Task StartTranscriptionAsync(StartTranscriptionOp { var request = options == default ? new StartTranscriptionRequestInternal() - : new StartTranscriptionRequestInternal() { Locale = options.Locale, OperationContext = options.OperationContext }; + : new StartTranscriptionRequestInternal() { Locale = options.Locale, OperationContext = options.OperationContext, OperationCallbackUri = options.OperationCallbackUri, SpeechRecognitionModelEndpointId = options.SpeechRecognitionModelEndpointId }; return await CallMediaRestClient.StartTranscriptionAsync(CallConnectionId, request, cancellationToken).ConfigureAwait(false); } @@ -1158,7 +1320,7 @@ public virtual Response StopTranscription(StopTranscriptionOptions options = def { var request = options == default ? new StopTranscriptionRequestInternal() - : new StopTranscriptionRequestInternal() { OperationContext = options.OperationContext }; + : new StopTranscriptionRequestInternal() { OperationContext = options.OperationContext, OperationCallbackUri = options.OperationCallbackUri }; return CallMediaRestClient.StopTranscription(CallConnectionId, request, cancellationToken); } @@ -1183,7 +1345,7 @@ public virtual async Task StopTranscriptionAsync(StopTranscriptionOpti { var request = options == default ? new StopTranscriptionRequestInternal() - : new StopTranscriptionRequestInternal() { OperationContext = options.OperationContext }; + : new StopTranscriptionRequestInternal() { OperationContext = options.OperationContext, OperationCallbackUri = options.OperationCallbackUri }; return await CallMediaRestClient.StopTranscriptionAsync(CallConnectionId, request, cancellationToken).ConfigureAwait(false); } @@ -1216,6 +1378,29 @@ public virtual Response UpdateTranscription(string locale, CancellationToken can } } + /// + /// API to change transcription language. + /// + /// An optional object containing update transcription options and configurations. + /// An optional CancellationToken to cancel the request. + /// Returns an HTTP response with a 202 status code for success, or an HTTP failure error code in case of an error. + public virtual Response UpdateTranscription(UpdateTranscriptionOptions options = default, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(UpdateTranscription)}"); + scope.Start(); + try + { + UpdateTranscriptionRequestInternal request = new(options.Locale, options.SpeechRecognitionModelEndpointId, options.OperationContext, options.OperationCallbackUri); + + return CallMediaRestClient.UpdateTranscription(CallConnectionId, request, cancellationToken); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + /// /// API to change transcription language. /// @@ -1237,5 +1422,128 @@ public virtual async Task UpdateTranscriptionAsync(string locale, Canc throw; } } + + /// + /// API to change transcription language. + /// + /// An optional object containing update transcription options and configurations. + /// An optional CancellationToken to cancel the request. + /// Returns an HTTP response with a 202 status code for success, or an HTTP failure error code in case of an error. + public virtual async Task UpdateTranscriptionAsync(UpdateTranscriptionOptions options = default, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(UpdateTranscription)}"); + scope.Start(); + try + { + UpdateTranscriptionRequestInternal request = new(options.Locale, options.SpeechRecognitionModelEndpointId, options.OperationContext, options.OperationCallbackUri); + + return await CallMediaRestClient.UpdateTranscriptionAsync(CallConnectionId, request, cancellationToken).ConfigureAwait(false); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// + /// Starts media streaming in the call. + /// + /// An optional object containing start media streaming options. + /// An optional CancellationToken to cancel the request. + /// Returns an HTTP response with a 202 status code for success, or an HTTP failure error code in case of an error. + public virtual Response StartMediaStreaming(StartMediaStreamingOptions options = default, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(StartMediaStreaming)}"); + scope.Start(); + try + { + var request = options == default + ? new StartMediaStreamingRequestInternal() + : new StartMediaStreamingRequestInternal() { OperationCallbackUri = options.OperationCallbackUri?.AbsoluteUri, OperationContext = options.OperationContext }; + + return CallMediaRestClient.StartMediaStreaming(CallConnectionId, request, cancellationToken); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// + /// Starts media streaming in the call. + /// + /// An optional object containing start media streaming options. + /// An optional CancellationToken to cancel the request. + /// Returns an HTTP response with a 202 status code for success, or an HTTP failure error code in case of an error. + public virtual async Task StartMediaStreamingAsync(StartMediaStreamingOptions options = default, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(StartMediaStreaming)}"); + scope.Start(); + try + { + var request = options == default + ? new StartMediaStreamingRequestInternal() + : new StartMediaStreamingRequestInternal() { OperationCallbackUri = options.OperationCallbackUri?.AbsoluteUri, OperationContext = options.OperationContext }; + + return await CallMediaRestClient.StartMediaStreamingAsync(CallConnectionId, request, cancellationToken).ConfigureAwait(false); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// + /// Stops media streaming in the call. + /// + /// An optional object containing stop media streaming options. + /// An optional CancellationToken to cancel the request. + /// Returns an HTTP response with a 202 status code for success, or an HTTP failure error code in case of an error. + public virtual Response StopMediaStreaming(StopMediaStreamingOptions options = default, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(StopMediaStreaming)}"); + scope.Start(); + try + { + var request = options == default + ? new StopMediaStreamingRequestInternal() + : new StopMediaStreamingRequestInternal() { OperationCallbackUri = options.OperationCallbackUri?.AbsoluteUri, OperationContext = options.OperationContext }; + + return CallMediaRestClient.StopMediaStreaming(CallConnectionId, request, cancellationToken); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// + /// Stops media streaming in the call. + /// + /// An optional object containing stop media streaming options. + /// An optional CancellationToken to cancel the request. + /// Returns an HTTP response with a 202 status code for success, or an HTTP failure error code in case of an error. + public virtual async Task StopMediaStreamingAsync(StopMediaStreamingOptions options = default, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(StopMediaStreaming)}"); + scope.Start(); + try + { + var request = options == default + ? new StopMediaStreamingRequestInternal() + : new StopMediaStreamingRequestInternal() { OperationCallbackUri = options.OperationCallbackUri?.AbsoluteUri }; // OperationContext = options.OperationContext + + return await CallMediaRestClient.StopMediaStreamingAsync(CallConnectionId, request, cancellationToken).ConfigureAwait(false); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/CallRecording.cs b/sdk/communication/Azure.Communication.CallAutomation/src/CallRecording.cs index 77e7dccf4f63..1b30b00039bc 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/CallRecording.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/CallRecording.cs @@ -56,8 +56,9 @@ public virtual Response Start(StartRecordingOptions option scope.Start(); try { - StartCallRecordingRequestInternal request = new(CallLocatorSerializer.Serialize(options.CallLocator)) + StartCallRecordingRequestInternal request = new() { + CallLocator = CallLocatorSerializer.Serialize(options.CallLocator), RecordingStateCallbackUri = options.RecordingStateCallbackUri?.AbsoluteUri, RecordingChannelType = options.RecordingChannel, RecordingContentType = options.RecordingContent, @@ -118,8 +119,9 @@ public virtual async Task> StartAsync(StartRecord scope.Start(); try { - StartCallRecordingRequestInternal request = new(CallLocatorSerializer.Serialize(options.CallLocator)) + StartCallRecordingRequestInternal request = new() { + CallLocator = CallLocatorSerializer.Serialize(options.CallLocator), RecordingStateCallbackUri = options.RecordingStateCallbackUri?.AbsoluteUri, RecordingChannelType = options.RecordingChannel, RecordingContentType = options.RecordingContent, diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/AzureCommunicationServicesRestClient.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/AzureCommunicationServicesRestClient.cs index 30b3c24f2578..6345b6e95be2 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/AzureCommunicationServicesRestClient.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/AzureCommunicationServicesRestClient.cs @@ -29,7 +29,7 @@ internal partial class AzureCommunicationServicesRestClient /// The endpoint of the Azure Communication resource. /// Api Version. /// , , or is null. - public AzureCommunicationServicesRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion = "2023-10-03-preview") + public AzureCommunicationServicesRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion = "2024-09-01-preview") { ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics)); _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); @@ -314,5 +314,81 @@ public Response RejectCall(RejectCallRequestInternal rejectCallRequestInternal, throw new RequestFailedException(message.Response); } } + + internal HttpMessage CreateConnectRequest(ConnectRequestInternal connectRequestInternal) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/calling/callConnections:connect", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Repeatability-Request-ID", Guid.NewGuid()); + request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(connectRequestInternal); + request.Content = content; + return message; + } + + /// Create a Connection to a CallLocator. + /// The create connection request. + /// The cancellation token to use. + /// is null. + /// Create a connection to a CallLocator. + public async Task> ConnectAsync(ConnectRequestInternal connectRequestInternal, CancellationToken cancellationToken = default) + { + if (connectRequestInternal == null) + { + throw new ArgumentNullException(nameof(connectRequestInternal)); + } + + using var message = CreateConnectRequest(connectRequestInternal); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + CallConnectionPropertiesInternal value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = CallConnectionPropertiesInternal.DeserializeCallConnectionPropertiesInternal(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a Connection to a CallLocator. + /// The create connection request. + /// The cancellation token to use. + /// is null. + /// Create a connection to a CallLocator. + public Response Connect(ConnectRequestInternal connectRequestInternal, CancellationToken cancellationToken = default) + { + if (connectRequestInternal == null) + { + throw new ArgumentNullException(nameof(connectRequestInternal)); + } + + using var message = CreateConnectRequest(connectRequestInternal); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + CallConnectionPropertiesInternal value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = CallConnectionPropertiesInternal.DeserializeCallConnectionPropertiesInternal(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallAutomationModelFactory.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallAutomationModelFactory.cs index 7be732a51cf9..1a76faff3b67 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallAutomationModelFactory.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallAutomationModelFactory.cs @@ -46,16 +46,6 @@ public static UnmuteParticipantResult UnmuteParticipantResult(string operationCo return new UnmuteParticipantResult(operationContext); } - /// Initializes a new instance of . - /// - /// - /// - /// A new instance for mocking. - public static RecordingStateResult RecordingStateResult(string recordingId = null, RecordingState? recordingState = null, RecordingKind? recordingKind = null) - { - return new RecordingStateResult(recordingId, recordingState, recordingKind); - } - /// Initializes a new instance of . /// Code of the current result. This can be helpful to Call Automation team to troubleshoot the issue if this result was unexpected. /// Subcode of the current result. This can be helpful to Call Automation team to troubleshoot the issue if this result was unexpected. @@ -66,35 +56,6 @@ public static ResultInformation ResultInformation(int? code = null, int? subCode return new ResultInformation(code, subCode, message); } - /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. - /// Indicates the index of the failed play source. - /// Call connection ID. - /// Server call ID. - /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - /// A new instance for mocking. - public static PlayFailed PlayFailed(string operationContext = null, ResultInformation resultInformation = null, int? failedPlaySourceIndex = null, string callConnectionId = null, string serverCallId = null, string correlationId = null) - { - return new PlayFailed( - operationContext, - resultInformation, - failedPlaySourceIndex, - callConnectionId, - serverCallId, - correlationId); - } - - /// Initializes a new instance of . - /// - /// A new instance for mocking. - public static CollectTonesResult CollectTonesResult(IEnumerable tones = null) - { - tones ??= new List(); - - return new CollectTonesResult(tones?.ToList()); - } - /// Initializes a new instance of . /// /// A new instance for mocking. @@ -105,14 +66,6 @@ public static DtmfResult DtmfResult(IEnumerable tones = null) return new DtmfResult(tones?.ToList()); } - /// Initializes a new instance of . - /// The recognized speech in string. - /// A new instance for mocking. - public static SpeechResult SpeechResult(string speech = null) - { - return new SpeechResult(speech); - } - /// Initializes a new instance of . /// Label is the primary identifier for the choice detected. /// @@ -125,23 +78,12 @@ public static ChoiceResult ChoiceResult(string label = null, string recognizedPh return new ChoiceResult(label, recognizedPhrase); } - /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. - /// Indicates the index of the failed play source. - /// Call connection ID. - /// Server call ID. - /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - /// A new instance for mocking. - public static RecognizeFailed RecognizeFailed(string operationContext = null, ResultInformation resultInformation = null, int? failedPlaySourceIndex = null, string callConnectionId = null, string serverCallId = null, string correlationId = null) + /// Initializes a new instance of . + /// The recognized speech in string. + /// A new instance for mocking. + public static SpeechResult SpeechResult(string speech = null) { - return new RecognizeFailed( - operationContext, - resultInformation, - failedPlaySourceIndex, - callConnectionId, - serverCallId, - correlationId); + return new SpeechResult(speech); } /// Initializes a new instance of . @@ -153,22 +95,22 @@ public static UserConsent UserConsent(int? recording = null) } /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. /// Defines the result for TranscriptionUpdate with the current status and the details about the status. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. /// A new instance for mocking. - public static TranscriptionStarted TranscriptionStarted(string operationContext = null, ResultInformation resultInformation = null, TranscriptionUpdate transcriptionUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null) + public static TranscriptionStarted TranscriptionStarted(TranscriptionUpdate transcriptionUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null) { return new TranscriptionStarted( - operationContext, - resultInformation, transcriptionUpdate, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation); } /// Initializes a new instance of . @@ -181,79 +123,79 @@ public static TranscriptionUpdate TranscriptionUpdate(TranscriptionStatus? trans } /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. /// Defines the result for TranscriptionUpdate with the current status and the details about the status. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. /// A new instance for mocking. - public static TranscriptionStopped TranscriptionStopped(string operationContext = null, ResultInformation resultInformation = null, TranscriptionUpdate transcriptionUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null) + public static TranscriptionStopped TranscriptionStopped(TranscriptionUpdate transcriptionUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null) { return new TranscriptionStopped( - operationContext, - resultInformation, transcriptionUpdate, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation); } /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. /// Defines the result for TranscriptionUpdate with the current status and the details about the status. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. /// A new instance for mocking. - public static TranscriptionFailed TranscriptionFailed(string operationContext = null, ResultInformation resultInformation = null, TranscriptionUpdate transcriptionUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null) + public static TranscriptionFailed TranscriptionFailed(TranscriptionUpdate transcriptionUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null) { return new TranscriptionFailed( - operationContext, - resultInformation, transcriptionUpdate, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation); } /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. /// Defines the result for TranscriptionUpdate with the current status and the details about the status. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. /// A new instance for mocking. - public static TranscriptionUpdated TranscriptionUpdated(string operationContext = null, ResultInformation resultInformation = null, TranscriptionUpdate transcriptionUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null) + public static TranscriptionUpdated TranscriptionUpdated(TranscriptionUpdate transcriptionUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null) { return new TranscriptionUpdated( - operationContext, - resultInformation, transcriptionUpdate, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation); } /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. - /// Defines the result for audio streaming update with the current status and the details about the status. + /// Defines the result for MediaStreamingUpdate with the current status and the details about the status. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. /// A new instance for mocking. - public static MediaStreamingFailed MediaStreamingFailed(string operationContext = null, ResultInformation resultInformation = null, MediaStreamingUpdate mediaStreamingUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null) + public static MediaStreamingFailed MediaStreamingFailed(MediaStreamingUpdate mediaStreamingUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null) { return new MediaStreamingFailed( - operationContext, - resultInformation, mediaStreamingUpdate, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation); } /// Initializes a new instance of . @@ -267,41 +209,41 @@ public static MediaStreamingUpdate MediaStreamingUpdate(string contentType = nul } /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. - /// Defines the result for audio streaming update with the current status and the details about the status. + /// Defines the result for MediaStreamingUpdate with the current status and the details about the status. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. /// A new instance for mocking. - public static MediaStreamingStarted MediaStreamingStarted(string operationContext = null, ResultInformation resultInformation = null, MediaStreamingUpdate mediaStreamingUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null) + public static MediaStreamingStarted MediaStreamingStarted(MediaStreamingUpdate mediaStreamingUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null) { return new MediaStreamingStarted( - operationContext, - resultInformation, mediaStreamingUpdate, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation); } /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. - /// Defines the result for audio streaming update with the current status and the details about the status. + /// Defines the result for MediaStreamingUpdate with the current status and the details about the status. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. /// A new instance for mocking. - public static MediaStreamingStopped MediaStreamingStopped(string operationContext = null, ResultInformation resultInformation = null, MediaStreamingUpdate mediaStreamingUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null) + public static MediaStreamingStopped MediaStreamingStopped(MediaStreamingUpdate mediaStreamingUpdate = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null) { return new MediaStreamingStopped( - operationContext, - resultInformation, mediaStreamingUpdate, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallConnectionRestClient.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallConnectionRestClient.cs index 831f28de3d56..c76e65cbac13 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallConnectionRestClient.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallConnectionRestClient.cs @@ -29,7 +29,7 @@ internal partial class CallConnectionRestClient /// The endpoint of the Azure Communication resource. /// Api Version. /// , , or is null. - public CallConnectionRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion = "2023-10-03-preview") + public CallConnectionRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion = "2024-09-01-preview") { ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics)); _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); @@ -407,7 +407,7 @@ internal HttpMessage CreateAddParticipantRequest(string callConnectionId, AddPar /// Add a participant to the call. /// The call connection Id. - /// The to use. + /// The add participants request. /// The cancellation token to use. /// or is null. public async Task> AddParticipantAsync(string callConnectionId, AddParticipantRequestInternal addParticipantRequestInternal, CancellationToken cancellationToken = default) @@ -439,7 +439,7 @@ public async Task> AddParticipantAsync( /// Add a participant to the call. /// The call connection Id. - /// The to use. + /// The add participants request. /// The cancellation token to use. /// or is null. public Response AddParticipant(string callConnectionId, AddParticipantRequestInternal addParticipantRequestInternal, CancellationToken cancellationToken = default) diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallDialogRestClient.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallDialogRestClient.cs index 34dc32e28db9..57ab85942184 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallDialogRestClient.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallDialogRestClient.cs @@ -29,7 +29,7 @@ internal partial class CallDialogRestClient /// The endpoint of the Azure Communication resource. /// Api Version. /// , , or is null. - public CallDialogRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion = "2023-10-03-preview") + public CallDialogRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion = "2024-09-01-preview") { ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics)); _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallMediaRestClient.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallMediaRestClient.cs index ec699000f758..b64397fa8ce8 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallMediaRestClient.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallMediaRestClient.cs @@ -29,7 +29,7 @@ internal partial class CallMediaRestClient /// The endpoint of the Azure Communication resource. /// Api Version. /// , , or is null. - public CallMediaRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion = "2023-10-03-preview") + public CallMediaRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion = "2024-09-01-preview") { ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics)); _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); @@ -851,81 +851,7 @@ public Response Unhold(string callConnectionId, UnholdRequestInternal unholdRequ } } - internal HttpMessage CreateStartHoldMusicRequest(string callConnectionId, StartHoldMusicRequestInternal startHoldMusicRequestInternal) - { - 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(startHoldMusicRequestInternal); - 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 startHoldMusicRequestInternal, CancellationToken cancellationToken = default) - { - if (callConnectionId == null) - { - throw new ArgumentNullException(nameof(callConnectionId)); - } - if (startHoldMusicRequestInternal == null) - { - throw new ArgumentNullException(nameof(startHoldMusicRequestInternal)); - } - - using var message = CreateStartHoldMusicRequest(callConnectionId, startHoldMusicRequestInternal); - 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 startHoldMusicRequestInternal, CancellationToken cancellationToken = default) - { - if (callConnectionId == null) - { - throw new ArgumentNullException(nameof(callConnectionId)); - } - if (startHoldMusicRequestInternal == null) - { - throw new ArgumentNullException(nameof(startHoldMusicRequestInternal)); - } - - using var message = CreateStartHoldMusicRequest(callConnectionId, startHoldMusicRequestInternal); - _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 stopHoldMusicRequestInternal) + internal HttpMessage CreateStartMediaStreamingRequest(string callConnectionId, StartMediaStreamingRequestInternal startMediaStreamingRequestInternal) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -934,72 +860,74 @@ internal HttpMessage CreateStopHoldMusicRequest(string callConnectionId, StopHol uri.Reset(_endpoint); uri.AppendPath("/calling/callConnections/", false); uri.AppendPath(callConnectionId, true); - uri.AppendPath(":stopHoldMusic", false); + uri.AppendPath(":startMediaStreaming", 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(stopHoldMusicRequestInternal); + content.JsonWriter.WriteObjectValue(startMediaStreamingRequestInternal); request.Content = content; return message; } - /// Unhold participants from the call using identifier. + /// Starts media streaming in the call. /// The call connection id. - /// The participants to be hold from the call. + /// The to use. /// The cancellation token to use. - /// or is null. - public async Task StopHoldMusicAsync(string callConnectionId, StopHoldMusicRequestInternal stopHoldMusicRequestInternal, CancellationToken cancellationToken = default) + /// or is null. + /// Starts media streaming in the call. + public async Task StartMediaStreamingAsync(string callConnectionId, StartMediaStreamingRequestInternal startMediaStreamingRequestInternal, CancellationToken cancellationToken = default) { if (callConnectionId == null) { throw new ArgumentNullException(nameof(callConnectionId)); } - if (stopHoldMusicRequestInternal == null) + if (startMediaStreamingRequestInternal == null) { - throw new ArgumentNullException(nameof(stopHoldMusicRequestInternal)); + throw new ArgumentNullException(nameof(startMediaStreamingRequestInternal)); } - using var message = CreateStopHoldMusicRequest(callConnectionId, stopHoldMusicRequestInternal); + using var message = CreateStartMediaStreamingRequest(callConnectionId, startMediaStreamingRequestInternal); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { - case 200: + case 202: return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Unhold participants from the call using identifier. + /// Starts media streaming in the call. /// The call connection id. - /// The participants to be hold from the call. + /// The to use. /// The cancellation token to use. - /// or is null. - public Response StopHoldMusic(string callConnectionId, StopHoldMusicRequestInternal stopHoldMusicRequestInternal, CancellationToken cancellationToken = default) + /// or is null. + /// Starts media streaming in the call. + public Response StartMediaStreaming(string callConnectionId, StartMediaStreamingRequestInternal startMediaStreamingRequestInternal, CancellationToken cancellationToken = default) { if (callConnectionId == null) { throw new ArgumentNullException(nameof(callConnectionId)); } - if (stopHoldMusicRequestInternal == null) + if (startMediaStreamingRequestInternal == null) { - throw new ArgumentNullException(nameof(stopHoldMusicRequestInternal)); + throw new ArgumentNullException(nameof(startMediaStreamingRequestInternal)); } - using var message = CreateStopHoldMusicRequest(callConnectionId, stopHoldMusicRequestInternal); + using var message = CreateStartMediaStreamingRequest(callConnectionId, startMediaStreamingRequestInternal); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { - case 200: + case 202: return message.Response; default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateStartMediaStreamingRequest(string callConnectionId, StartMediaStreamingRequestInternal startMediaStreamingRequestInternal) + internal HttpMessage CreateStopMediaStreamingRequest(string callConnectionId, StopMediaStreamingRequestInternal stopMediaStreamingRequestInternal) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1008,35 +936,35 @@ internal HttpMessage CreateStartMediaStreamingRequest(string callConnectionId, S uri.Reset(_endpoint); uri.AppendPath("/calling/callConnections/", false); uri.AppendPath(callConnectionId, true); - uri.AppendPath(":startMediaStreaming", false); + uri.AppendPath(":stopMediaStreaming", 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(startMediaStreamingRequestInternal); + content.JsonWriter.WriteObjectValue(stopMediaStreamingRequestInternal); request.Content = content; return message; } - /// Starts media streaming in the call. + /// Stops media streaming in the call. /// The call connection id. - /// The to use. + /// stop media streaming request payload. /// The cancellation token to use. - /// or is null. - /// Starts media streaming in the call. - public async Task StartMediaStreamingAsync(string callConnectionId, StartMediaStreamingRequestInternal startMediaStreamingRequestInternal, CancellationToken cancellationToken = default) + /// or is null. + /// Stops media streaming in the call. + public async Task StopMediaStreamingAsync(string callConnectionId, StopMediaStreamingRequestInternal stopMediaStreamingRequestInternal, CancellationToken cancellationToken = default) { if (callConnectionId == null) { throw new ArgumentNullException(nameof(callConnectionId)); } - if (startMediaStreamingRequestInternal == null) + if (stopMediaStreamingRequestInternal == null) { - throw new ArgumentNullException(nameof(startMediaStreamingRequestInternal)); + throw new ArgumentNullException(nameof(stopMediaStreamingRequestInternal)); } - using var message = CreateStartMediaStreamingRequest(callConnectionId, startMediaStreamingRequestInternal); + using var message = CreateStopMediaStreamingRequest(callConnectionId, stopMediaStreamingRequestInternal); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1047,24 +975,24 @@ public async Task StartMediaStreamingAsync(string callConnectionId, St } } - /// Starts media streaming in the call. + /// Stops media streaming in the call. /// The call connection id. - /// The to use. + /// stop media streaming request payload. /// The cancellation token to use. - /// or is null. - /// Starts media streaming in the call. - public Response StartMediaStreaming(string callConnectionId, StartMediaStreamingRequestInternal startMediaStreamingRequestInternal, CancellationToken cancellationToken = default) + /// or is null. + /// Stops media streaming in the call. + public Response StopMediaStreaming(string callConnectionId, StopMediaStreamingRequestInternal stopMediaStreamingRequestInternal, CancellationToken cancellationToken = default) { if (callConnectionId == null) { throw new ArgumentNullException(nameof(callConnectionId)); } - if (startMediaStreamingRequestInternal == null) + if (stopMediaStreamingRequestInternal == null) { - throw new ArgumentNullException(nameof(startMediaStreamingRequestInternal)); + throw new ArgumentNullException(nameof(stopMediaStreamingRequestInternal)); } - using var message = CreateStartMediaStreamingRequest(callConnectionId, startMediaStreamingRequestInternal); + using var message = CreateStopMediaStreamingRequest(callConnectionId, stopMediaStreamingRequestInternal); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1075,7 +1003,7 @@ public Response StartMediaStreaming(string callConnectionId, StartMediaStreaming } } - internal HttpMessage CreateStopMediaStreamingRequest(string callConnectionId, StopMediaStreamingRequestInternal stopMediaStreamingRequestInternal) + internal HttpMessage CreateInterruptAudioAndAnnounceRequest(string callConnectionId, InterruptAudioAndAnnounceRequestInternal interruptRequest) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1084,35 +1012,34 @@ internal HttpMessage CreateStopMediaStreamingRequest(string callConnectionId, St uri.Reset(_endpoint); uri.AppendPath("/calling/callConnections/", false); uri.AppendPath(callConnectionId, true); - uri.AppendPath(":stopMediaStreaming", false); + uri.AppendPath(":interruptAudioAndAnnounce", 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(stopMediaStreamingRequestInternal); + content.JsonWriter.WriteObjectValue(interruptRequest); request.Content = content; return message; } - /// Stops media streaming in the call. + /// Plays audio to participants in the call. /// The call connection id. - /// stop media streaming request payload. + /// play request payload. /// The cancellation token to use. - /// or is null. - /// Stops media streaming in the call. - public async Task StopMediaStreamingAsync(string callConnectionId, StopMediaStreamingRequestInternal stopMediaStreamingRequestInternal, CancellationToken cancellationToken = default) + /// or is null. + public async Task InterruptAudioAndAnnounceAsync(string callConnectionId, InterruptAudioAndAnnounceRequestInternal interruptRequest, CancellationToken cancellationToken = default) { if (callConnectionId == null) { throw new ArgumentNullException(nameof(callConnectionId)); } - if (stopMediaStreamingRequestInternal == null) + if (interruptRequest == null) { - throw new ArgumentNullException(nameof(stopMediaStreamingRequestInternal)); + throw new ArgumentNullException(nameof(interruptRequest)); } - using var message = CreateStopMediaStreamingRequest(callConnectionId, stopMediaStreamingRequestInternal); + using var message = CreateInterruptAudioAndAnnounceRequest(callConnectionId, interruptRequest); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1123,24 +1050,23 @@ public async Task StopMediaStreamingAsync(string callConnectionId, Sto } } - /// Stops media streaming in the call. + /// Plays audio to participants in the call. /// The call connection id. - /// stop media streaming request payload. + /// play request payload. /// The cancellation token to use. - /// or is null. - /// Stops media streaming in the call. - public Response StopMediaStreaming(string callConnectionId, StopMediaStreamingRequestInternal stopMediaStreamingRequestInternal, CancellationToken cancellationToken = default) + /// or is null. + public Response InterruptAudioAndAnnounce(string callConnectionId, InterruptAudioAndAnnounceRequestInternal interruptRequest, CancellationToken cancellationToken = default) { if (callConnectionId == null) { throw new ArgumentNullException(nameof(callConnectionId)); } - if (stopMediaStreamingRequestInternal == null) + if (interruptRequest == null) { - throw new ArgumentNullException(nameof(stopMediaStreamingRequestInternal)); + throw new ArgumentNullException(nameof(interruptRequest)); } - using var message = CreateStopMediaStreamingRequest(callConnectionId, stopMediaStreamingRequestInternal); + using var message = CreateInterruptAudioAndAnnounceRequest(callConnectionId, interruptRequest); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallRecordingRestClient.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallRecordingRestClient.cs index 63d4716393de..32dca7d0c649 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallRecordingRestClient.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallRecordingRestClient.cs @@ -29,7 +29,7 @@ internal partial class CallRecordingRestClient /// The endpoint of the Azure Communication resource. /// Api Version. /// , , or is null. - public CallRecordingRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion = "2023-10-03-preview") + public CallRecordingRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion = "2024-09-01-preview") { ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics)); _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); @@ -73,6 +73,7 @@ public async Task> StartRecordingAsync(StartCallR switch (message.Response.Status) { case 200: + case 202: { RecordingStateResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); @@ -100,6 +101,7 @@ public Response StartRecording(StartCallRecordingRequestIn switch (message.Response.Status) { case 200: + case 202: { RecordingStateResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantFailedInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantFailedInternal.Serialization.cs index 35a664dea611..9aa0aa521124 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantFailedInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantFailedInternal.Serialization.cs @@ -17,14 +17,29 @@ internal static AddParticipantFailedInternal DeserializeAddParticipantFailedInte { return null; } - string operationContext = default; - ResultInformation resultInformation = default; - CommunicationIdentifierModel participant = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; + CommunicationIdentifierModel participant = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("callConnectionId"u8)) + { + callConnectionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("serverCallId"u8)) + { + serverCallId = property.Value.GetString(); + continue; + } + if (property.NameEquals("correlationId"u8)) + { + correlationId = property.Value.GetString(); + continue; + } if (property.NameEquals("operationContext"u8)) { operationContext = property.Value.GetString(); @@ -48,29 +63,14 @@ internal static AddParticipantFailedInternal DeserializeAddParticipantFailedInte participant = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); continue; } - if (property.NameEquals("callConnectionId"u8)) - { - callConnectionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("serverCallId"u8)) - { - serverCallId = property.Value.GetString(); - continue; - } - if (property.NameEquals("correlationId"u8)) - { - correlationId = property.Value.GetString(); - continue; - } } return new AddParticipantFailedInternal( - operationContext, - resultInformation, - participant, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation, + participant); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantFailedInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantFailedInternal.cs index 91b81c265992..9c962c8f909c 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantFailedInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantFailedInternal.cs @@ -7,7 +7,7 @@ namespace Azure.Communication.CallAutomation { - /// The failed to add participant event. + /// The failed to add participants event. internal partial class AddParticipantFailedInternal { /// Initializes a new instance of . @@ -16,33 +16,33 @@ internal AddParticipantFailedInternal() } /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. - /// Participant. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal AddParticipantFailedInternal(string operationContext, ResultInformation resultInformation, CommunicationIdentifierModel participant, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + /// Participant. + internal AddParticipantFailedInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, CommunicationIdentifierModel participant) { - OperationContext = operationContext; - ResultInformation = resultInformation; - Participant = participant; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; + Participant = participant; } - /// Used by customers when calling mid-call actions to correlate the request to the response event. - public string OperationContext { get; } - /// Contains the resulting SIP code, sub-code and message. - public ResultInformation ResultInformation { get; } - /// Participant. - public CommunicationIdentifierModel Participant { get; } /// 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 mid-call actions to correlate the request to the response event. + public string OperationContext { get; } + /// Contains the resulting SIP code, sub-code and message. + public ResultInformation ResultInformation { get; } + /// Participant. + public CommunicationIdentifierModel Participant { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantRequestInternal.Serialization.cs index e5938052601f..a7fda1b5a72a 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantRequestInternal.Serialization.cs @@ -37,16 +37,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("operationContext"u8); writer.WriteStringValue(OperationContext); } - if (Optional.IsDefined(CustomCallingContext)) - { - writer.WritePropertyName("customCallingContext"u8); - writer.WriteObjectValue(CustomCallingContext); - } if (Optional.IsDefined(OperationCallbackUri)) { writer.WritePropertyName("operationCallbackUri"u8); writer.WriteStringValue(OperationCallbackUri); } + if (Optional.IsDefined(CustomCallingContext)) + { + writer.WritePropertyName("customCallingContext"u8); + writer.WriteObjectValue(CustomCallingContext); + } writer.WriteEndObject(); } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantRequestInternal.cs index 2724da9be020..5e8533df419b 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantRequestInternal.cs @@ -37,20 +37,20 @@ public AddParticipantRequestInternal(CommunicationIdentifierModel participantToA /// The maximum value of this is 180 seconds /// /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Used by customer to send custom calling context to targets. /// /// 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. /// - internal AddParticipantRequestInternal(PhoneNumberIdentifierModel sourceCallerIdNumber, string sourceDisplayName, CommunicationIdentifierModel participantToAdd, int? invitationTimeoutInSeconds, string operationContext, CustomCallingContextInternal customCallingContext, string operationCallbackUri) + /// Used by customer to send custom calling context to targets. + internal AddParticipantRequestInternal(PhoneNumberIdentifierModel sourceCallerIdNumber, string sourceDisplayName, CommunicationIdentifierModel participantToAdd, int? invitationTimeoutInSeconds, string operationContext, string operationCallbackUri, CustomCallingContextInternal customCallingContext) { SourceCallerIdNumber = sourceCallerIdNumber; SourceDisplayName = sourceDisplayName; ParticipantToAdd = participantToAdd; InvitationTimeoutInSeconds = invitationTimeoutInSeconds; OperationContext = operationContext; - CustomCallingContext = customCallingContext; OperationCallbackUri = operationCallbackUri; + CustomCallingContext = customCallingContext; } /// @@ -72,12 +72,12 @@ internal AddParticipantRequestInternal(PhoneNumberIdentifierModel sourceCallerId public int? InvitationTimeoutInSeconds { get; set; } /// Used by customers when calling mid-call actions to correlate the request to the response event. public string OperationContext { get; set; } - /// Used by customer to send custom calling context to targets. - public CustomCallingContextInternal CustomCallingContext { get; set; } /// /// 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. /// public string OperationCallbackUri { get; set; } + /// Used by customer to send custom calling context to targets. + public CustomCallingContextInternal CustomCallingContext { get; set; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantSucceededInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantSucceededInternal.Serialization.cs index 6009c35f1067..4b943ceb5e52 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantSucceededInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantSucceededInternal.Serialization.cs @@ -17,14 +17,29 @@ internal static AddParticipantSucceededInternal DeserializeAddParticipantSucceed { return null; } - string operationContext = default; - ResultInformation resultInformation = default; - CommunicationIdentifierModel participant = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; + CommunicationIdentifierModel participant = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("callConnectionId"u8)) + { + callConnectionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("serverCallId"u8)) + { + serverCallId = property.Value.GetString(); + continue; + } + if (property.NameEquals("correlationId"u8)) + { + correlationId = property.Value.GetString(); + continue; + } if (property.NameEquals("operationContext"u8)) { operationContext = property.Value.GetString(); @@ -48,29 +63,14 @@ internal static AddParticipantSucceededInternal DeserializeAddParticipantSucceed participant = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); continue; } - if (property.NameEquals("callConnectionId"u8)) - { - callConnectionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("serverCallId"u8)) - { - serverCallId = property.Value.GetString(); - continue; - } - if (property.NameEquals("correlationId"u8)) - { - correlationId = property.Value.GetString(); - continue; - } } return new AddParticipantSucceededInternal( - operationContext, - resultInformation, - participant, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation, + participant); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantSucceededInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantSucceededInternal.cs index f509b3f9afa5..c7a93c95a41c 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantSucceededInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantSucceededInternal.cs @@ -7,7 +7,7 @@ namespace Azure.Communication.CallAutomation { - /// The participant successfully added event. + /// The participants successfully added event. internal partial class AddParticipantSucceededInternal { /// Initializes a new instance of . @@ -16,33 +16,33 @@ internal AddParticipantSucceededInternal() } /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. - /// Participant. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal AddParticipantSucceededInternal(string operationContext, ResultInformation resultInformation, CommunicationIdentifierModel participant, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + /// Participant. + internal AddParticipantSucceededInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, CommunicationIdentifierModel participant) { - OperationContext = operationContext; - ResultInformation = resultInformation; - Participant = participant; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; + Participant = participant; } - /// Used by customers when calling mid-call actions to correlate the request to the response event. - public string OperationContext { get; } - /// Contains the resulting SIP code, sub-code and message. - public ResultInformation ResultInformation { get; } - /// Participant. - public CommunicationIdentifierModel Participant { get; } /// 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 mid-call actions to correlate the request to the response event. + public string OperationContext { get; } + /// Contains the resulting SIP code, sub-code and message. + public ResultInformation ResultInformation { get; } + /// Participant. + public CommunicationIdentifierModel Participant { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AnswerCallRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AnswerCallRequestInternal.Serialization.cs index b8c78cf506d5..eedd4d26e2db 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AnswerCallRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AnswerCallRequestInternal.Serialization.cs @@ -29,16 +29,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("operationContext"u8); writer.WriteStringValue(OperationContext); } - if (Optional.IsDefined(MediaStreamingConfiguration)) - { - writer.WritePropertyName("mediaStreamingConfiguration"u8); - writer.WriteObjectValue(MediaStreamingConfiguration); - } - if (Optional.IsDefined(TranscriptionConfiguration)) - { - writer.WritePropertyName("transcriptionConfiguration"u8); - writer.WriteObjectValue(TranscriptionConfiguration); - } if (Optional.IsDefined(CallIntelligenceOptions)) { writer.WritePropertyName("callIntelligenceOptions"u8); @@ -49,6 +39,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("answeredBy"u8); writer.WriteObjectValue(AnsweredBy); } + if (Optional.IsDefined(MediaStreamingOptions)) + { + writer.WritePropertyName("mediaStreamingOptions"u8); + writer.WriteObjectValue(MediaStreamingOptions); + } + if (Optional.IsDefined(TranscriptionOptions)) + { + writer.WritePropertyName("transcriptionOptions"u8); + writer.WriteObjectValue(TranscriptionOptions); + } writer.WriteEndObject(); } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AnswerCallRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AnswerCallRequestInternal.cs index a9b6afa15903..0b89298c4137 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AnswerCallRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AnswerCallRequestInternal.cs @@ -30,20 +30,20 @@ public AnswerCallRequestInternal(string incomingCallContext, string callbackUri) /// The callback uri. /// Used by customer to send custom calling context to targets when answering On-Behalf-Of call. /// A customer set value used to track the answering of a call. - /// Media Streaming Configuration. - /// Live Transcription Configuration. /// AI options for the call. /// The identifier of the call automation entity which answers the call. - internal AnswerCallRequestInternal(string incomingCallContext, string callbackUri, CustomCallingContextInternal customCallingContext, string operationContext, MediaStreamingOptionsInternal mediaStreamingConfiguration, TranscriptionOptionsInternal transcriptionConfiguration, CallIntelligenceOptionsInternal callIntelligenceOptions, CommunicationUserIdentifierModel answeredBy) + /// Media Streaming Options. + /// Transcription Options. + internal AnswerCallRequestInternal(string incomingCallContext, string callbackUri, CustomCallingContextInternal customCallingContext, string operationContext, CallIntelligenceOptionsInternal callIntelligenceOptions, CommunicationUserIdentifierModel answeredBy, MediaStreamingOptionsInternal mediaStreamingOptions, TranscriptionOptionsInternal transcriptionOptions) { IncomingCallContext = incomingCallContext; CallbackUri = callbackUri; CustomCallingContext = customCallingContext; OperationContext = operationContext; - MediaStreamingConfiguration = mediaStreamingConfiguration; - TranscriptionConfiguration = transcriptionConfiguration; CallIntelligenceOptions = callIntelligenceOptions; AnsweredBy = answeredBy; + MediaStreamingOptions = mediaStreamingOptions; + TranscriptionOptions = transcriptionOptions; } /// The context associated with the call. @@ -54,13 +54,13 @@ internal AnswerCallRequestInternal(string incomingCallContext, string callbackUr public CustomCallingContextInternal CustomCallingContext { get; set; } /// A customer set value used to track the answering of a call. public string OperationContext { get; set; } - /// Media Streaming Configuration. - public MediaStreamingOptionsInternal MediaStreamingConfiguration { get; set; } - /// Live Transcription Configuration. - public TranscriptionOptionsInternal TranscriptionConfiguration { get; set; } /// AI options for the call. public CallIntelligenceOptionsInternal CallIntelligenceOptions { get; set; } /// The identifier of the call automation entity which answers the call. public CommunicationUserIdentifierModel AnsweredBy { get; set; } + /// Media Streaming Options. + public MediaStreamingOptionsInternal MediaStreamingOptions { get; set; } + /// Transcription Options. + public TranscriptionOptionsInternal TranscriptionOptions { get; set; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AnswerFailedInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AnswerFailedInternal.Serialization.cs index ed845b420be8..4e4a10a0346b 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AnswerFailedInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AnswerFailedInternal.Serialization.cs @@ -17,27 +17,13 @@ internal static AnswerFailedInternal DeserializeAnswerFailedInternal(JsonElement { return null; } - string operationContext = default; - ResultInformation resultInformation = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("operationContext"u8)) - { - operationContext = property.Value.GetString(); - continue; - } - if (property.NameEquals("resultInformation"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resultInformation = ResultInformation.DeserializeResultInformation(property.Value); - continue; - } if (property.NameEquals("callConnectionId"u8)) { callConnectionId = property.Value.GetString(); @@ -53,8 +39,22 @@ internal static AnswerFailedInternal DeserializeAnswerFailedInternal(JsonElement correlationId = property.Value.GetString(); continue; } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } } - return new AnswerFailedInternal(operationContext, resultInformation, callConnectionId, serverCallId, correlationId); + return new AnswerFailedInternal(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AnswerFailedInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AnswerFailedInternal.cs index 3798b8058546..fb3dd15fa6e0 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AnswerFailedInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AnswerFailedInternal.cs @@ -7,7 +7,7 @@ namespace Azure.Communication.CallAutomation { - /// AnswerFailed event. + /// The failed to answer call event. internal partial class AnswerFailedInternal { /// Initializes a new instance of . @@ -16,29 +16,29 @@ internal AnswerFailedInternal() } /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal AnswerFailedInternal(string operationContext, ResultInformation resultInformation, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal AnswerFailedInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) { - OperationContext = operationContext; - ResultInformation = resultInformation; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; } - /// Used by customers when calling mid-call actions to correlate the request to the response event. - public string OperationContext { get; } - /// Contains the resulting SIP code, sub-code and message. - public ResultInformation ResultInformation { get; } /// 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 mid-call actions to correlate the request to the response event. + public string OperationContext { get; } + /// Contains the resulting SIP code, sub-code and message. + public ResultInformation ResultInformation { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AudioFormat.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AudioFormat.cs new file mode 100644 index 000000000000..024ee2d792cb --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AudioFormat.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Communication.CallAutomation +{ + /// Specifies the audio format used for encoding, including sample rate and channel type. + public readonly partial struct AudioFormat : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AudioFormat(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string Pcm16KMonoValue = "Pcm16KMono"; + private const string Pcm24KMonoValue = "Pcm24KMono"; + + /// Pcm16KMono. + public static AudioFormat Pcm16KMono { get; } = new AudioFormat(Pcm16KMonoValue); + /// Pcm24KMono. + public static AudioFormat Pcm24KMono { get; } = new AudioFormat(Pcm24KMonoValue); + /// Determines if two values are the same. + public static bool operator ==(AudioFormat left, AudioFormat right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AudioFormat left, AudioFormat right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AudioFormat(string value) => new AudioFormat(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AudioFormat other && Equals(other); + /// + public bool Equals(AudioFormat other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnected.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnected.Serialization.cs index 468f7580818d..6b7a1a67ac26 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnected.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnected.Serialization.cs @@ -17,17 +17,13 @@ internal static CallConnected DeserializeCallConnected(JsonElement element) { return null; } - string operationContext = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("operationContext"u8)) - { - operationContext = property.Value.GetString(); - continue; - } if (property.NameEquals("callConnectionId"u8)) { callConnectionId = property.Value.GetString(); @@ -43,8 +39,22 @@ internal static CallConnected DeserializeCallConnected(JsonElement element) correlationId = property.Value.GetString(); continue; } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } } - return new CallConnected(operationContext, callConnectionId, serverCallId, correlationId); + return new CallConnected(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnected.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnected.cs index 0228c7ab8887..d85f3121dbc0 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnected.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnected.cs @@ -16,16 +16,18 @@ internal CallConnected() } /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal CallConnected(string operationContext, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal CallConnected(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) { - OperationContext = operationContext; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; } } } 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 7b08a181f575..4846581e7d56 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 @@ -23,13 +23,15 @@ internal static CallConnectionPropertiesInternal DeserializeCallConnectionProper IReadOnlyList targets = default; CallConnectionState? callConnectionState = default; string callbackUri = default; - string mediaSubscriptionId = default; - string dataSubscriptionId = default; PhoneNumberIdentifierModel sourceCallerIdNumber = default; string sourceDisplayName = default; CommunicationIdentifierModel source = default; string correlationId = default; CommunicationUserIdentifierModel answeredBy = default; + string mediaSubscriptionId = default; + string dataSubscriptionId = default; + MediaStreamingSubscriptionInternal mediaStreamingSubscription = default; + TranscriptionSubscriptionInternal transcriptionSubscription = default; PhoneNumberIdentifierModel answeredFor = default; foreach (var property in element.EnumerateObject()) { @@ -71,16 +73,6 @@ internal static CallConnectionPropertiesInternal DeserializeCallConnectionProper callbackUri = property.Value.GetString(); continue; } - if (property.NameEquals("mediaSubscriptionId"u8)) - { - 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) @@ -118,6 +110,34 @@ internal static CallConnectionPropertiesInternal DeserializeCallConnectionProper answeredBy = CommunicationUserIdentifierModel.DeserializeCommunicationUserIdentifierModel(property.Value); continue; } + if (property.NameEquals("mediaSubscriptionId"u8)) + { + mediaSubscriptionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("dataSubscriptionId"u8)) + { + dataSubscriptionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("mediaStreamingSubscription"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mediaStreamingSubscription = MediaStreamingSubscriptionInternal.DeserializeMediaStreamingSubscriptionInternal(property.Value); + continue; + } + if (property.NameEquals("transcriptionSubscription"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + transcriptionSubscription = TranscriptionSubscriptionInternal.DeserializeTranscriptionSubscriptionInternal(property.Value); + continue; + } if (property.NameEquals("answeredFor"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -134,13 +154,15 @@ internal static CallConnectionPropertiesInternal DeserializeCallConnectionProper targets ?? new ChangeTrackingList(), callConnectionState, callbackUri, - mediaSubscriptionId, - dataSubscriptionId, sourceCallerIdNumber, sourceDisplayName, source, correlationId, answeredBy, + mediaSubscriptionId, + dataSubscriptionId, + mediaStreamingSubscription, + transcriptionSubscription, answeredFor); } 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 ae2711f1f500..4244c2849309 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnectionPropertiesInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnectionPropertiesInternal.cs @@ -24,8 +24,6 @@ internal CallConnectionPropertiesInternal() /// The targets of the call. /// 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. @@ -34,21 +32,27 @@ internal CallConnectionPropertiesInternal() /// Source identity. /// The correlation ID. /// Identity of the answering entity. Only populated when identity is provided in the request. + /// SubscriptionId for media streaming. + /// SubscriptionId for transcription. + /// The state of media streaming subscription for the call. + /// Transcription Subscription. /// Identity of the original Pstn target of an incoming Call. Only populated when the original target is a Pstn number. - internal CallConnectionPropertiesInternal(string callConnectionId, string serverCallId, IReadOnlyList targets, CallConnectionState? callConnectionState, string callbackUri, string mediaSubscriptionId, string dataSubscriptionId, PhoneNumberIdentifierModel sourceCallerIdNumber, string sourceDisplayName, CommunicationIdentifierModel source, string correlationId, CommunicationUserIdentifierModel answeredBy, PhoneNumberIdentifierModel answeredFor) + internal CallConnectionPropertiesInternal(string callConnectionId, string serverCallId, IReadOnlyList targets, CallConnectionState? callConnectionState, string callbackUri, PhoneNumberIdentifierModel sourceCallerIdNumber, string sourceDisplayName, CommunicationIdentifierModel source, string correlationId, CommunicationUserIdentifierModel answeredBy, string mediaSubscriptionId, string dataSubscriptionId, MediaStreamingSubscriptionInternal mediaStreamingSubscription, TranscriptionSubscriptionInternal transcriptionSubscription, PhoneNumberIdentifierModel answeredFor) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; Targets = targets; CallConnectionState = callConnectionState; CallbackUri = callbackUri; - MediaSubscriptionId = mediaSubscriptionId; - DataSubscriptionId = dataSubscriptionId; SourceCallerIdNumber = sourceCallerIdNumber; SourceDisplayName = sourceDisplayName; Source = source; CorrelationId = correlationId; AnsweredBy = answeredBy; + MediaSubscriptionId = mediaSubscriptionId; + DataSubscriptionId = dataSubscriptionId; + MediaStreamingSubscription = mediaStreamingSubscription; + TranscriptionSubscription = transcriptionSubscription; AnsweredFor = answeredFor; } @@ -62,10 +66,6 @@ internal CallConnectionPropertiesInternal(string callConnectionId, string server public CallConnectionState? CallConnectionState { get; } /// The callback URI. 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. @@ -79,6 +79,14 @@ internal CallConnectionPropertiesInternal(string callConnectionId, string server public string CorrelationId { get; } /// Identity of the answering entity. Only populated when identity is provided in the request. public CommunicationUserIdentifierModel AnsweredBy { get; } + /// SubscriptionId for media streaming. + public string MediaSubscriptionId { get; } + /// SubscriptionId for transcription. + public string DataSubscriptionId { get; } + /// The state of media streaming subscription for the call. + public MediaStreamingSubscriptionInternal MediaStreamingSubscription { get; } + /// Transcription Subscription. + public TranscriptionSubscriptionInternal TranscriptionSubscription { get; } /// Identity of the original Pstn target of an incoming Call. Only populated when the original target is a Pstn number. public PhoneNumberIdentifierModel AnsweredFor { get; } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallDisconnected.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallDisconnected.Serialization.cs index f79b61d8a974..ae5e75f98eeb 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallDisconnected.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallDisconnected.Serialization.cs @@ -17,17 +17,13 @@ internal static CallDisconnected DeserializeCallDisconnected(JsonElement element { return null; } - string operationContext = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("operationContext"u8)) - { - operationContext = property.Value.GetString(); - continue; - } if (property.NameEquals("callConnectionId"u8)) { callConnectionId = property.Value.GetString(); @@ -43,8 +39,22 @@ internal static CallDisconnected DeserializeCallDisconnected(JsonElement element correlationId = property.Value.GetString(); continue; } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } } - return new CallDisconnected(operationContext, callConnectionId, serverCallId, correlationId); + return new CallDisconnected(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallDisconnected.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallDisconnected.cs index 9caf9c928e95..3b655b623a25 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallDisconnected.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallDisconnected.cs @@ -16,16 +16,18 @@ internal CallDisconnected() } /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal CallDisconnected(string operationContext, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal CallDisconnected(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) { - OperationContext = operationContext; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallLocatorInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallLocatorInternal.Serialization.cs index bacfdd77a7fb..ecf883327bd1 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallLocatorInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallLocatorInternal.Serialization.cs @@ -25,6 +25,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("serverCallId"u8); writer.WriteStringValue(ServerCallId); } + if (Optional.IsDefined(RoomId)) + { + writer.WritePropertyName("roomId"u8); + writer.WriteStringValue(RoomId); + } if (Optional.IsDefined(Kind)) { writer.WritePropertyName("kind"u8); diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallLocatorInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallLocatorInternal.cs index e9d748add63d..652c7e5263a7 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallLocatorInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallLocatorInternal.cs @@ -18,11 +18,13 @@ public CallLocatorInternal() /// Initializes a new instance of . /// The group call id. /// The server call id. + /// The Acs room id. /// The call locator kind. - internal CallLocatorInternal(string groupCallId, string serverCallId, CallLocatorKindInternal? kind) + internal CallLocatorInternal(string groupCallId, string serverCallId, string roomId, CallLocatorKindInternal? kind) { GroupCallId = groupCallId; ServerCallId = serverCallId; + RoomId = roomId; Kind = kind; } @@ -30,6 +32,8 @@ internal CallLocatorInternal(string groupCallId, string serverCallId, CallLocato public string GroupCallId { get; set; } /// The server call id. public string ServerCallId { get; set; } + /// The Acs room id. + public string RoomId { get; set; } /// The call locator kind. public CallLocatorKindInternal? Kind { get; set; } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallLocatorKindInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallLocatorKindInternal.cs index aa3aa0a2d26b..7edbdb32cd29 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallLocatorKindInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallLocatorKindInternal.cs @@ -22,13 +22,19 @@ public CallLocatorKindInternal(string value) _value = value ?? throw new ArgumentNullException(nameof(value)); } + private const string UnknownValue = "unknown"; private const string GroupCallLocatorValue = "groupCallLocator"; private const string ServerCallLocatorValue = "serverCallLocator"; + private const string RoomCallLocatorValue = "roomCallLocator"; + /// unknown. + public static CallLocatorKindInternal Unknown { get; } = new CallLocatorKindInternal(UnknownValue); /// groupCallLocator. public static CallLocatorKindInternal GroupCallLocator { get; } = new CallLocatorKindInternal(GroupCallLocatorValue); /// serverCallLocator. public static CallLocatorKindInternal ServerCallLocator { get; } = new CallLocatorKindInternal(ServerCallLocatorValue); + /// roomCallLocator. + public static CallLocatorKindInternal RoomCallLocator { get; } = new CallLocatorKindInternal(RoomCallLocatorValue); /// Determines if two values are the same. public static bool operator ==(CallLocatorKindInternal left, CallLocatorKindInternal right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferAcceptedInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferAcceptedInternal.Serialization.cs index f1c56fab4859..d540b6034561 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferAcceptedInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferAcceptedInternal.Serialization.cs @@ -17,15 +17,30 @@ internal static CallTransferAcceptedInternal DeserializeCallTransferAcceptedInte { return null; } + string callConnectionId = default; + string serverCallId = default; + string correlationId = default; string operationContext = default; ResultInformation resultInformation = default; CommunicationIdentifierModel transferTarget = default; CommunicationIdentifierModel transferee = default; - string callConnectionId = default; - string serverCallId = default; - string correlationId = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("callConnectionId"u8)) + { + callConnectionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("serverCallId"u8)) + { + serverCallId = property.Value.GetString(); + continue; + } + if (property.NameEquals("correlationId"u8)) + { + correlationId = property.Value.GetString(); + continue; + } if (property.NameEquals("operationContext"u8)) { operationContext = property.Value.GetString(); @@ -58,30 +73,15 @@ internal static CallTransferAcceptedInternal DeserializeCallTransferAcceptedInte transferee = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); continue; } - if (property.NameEquals("callConnectionId"u8)) - { - callConnectionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("serverCallId"u8)) - { - serverCallId = property.Value.GetString(); - continue; - } - if (property.NameEquals("correlationId"u8)) - { - correlationId = property.Value.GetString(); - continue; - } } return new CallTransferAcceptedInternal( + callConnectionId, + serverCallId, + correlationId, operationContext, resultInformation, transferTarget, - transferee, - callConnectionId, - serverCallId, - correlationId); + transferee); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferAcceptedInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferAcceptedInternal.cs index c416861e7fee..c4b01a539f58 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferAcceptedInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferAcceptedInternal.cs @@ -16,24 +16,30 @@ internal CallTransferAcceptedInternal() } /// Initializes a new instance of . + /// Call connection ID. + /// Server call ID. + /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. /// Used by customers when calling mid-call actions to correlate the request to the response event. /// Contains the resulting SIP code, sub-code and message. /// Target who the call is transferred to. /// the participant who is being transferred away. - /// Call connection ID. - /// Server call ID. - /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal CallTransferAcceptedInternal(string operationContext, ResultInformation resultInformation, CommunicationIdentifierModel transferTarget, CommunicationIdentifierModel transferee, string callConnectionId, string serverCallId, string correlationId) + internal CallTransferAcceptedInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, CommunicationIdentifierModel transferTarget, CommunicationIdentifierModel transferee) { + CallConnectionId = callConnectionId; + ServerCallId = serverCallId; + CorrelationId = correlationId; OperationContext = operationContext; ResultInformation = resultInformation; TransferTarget = transferTarget; Transferee = transferee; - CallConnectionId = callConnectionId; - ServerCallId = serverCallId; - CorrelationId = correlationId; } + /// 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 mid-call actions to correlate the request to the response event. public string OperationContext { get; } /// Contains the resulting SIP code, sub-code and message. @@ -42,11 +48,5 @@ internal CallTransferAcceptedInternal(string operationContext, ResultInformation public CommunicationIdentifierModel TransferTarget { get; } /// the participant who is being transferred away. public CommunicationIdentifierModel Transferee { get; } - /// 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; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferFailed.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferFailed.Serialization.cs index fc5b28081751..c9ea46a9502b 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferFailed.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferFailed.Serialization.cs @@ -17,27 +17,13 @@ internal static CallTransferFailed DeserializeCallTransferFailed(JsonElement ele { return null; } - string operationContext = default; - ResultInformation resultInformation = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("operationContext"u8)) - { - operationContext = property.Value.GetString(); - continue; - } - if (property.NameEquals("resultInformation"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resultInformation = ResultInformation.DeserializeResultInformation(property.Value); - continue; - } if (property.NameEquals("callConnectionId"u8)) { callConnectionId = property.Value.GetString(); @@ -53,8 +39,22 @@ internal static CallTransferFailed DeserializeCallTransferFailed(JsonElement ele correlationId = property.Value.GetString(); continue; } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } } - return new CallTransferFailed(operationContext, resultInformation, callConnectionId, serverCallId, correlationId); + return new CallTransferFailed(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferFailed.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferFailed.cs index b1e9cd0e6925..9be70147b26f 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferFailed.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallTransferFailed.cs @@ -16,18 +16,18 @@ internal CallTransferFailed() } /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal CallTransferFailed(string operationContext, ResultInformation resultInformation, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal CallTransferFailed(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) { - OperationContext = operationContext; - ResultInformation = resultInformation; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CancelAddParticipantFailedInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CancelAddParticipantFailedInternal.Serialization.cs index c2118ff8c0a4..d17f70f6a067 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CancelAddParticipantFailedInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CancelAddParticipantFailedInternal.Serialization.cs @@ -17,14 +17,29 @@ internal static CancelAddParticipantFailedInternal DeserializeCancelAddParticipa { return null; } - string operationContext = default; - ResultInformation resultInformation = default; - string invitationId = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; + string invitationId = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("callConnectionId"u8)) + { + callConnectionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("serverCallId"u8)) + { + serverCallId = property.Value.GetString(); + continue; + } + if (property.NameEquals("correlationId"u8)) + { + correlationId = property.Value.GetString(); + continue; + } if (property.NameEquals("operationContext"u8)) { operationContext = property.Value.GetString(); @@ -44,29 +59,14 @@ internal static CancelAddParticipantFailedInternal DeserializeCancelAddParticipa invitationId = property.Value.GetString(); continue; } - if (property.NameEquals("callConnectionId"u8)) - { - callConnectionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("serverCallId"u8)) - { - serverCallId = property.Value.GetString(); - continue; - } - if (property.NameEquals("correlationId"u8)) - { - correlationId = property.Value.GetString(); - continue; - } } return new CancelAddParticipantFailedInternal( - operationContext, - resultInformation, - invitationId, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation, + invitationId); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CancelAddParticipantFailedInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CancelAddParticipantFailedInternal.cs index 439c9cd43923..f56046f0c63d 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CancelAddParticipantFailedInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CancelAddParticipantFailedInternal.cs @@ -16,33 +16,33 @@ internal CancelAddParticipantFailedInternal() } /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. - /// Invitation ID used to cancel the request. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal CancelAddParticipantFailedInternal(string operationContext, ResultInformation resultInformation, string invitationId, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + /// Invitation ID used to cancel the request. + internal CancelAddParticipantFailedInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, string invitationId) { - OperationContext = operationContext; - ResultInformation = resultInformation; - InvitationId = invitationId; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; + InvitationId = invitationId; } - /// Used by customers when calling mid-call actions to correlate the request to the response event. - public string OperationContext { get; } - /// Contains the resulting SIP code, sub-code and message. - public ResultInformation ResultInformation { get; } - /// Invitation ID used to cancel the request. - public string InvitationId { get; } /// 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 mid-call actions to correlate the request to the response event. + public string OperationContext { get; } + /// Contains the resulting SIP code, sub-code and message. + public ResultInformation ResultInformation { get; } + /// Invitation ID used to cancel the request. + public string InvitationId { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CancelAddParticipantSucceededInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CancelAddParticipantSucceededInternal.Serialization.cs index e2aeffccc363..9e234c3bc0a4 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CancelAddParticipantSucceededInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CancelAddParticipantSucceededInternal.Serialization.cs @@ -17,56 +17,56 @@ internal static CancelAddParticipantSucceededInternal DeserializeCancelAddPartic { return null; } - string invitationId = default; - string operationContext = default; - ResultInformation resultInformation = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + string invitationId = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("invitationId"u8)) + if (property.NameEquals("callConnectionId"u8)) { - invitationId = property.Value.GetString(); + callConnectionId = property.Value.GetString(); continue; } - if (property.NameEquals("operationContext"u8)) + if (property.NameEquals("serverCallId"u8)) { - operationContext = property.Value.GetString(); + serverCallId = property.Value.GetString(); continue; } - if (property.NameEquals("resultInformation"u8)) + if (property.NameEquals("correlationId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + correlationId = property.Value.GetString(); continue; } - if (property.NameEquals("callConnectionId"u8)) + if (property.NameEquals("operationContext"u8)) { - callConnectionId = property.Value.GetString(); + operationContext = property.Value.GetString(); continue; } - if (property.NameEquals("serverCallId"u8)) + if (property.NameEquals("invitationId"u8)) { - serverCallId = property.Value.GetString(); + invitationId = property.Value.GetString(); continue; } - if (property.NameEquals("correlationId"u8)) + if (property.NameEquals("resultInformation"u8)) { - correlationId = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); continue; } } return new CancelAddParticipantSucceededInternal( - invitationId, - operationContext, - resultInformation, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + invitationId, + resultInformation); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CancelAddParticipantSucceededInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CancelAddParticipantSucceededInternal.cs index 0842de354662..cb033f6ae3cc 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CancelAddParticipantSucceededInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CancelAddParticipantSucceededInternal.cs @@ -16,33 +16,33 @@ internal CancelAddParticipantSucceededInternal() } /// Initializes a new instance of . - /// Invitation ID used to cancel the request. - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal CancelAddParticipantSucceededInternal(string invitationId, string operationContext, ResultInformation resultInformation, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Invitation ID used to cancel the request. + /// Contains the resulting SIP code, sub-code and message. + internal CancelAddParticipantSucceededInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, string invitationId, ResultInformation resultInformation) { - InvitationId = invitationId; - OperationContext = operationContext; - ResultInformation = resultInformation; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + InvitationId = invitationId; + ResultInformation = resultInformation; } - /// Invitation ID used to cancel the request. - public string InvitationId { get; } - /// Used by customers when calling mid-call actions to correlate the request to the response event. - public string OperationContext { get; } - /// Gets the result information. - public ResultInformation ResultInformation { get; } /// 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 mid-call actions to correlate the request to the response event. + public string OperationContext { get; } + /// Invitation ID used to cancel the request. + public string InvitationId { get; } + /// Contains the resulting SIP code, sub-code and message. + public ResultInformation ResultInformation { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CollectTonesResult.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CollectTonesResult.Serialization.cs deleted file mode 100644 index cd923ce53c1b..000000000000 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CollectTonesResult.Serialization.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; - -namespace Azure.Communication.CallAutomation -{ - public partial class CollectTonesResult - { - internal static CollectTonesResult DeserializeCollectTonesResult(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList tones = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("tones"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(new DtmfTone(item.GetString())); - } - tones = array; - continue; - } - } - return new CollectTonesResult(tones ?? new ChangeTrackingList()); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static CollectTonesResult FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeCollectTonesResult(document.RootElement); - } - } -} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CollectTonesResult.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CollectTonesResult.cs deleted file mode 100644 index a8a30d875376..000000000000 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CollectTonesResult.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; - -namespace Azure.Communication.CallAutomation -{ - /// The CollectTonesResult. - public partial class CollectTonesResult - { - /// Initializes a new instance of . - internal CollectTonesResult() - { - Tones = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// - internal CollectTonesResult(IReadOnlyList tones) - { - Tones = tones; - } - } -} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCompleted.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ConnectFailed.Serialization.cs similarity index 85% rename from sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCompleted.Serialization.cs rename to sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ConnectFailed.Serialization.cs index ac17c8928d48..71b998354e62 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCompleted.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ConnectFailed.Serialization.cs @@ -9,35 +9,21 @@ namespace Azure.Communication.CallAutomation { - public partial class PlayCompleted + public partial class ConnectFailed { - internal static PlayCompleted DeserializePlayCompleted(JsonElement element) + internal static ConnectFailed DeserializeConnectFailed(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - ResultInformation resultInformation = default; - string operationContext = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("resultInformation"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resultInformation = ResultInformation.DeserializeResultInformation(property.Value); - continue; - } - if (property.NameEquals("operationContext"u8)) - { - operationContext = property.Value.GetString(); - continue; - } if (property.NameEquals("callConnectionId"u8)) { callConnectionId = property.Value.GetString(); @@ -53,16 +39,30 @@ internal static PlayCompleted DeserializePlayCompleted(JsonElement element) correlationId = property.Value.GetString(); continue; } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } } - return new PlayCompleted(resultInformation, operationContext, callConnectionId, serverCallId, correlationId); + return new ConnectFailed(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); } /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static PlayCompleted FromResponse(Response response) + internal static ConnectFailed FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); - return DeserializePlayCompleted(document.RootElement); + return DeserializeConnectFailed(document.RootElement); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ConnectFailed.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ConnectFailed.cs new file mode 100644 index 000000000000..82dc1462fe5f --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ConnectFailed.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.CallAutomation +{ + /// The ConnectFailed event. + public partial class ConnectFailed + { + /// Initializes a new instance of . + internal ConnectFailed() + { + } + + /// Initializes a new instance of . + /// Call connection ID. + /// Server call ID. + /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal ConnectFailed(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) + { + CallConnectionId = callConnectionId; + ServerCallId = serverCallId; + CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; + } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartHoldMusicRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ConnectRequestInternal.Serialization.cs similarity index 52% rename from sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartHoldMusicRequestInternal.Serialization.cs rename to sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ConnectRequestInternal.Serialization.cs index abfced792412..7cb650920ebf 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartHoldMusicRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ConnectRequestInternal.Serialization.cs @@ -10,27 +10,34 @@ namespace Azure.Communication.CallAutomation { - internal partial class StartHoldMusicRequestInternal : IUtf8JsonSerializable + internal partial class ConnectRequestInternal : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - writer.WritePropertyName("targetParticipant"u8); - writer.WriteObjectValue(TargetParticipant); - if (Optional.IsDefined(PlaySourceInfo)) - { - writer.WritePropertyName("playSourceInfo"u8); - writer.WriteObjectValue(PlaySourceInfo); - } + writer.WritePropertyName("callLocator"u8); + writer.WriteObjectValue(CallLocator); + writer.WritePropertyName("callbackUri"u8); + writer.WriteStringValue(CallbackUri); if (Optional.IsDefined(OperationContext)) { writer.WritePropertyName("operationContext"u8); writer.WriteStringValue(OperationContext); } - if (Optional.IsDefined(OperationCallbackUri)) + if (Optional.IsDefined(CallIntelligenceOptions)) + { + writer.WritePropertyName("callIntelligenceOptions"u8); + writer.WriteObjectValue(CallIntelligenceOptions); + } + if (Optional.IsDefined(MediaStreamingOptions)) + { + writer.WritePropertyName("mediaStreamingOptions"u8); + writer.WriteObjectValue(MediaStreamingOptions); + } + if (Optional.IsDefined(TranscriptionOptions)) { - writer.WritePropertyName("operationCallbackUri"u8); - writer.WriteStringValue(OperationCallbackUri); + writer.WritePropertyName("transcriptionOptions"u8); + writer.WriteObjectValue(TranscriptionOptions); } writer.WriteEndObject(); } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ConnectRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ConnectRequestInternal.cs new file mode 100644 index 000000000000..3692047ce8d5 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ConnectRequestInternal.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Communication.CallAutomation +{ + /// The request payload for creating a connection to a CallLocator. + internal partial class ConnectRequestInternal + { + /// Initializes a new instance of . + /// The call locator. + /// The callback URI. + /// or is null. + public ConnectRequestInternal(CallLocatorInternal callLocator, string callbackUri) + { + Argument.AssertNotNull(callLocator, nameof(callLocator)); + Argument.AssertNotNull(callbackUri, nameof(callbackUri)); + + CallLocator = callLocator; + CallbackUri = callbackUri; + } + + /// Initializes a new instance of . + /// The call locator. + /// The callback URI. + /// Used by customers to correlate the request to the response event. + /// AI options for the call. + /// Media Streaming Options. + /// Transcription Options. + internal ConnectRequestInternal(CallLocatorInternal callLocator, string callbackUri, string operationContext, CallIntelligenceOptionsInternal callIntelligenceOptions, MediaStreamingOptionsInternal mediaStreamingOptions, TranscriptionOptionsInternal transcriptionOptions) + { + CallLocator = callLocator; + CallbackUri = callbackUri; + OperationContext = operationContext; + CallIntelligenceOptions = callIntelligenceOptions; + MediaStreamingOptions = mediaStreamingOptions; + TranscriptionOptions = transcriptionOptions; + } + + /// The call locator. + public CallLocatorInternal CallLocator { get; } + /// The callback URI. + public string CallbackUri { get; } + /// Used by customers to correlate the request to the response event. + public string OperationContext { get; set; } + /// AI options for the call. + public CallIntelligenceOptionsInternal CallIntelligenceOptions { get; set; } + /// Media Streaming Options. + public MediaStreamingOptionsInternal MediaStreamingOptions { get; set; } + /// Transcription Options. + public TranscriptionOptionsInternal TranscriptionOptions { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionStopped.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionStopped.Serialization.cs index 10a0595e9d7b..7730cd689d27 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionStopped.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionStopped.Serialization.cs @@ -17,27 +17,13 @@ internal static ContinuousDtmfRecognitionStopped DeserializeContinuousDtmfRecogn { return null; } - string operationContext = default; - ResultInformation resultInformation = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("operationContext"u8)) - { - operationContext = property.Value.GetString(); - continue; - } - if (property.NameEquals("resultInformation"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resultInformation = ResultInformation.DeserializeResultInformation(property.Value); - continue; - } if (property.NameEquals("callConnectionId"u8)) { callConnectionId = property.Value.GetString(); @@ -53,8 +39,22 @@ internal static ContinuousDtmfRecognitionStopped DeserializeContinuousDtmfRecogn correlationId = property.Value.GetString(); continue; } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } } - return new ContinuousDtmfRecognitionStopped(operationContext, resultInformation, callConnectionId, serverCallId, correlationId); + return new ContinuousDtmfRecognitionStopped(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionStopped.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionStopped.cs index 7fffac46ddc8..41c76f74a944 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionStopped.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionStopped.cs @@ -7,7 +7,7 @@ namespace Azure.Communication.CallAutomation { - /// Call connection ID. + /// The ContinuousDtmfRecognitionStopped. public partial class ContinuousDtmfRecognitionStopped { /// Initializes a new instance of . @@ -16,18 +16,18 @@ internal ContinuousDtmfRecognitionStopped() } /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code/sub-code and message from NGC services. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal ContinuousDtmfRecognitionStopped(string operationContext, ResultInformation resultInformation, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal ContinuousDtmfRecognitionStopped(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) { - OperationContext = operationContext; - ResultInformation = resultInformation; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneFailed.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneFailed.Serialization.cs index edec4a4a7f6c..b301ece871f0 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneFailed.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneFailed.Serialization.cs @@ -17,27 +17,13 @@ internal static ContinuousDtmfRecognitionToneFailed DeserializeContinuousDtmfRec { return null; } - ResultInformation resultInformation = default; - string operationContext = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + ResultInformation resultInformation = default; + string operationContext = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("resultInformation"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resultInformation = ResultInformation.DeserializeResultInformation(property.Value); - continue; - } - if (property.NameEquals("operationContext"u8)) - { - operationContext = property.Value.GetString(); - continue; - } if (property.NameEquals("callConnectionId"u8)) { callConnectionId = property.Value.GetString(); @@ -53,8 +39,22 @@ internal static ContinuousDtmfRecognitionToneFailed DeserializeContinuousDtmfRec correlationId = property.Value.GetString(); continue; } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } } - return new ContinuousDtmfRecognitionToneFailed(resultInformation, operationContext, callConnectionId, serverCallId, correlationId); + return new ContinuousDtmfRecognitionToneFailed(callConnectionId, serverCallId, correlationId, resultInformation, operationContext); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneFailed.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneFailed.cs index 373e57e5eb8a..7df347401b88 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneFailed.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneFailed.cs @@ -16,18 +16,18 @@ internal ContinuousDtmfRecognitionToneFailed() } /// Initializes a new instance of . - /// Result information defines the code, subcode and message. - /// Used by customers when calling mid-call actions to correlate the request to the response event. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal ContinuousDtmfRecognitionToneFailed(ResultInformation resultInformation, string operationContext, string callConnectionId, string serverCallId, string correlationId) + /// Contains the resulting SIP code, sub-code and message. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + internal ContinuousDtmfRecognitionToneFailed(string callConnectionId, string serverCallId, string correlationId, ResultInformation resultInformation, string operationContext) { - ResultInformation = resultInformation; - OperationContext = operationContext; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + ResultInformation = resultInformation; + OperationContext = operationContext; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneReceived.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneReceived.Serialization.cs index 80a8c099081e..64ffcf4b1e03 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneReceived.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneReceived.Serialization.cs @@ -17,24 +17,15 @@ internal static ContinuousDtmfRecognitionToneReceived DeserializeContinuousDtmfR { return null; } - ResultInformation resultInformation = default; int? sequenceId = default; DtmfTone? tone = default; - string operationContext = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("resultInformation"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resultInformation = ResultInformation.DeserializeResultInformation(property.Value); - continue; - } if (property.NameEquals("sequenceId"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -53,11 +44,6 @@ internal static ContinuousDtmfRecognitionToneReceived DeserializeContinuousDtmfR tone = new DtmfTone(property.Value.GetString()); continue; } - if (property.NameEquals("operationContext"u8)) - { - operationContext = property.Value.GetString(); - continue; - } if (property.NameEquals("callConnectionId"u8)) { callConnectionId = property.Value.GetString(); @@ -73,15 +59,29 @@ internal static ContinuousDtmfRecognitionToneReceived DeserializeContinuousDtmfR correlationId = property.Value.GetString(); continue; } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } } return new ContinuousDtmfRecognitionToneReceived( - resultInformation, sequenceId, tone, - operationContext, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneReceived.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneReceived.cs index 235162b194b1..37337deb1ecf 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneReceived.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ContinuousDtmfRecognitionToneReceived.cs @@ -16,23 +16,24 @@ internal ContinuousDtmfRecognitionToneReceived() } /// Initializes a new instance of . - /// Result information defines the code, subcode and message. /// The sequence id which can be used to determine if the same tone was played multiple times or if any tones were missed. /// - /// /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal ContinuousDtmfRecognitionToneReceived(ResultInformation resultInformation, int? sequenceId, DtmfTone? tone, string operationContext, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal ContinuousDtmfRecognitionToneReceived(int? sequenceId, DtmfTone? tone, string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) { - ResultInformation = resultInformation; SequenceId = sequenceId; Tone = tone; - OperationContext = operationContext; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; } + /// The sequence id which can be used to determine if the same tone was played multiple times or if any tones were missed. public int? SequenceId { get; } /// Gets the tone. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CreateCallFailedInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CreateCallFailedInternal.Serialization.cs index 5296def00ba3..e626cbd91283 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CreateCallFailedInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CreateCallFailedInternal.Serialization.cs @@ -17,27 +17,13 @@ internal static CreateCallFailedInternal DeserializeCreateCallFailedInternal(Jso { return null; } - string operationContext = default; - ResultInformation resultInformation = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("operationContext"u8)) - { - operationContext = property.Value.GetString(); - continue; - } - if (property.NameEquals("resultInformation"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resultInformation = ResultInformation.DeserializeResultInformation(property.Value); - continue; - } if (property.NameEquals("callConnectionId"u8)) { callConnectionId = property.Value.GetString(); @@ -53,8 +39,22 @@ internal static CreateCallFailedInternal DeserializeCreateCallFailedInternal(Jso correlationId = property.Value.GetString(); continue; } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } } - return new CreateCallFailedInternal(operationContext, resultInformation, callConnectionId, serverCallId, correlationId); + return new CreateCallFailedInternal(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CreateCallFailedInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CreateCallFailedInternal.cs index 506c8ca5891e..00ea356ff7ed 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CreateCallFailedInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CreateCallFailedInternal.cs @@ -7,7 +7,7 @@ namespace Azure.Communication.CallAutomation { - /// The CreateCallFailed event. + /// The create call failed event. internal partial class CreateCallFailedInternal { /// Initializes a new instance of . @@ -16,29 +16,29 @@ internal CreateCallFailedInternal() } /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal CreateCallFailedInternal(string operationContext, ResultInformation resultInformation, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal CreateCallFailedInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) { - OperationContext = operationContext; - ResultInformation = resultInformation; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; } - /// Used by customers when calling mid-call actions to correlate the request to the response event. - public string OperationContext { get; } - /// Contains the resulting SIP code, sub-code and message. - public ResultInformation ResultInformation { get; } /// 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 mid-call actions to correlate the request to the response event. + public string OperationContext { get; } + /// Contains the resulting SIP code, sub-code and message. + public ResultInformation ResultInformation { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CreateCallRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CreateCallRequestInternal.Serialization.cs index 797fb28b64d4..a2234ac6aa3b 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CreateCallRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CreateCallRequestInternal.Serialization.cs @@ -37,11 +37,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("source"u8); writer.WriteObjectValue(Source); } - if (Optional.IsDefined(OpsSource)) - { - writer.WritePropertyName("opsSource"u8); - writer.WriteObjectValue(OpsSource); - } if (Optional.IsDefined(OperationContext)) { writer.WritePropertyName("operationContext"u8); @@ -49,26 +44,31 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("callbackUri"u8); writer.WriteStringValue(CallbackUri); - if (Optional.IsDefined(MediaStreamingConfiguration)) - { - writer.WritePropertyName("mediaStreamingConfiguration"u8); - writer.WriteObjectValue(MediaStreamingConfiguration); - } - if (Optional.IsDefined(TranscriptionConfiguration)) - { - writer.WritePropertyName("transcriptionConfiguration"u8); - writer.WriteObjectValue(TranscriptionConfiguration); - } if (Optional.IsDefined(CallIntelligenceOptions)) { writer.WritePropertyName("callIntelligenceOptions"u8); writer.WriteObjectValue(CallIntelligenceOptions); } + if (Optional.IsDefined(OpsSource)) + { + writer.WritePropertyName("opsSource"u8); + writer.WriteObjectValue(OpsSource); + } if (Optional.IsDefined(CustomCallingContext)) { writer.WritePropertyName("customCallingContext"u8); writer.WriteObjectValue(CustomCallingContext); } + if (Optional.IsDefined(MediaStreamingOptions)) + { + writer.WritePropertyName("mediaStreamingOptions"u8); + writer.WriteObjectValue(MediaStreamingOptions); + } + if (Optional.IsDefined(TranscriptionOptions)) + { + writer.WritePropertyName("transcriptionOptions"u8); + writer.WriteObjectValue(TranscriptionOptions); + } writer.WriteEndObject(); } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CreateCallRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CreateCallRequestInternal.cs index 433e67d20bf5..00a886091f6f 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CreateCallRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CreateCallRequestInternal.cs @@ -35,26 +35,26 @@ public CreateCallRequestInternal(IEnumerable targe /// /// Display name of the call if dialing out to a pstn number. /// The identifier of the source of the call. - /// The identifier of the source in an OPS call. /// A customer set value used to track the answering of a call. /// The callback URI. - /// Media Streaming Configuration. - /// Live Transcription Configuration. /// AI options for the call. + /// The identifier of the source in an OPS call. /// Used by customer to send custom calling context to targets. - internal CreateCallRequestInternal(IList targets, PhoneNumberIdentifierModel sourceCallerIdNumber, string sourceDisplayName, CommunicationUserIdentifierModel source, MicrosoftTeamsAppIdentifierModel opsSource, string operationContext, string callbackUri, MediaStreamingOptionsInternal mediaStreamingConfiguration, TranscriptionOptionsInternal transcriptionConfiguration, CallIntelligenceOptionsInternal callIntelligenceOptions, CustomCallingContextInternal customCallingContext) + /// Media Streaming Options. + /// Transcription Options. + internal CreateCallRequestInternal(IList targets, PhoneNumberIdentifierModel sourceCallerIdNumber, string sourceDisplayName, CommunicationUserIdentifierModel source, string operationContext, string callbackUri, CallIntelligenceOptionsInternal callIntelligenceOptions, MicrosoftTeamsAppIdentifierModel opsSource, CustomCallingContextInternal customCallingContext, MediaStreamingOptionsInternal mediaStreamingOptions, TranscriptionOptionsInternal transcriptionOptions) { Targets = targets; SourceCallerIdNumber = sourceCallerIdNumber; SourceDisplayName = sourceDisplayName; Source = source; - OpsSource = opsSource; OperationContext = operationContext; CallbackUri = callbackUri; - MediaStreamingConfiguration = mediaStreamingConfiguration; - TranscriptionConfiguration = transcriptionConfiguration; CallIntelligenceOptions = callIntelligenceOptions; + OpsSource = opsSource; CustomCallingContext = customCallingContext; + MediaStreamingOptions = mediaStreamingOptions; + TranscriptionOptions = transcriptionOptions; } /// The targets of the call. @@ -68,19 +68,19 @@ internal CreateCallRequestInternal(IList targets, public string SourceDisplayName { get; set; } /// The identifier of the source of the call. public CommunicationUserIdentifierModel Source { get; set; } - /// The identifier of the source in an OPS call. - public MicrosoftTeamsAppIdentifierModel OpsSource { get; set; } /// A customer set value used to track the answering of a call. public string OperationContext { get; set; } /// The callback URI. public string CallbackUri { get; } - /// Media Streaming Configuration. - public MediaStreamingOptionsInternal MediaStreamingConfiguration { get; set; } - /// Live Transcription Configuration. - public TranscriptionOptionsInternal TranscriptionConfiguration { get; set; } /// AI options for the call. public CallIntelligenceOptionsInternal CallIntelligenceOptions { get; set; } + /// The identifier of the source in an OPS call. + public MicrosoftTeamsAppIdentifierModel OpsSource { get; set; } /// Used by customer to send custom calling context to targets. public CustomCallingContextInternal CustomCallingContext { get; set; } + /// Media Streaming Options. + public MediaStreamingOptionsInternal MediaStreamingOptions { get; set; } + /// Transcription Options. + public TranscriptionOptionsInternal TranscriptionOptions { get; set; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CustomCallingContextInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CustomCallingContextInternal.cs index a5ca28c30988..9f7727dddbd1 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CustomCallingContextInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CustomCallingContextInternal.cs @@ -9,7 +9,7 @@ namespace Azure.Communication.CallAutomation { - /// The CustomCallingContext. + /// The custom calling context which will be sent to the target. internal partial class CustomCallingContextInternal { /// Initializes a new instance of . @@ -19,9 +19,9 @@ public CustomCallingContextInternal() SipHeaders = new ChangeTrackingDictionary(); } - /// Dictionary of <string>. + /// Custom calling context VoiP headers. public IDictionary VoipHeaders { get; } - /// Dictionary of <string>. + /// Custom calling context SIP headers. public IDictionary SipHeaders { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogCompletedInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogCompletedInternal.Serialization.cs index 2aaca86f2123..89a0a187e7ed 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogCompletedInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogCompletedInternal.Serialization.cs @@ -17,29 +17,15 @@ internal static DialogCompletedInternal DeserializeDialogCompletedInternal(JsonE { return null; } - string operationContext = default; - ResultInformation resultInformation = default; DialogInputType? dialogInputType = default; string dialogId = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("operationContext"u8)) - { - operationContext = property.Value.GetString(); - continue; - } - if (property.NameEquals("resultInformation"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resultInformation = ResultInformation.DeserializeResultInformation(property.Value); - continue; - } if (property.NameEquals("dialogInputType"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -69,15 +55,29 @@ internal static DialogCompletedInternal DeserializeDialogCompletedInternal(JsonE correlationId = property.Value.GetString(); continue; } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } } return new DialogCompletedInternal( - operationContext, - resultInformation, dialogInputType, dialogId, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogCompletedInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogCompletedInternal.cs index ceebb63cbf27..5414d3eea1d7 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogCompletedInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogCompletedInternal.cs @@ -16,28 +16,24 @@ internal DialogCompletedInternal() } /// Initializes a new instance of . - /// Used by customers when calling answerCall action to correlate the request to the response event. - /// Contains the resulting SIP code/sub-code and message from NGC services. /// Determines the type of the dialog. /// Dialog ID. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal DialogCompletedInternal(string operationContext, ResultInformation resultInformation, DialogInputType? dialogInputType, string dialogId, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal DialogCompletedInternal(DialogInputType? dialogInputType, string dialogId, string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) { - OperationContext = operationContext; - ResultInformation = resultInformation; DialogInputType = dialogInputType; DialogId = dialogId; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; } - /// 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; } /// Determines the type of the dialog. public DialogInputType? DialogInputType { get; } /// Dialog ID. @@ -48,5 +44,9 @@ internal DialogCompletedInternal(string operationContext, ResultInformation resu 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 mid-call actions to correlate the request to the response event. + public string OperationContext { get; } + /// Contains the resulting SIP code, sub-code and message. + public ResultInformation ResultInformation { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogConsentInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogConsentInternal.Serialization.cs index 67fe255cc684..f3f830aa122c 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogConsentInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogConsentInternal.Serialization.cs @@ -17,46 +17,32 @@ internal static DialogConsentInternal DeserializeDialogConsentInternal(JsonEleme { return null; } - UserConsent userConsent = default; - string operationContext = default; - ResultInformation resultInformation = default; DialogInputType? dialogInputType = default; + UserConsent userConsent = default; string dialogId = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("userConsent"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - userConsent = UserConsent.DeserializeUserConsent(property.Value); - continue; - } - if (property.NameEquals("operationContext"u8)) - { - operationContext = property.Value.GetString(); - continue; - } - if (property.NameEquals("resultInformation"u8)) + if (property.NameEquals("dialogInputType"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + dialogInputType = new DialogInputType(property.Value.GetString()); continue; } - if (property.NameEquals("dialogInputType"u8)) + if (property.NameEquals("userConsent"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - dialogInputType = new DialogInputType(property.Value.GetString()); + userConsent = UserConsent.DeserializeUserConsent(property.Value); continue; } if (property.NameEquals("dialogId"u8)) @@ -79,16 +65,30 @@ internal static DialogConsentInternal DeserializeDialogConsentInternal(JsonEleme correlationId = property.Value.GetString(); continue; } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } } return new DialogConsentInternal( - userConsent, - operationContext, - resultInformation, dialogInputType, + userConsent, dialogId, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogConsentInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogConsentInternal.cs index 3c075ab47503..37dee25016f5 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogConsentInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogConsentInternal.cs @@ -16,34 +16,30 @@ internal DialogConsentInternal() } /// Initializes a new instance of . - /// UserConsent data from the Conversation Conductor. - /// Used by customers when calling answerCall action to correlate the request to the response event. - /// Contains the resulting SIP code/sub-code and message from NGC services. /// Determines the type of the dialog. + /// UserConsent data from the Conversation Conductor. /// Dialog ID. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal DialogConsentInternal(UserConsent userConsent, string operationContext, ResultInformation resultInformation, DialogInputType? dialogInputType, string dialogId, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal DialogConsentInternal(DialogInputType? dialogInputType, UserConsent userConsent, string dialogId, string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) { - UserConsent = userConsent; - OperationContext = operationContext; - ResultInformation = resultInformation; DialogInputType = dialogInputType; + UserConsent = userConsent; DialogId = dialogId; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; } - /// UserConsent data from the Conversation Conductor. - public UserConsent UserConsent { 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; } /// Determines the type of the dialog. public DialogInputType? DialogInputType { get; } + /// UserConsent data from the Conversation Conductor. + public UserConsent UserConsent { get; } /// Dialog ID. public string DialogId { get; } /// Call connection ID. @@ -52,5 +48,9 @@ internal DialogConsentInternal(UserConsent userConsent, string operationContext, 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 mid-call actions to correlate the request to the response event. + public string OperationContext { get; } + /// Contains the resulting SIP code, sub-code and message. + public ResultInformation ResultInformation { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogFailedInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogFailedInternal.Serialization.cs index 718a892c26b8..42fb5887b192 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogFailedInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogFailedInternal.Serialization.cs @@ -17,29 +17,15 @@ internal static DialogFailedInternal DeserializeDialogFailedInternal(JsonElement { return null; } - string operationContext = default; - ResultInformation resultInformation = default; DialogInputType? dialogInputType = default; string dialogId = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("operationContext"u8)) - { - operationContext = property.Value.GetString(); - continue; - } - if (property.NameEquals("resultInformation"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resultInformation = ResultInformation.DeserializeResultInformation(property.Value); - continue; - } if (property.NameEquals("dialogInputType"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -69,15 +55,29 @@ internal static DialogFailedInternal DeserializeDialogFailedInternal(JsonElement correlationId = property.Value.GetString(); continue; } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } } return new DialogFailedInternal( - operationContext, - resultInformation, dialogInputType, dialogId, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogFailedInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogFailedInternal.cs index 1a1fef55fdaf..b442788c4587 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogFailedInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogFailedInternal.cs @@ -16,28 +16,24 @@ internal DialogFailedInternal() } /// Initializes a new instance of . - /// Used by customers when calling answerCall action to correlate the request to the response event. - /// Contains the resulting SIP code/sub-code and message from NGC services. /// Determines the type of the dialog. /// Dialog ID. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal DialogFailedInternal(string operationContext, ResultInformation resultInformation, DialogInputType? dialogInputType, string dialogId, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal DialogFailedInternal(DialogInputType? dialogInputType, string dialogId, string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) { - OperationContext = operationContext; - ResultInformation = resultInformation; DialogInputType = dialogInputType; DialogId = dialogId; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; } - /// 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; } /// Determines the type of the dialog. public DialogInputType? DialogInputType { get; } /// Dialog ID. @@ -48,5 +44,9 @@ internal DialogFailedInternal(string operationContext, ResultInformation resultI 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 mid-call actions to correlate the request to the response event. + public string OperationContext { get; } + /// Contains the resulting SIP code, sub-code and message. + public ResultInformation ResultInformation { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogHangupInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogHangupInternal.Serialization.cs index 5c810932a84b..61f3c6ac3c73 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogHangupInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogHangupInternal.Serialization.cs @@ -17,30 +17,16 @@ internal static DialogHangupInternal DeserializeDialogHangupInternal(JsonElement { return null; } - string operationContext = default; - ResultInformation resultInformation = default; DialogInputType? dialogInputType = default; string dialogId = default; object ivrContext = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("operationContext"u8)) - { - operationContext = property.Value.GetString(); - continue; - } - if (property.NameEquals("resultInformation"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resultInformation = ResultInformation.DeserializeResultInformation(property.Value); - continue; - } if (property.NameEquals("dialogInputType"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -79,16 +65,30 @@ internal static DialogHangupInternal DeserializeDialogHangupInternal(JsonElement correlationId = property.Value.GetString(); continue; } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } } return new DialogHangupInternal( - operationContext, - resultInformation, dialogInputType, dialogId, ivrContext, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogHangupInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogHangupInternal.cs index caacfa9b9e95..c214ada07bf6 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogHangupInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogHangupInternal.cs @@ -16,30 +16,26 @@ internal DialogHangupInternal() } /// Initializes a new instance of . - /// Used by customers when calling answerCall action to correlate the request to the response event. - /// Contains the resulting SIP code/sub-code and message from NGC services. /// Determines the type of the dialog. /// Dialog ID. /// Ivr Context. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal DialogHangupInternal(string operationContext, ResultInformation resultInformation, DialogInputType? dialogInputType, string dialogId, object ivrContext, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal DialogHangupInternal(DialogInputType? dialogInputType, string dialogId, object ivrContext, string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) { - OperationContext = operationContext; - ResultInformation = resultInformation; DialogInputType = dialogInputType; DialogId = dialogId; IvrContext = ivrContext; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; } - /// 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; } /// Determines the type of the dialog. public DialogInputType? DialogInputType { get; } /// Dialog ID. @@ -52,5 +48,9 @@ internal DialogHangupInternal(string operationContext, ResultInformation resultI 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 mid-call actions to correlate the request to the response event. + public string OperationContext { get; } + /// Contains the resulting SIP code, sub-code and message. + public ResultInformation ResultInformation { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogLanguageChangeInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogLanguageChangeInternal.Serialization.cs index b06fc7a80d6c..6d6f1bb54379 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogLanguageChangeInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogLanguageChangeInternal.Serialization.cs @@ -17,36 +17,17 @@ internal static DialogLanguageChangeInternal DeserializeDialogLanguageChangeInte { return null; } - string selectedLanguage = default; - string operationContext = default; - ResultInformation resultInformation = default; DialogInputType? dialogInputType = default; string dialogId = default; + string selectedLanguage = default; object ivrContext = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("selectedLanguage"u8)) - { - selectedLanguage = property.Value.GetString(); - continue; - } - if (property.NameEquals("operationContext"u8)) - { - operationContext = property.Value.GetString(); - continue; - } - if (property.NameEquals("resultInformation"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resultInformation = ResultInformation.DeserializeResultInformation(property.Value); - continue; - } if (property.NameEquals("dialogInputType"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -61,6 +42,11 @@ internal static DialogLanguageChangeInternal DeserializeDialogLanguageChangeInte dialogId = property.Value.GetString(); continue; } + if (property.NameEquals("selectedLanguage"u8)) + { + selectedLanguage = property.Value.GetString(); + continue; + } if (property.NameEquals("ivrContext"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -85,17 +71,31 @@ internal static DialogLanguageChangeInternal DeserializeDialogLanguageChangeInte correlationId = property.Value.GetString(); continue; } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } } return new DialogLanguageChangeInternal( - selectedLanguage, - operationContext, - resultInformation, dialogInputType, dialogId, + selectedLanguage, ivrContext, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogLanguageChangeInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogLanguageChangeInternal.cs index 9ce79f2d489f..c4c245d4c472 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogLanguageChangeInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogLanguageChangeInternal.cs @@ -16,38 +16,34 @@ internal DialogLanguageChangeInternal() } /// Initializes a new instance of . - /// Selected Language. - /// Used by customers when calling answerCall action to correlate the request to the response event. - /// Contains the resulting SIP code/sub-code and message from NGC services. /// Determines the type of the dialog. /// Dialog ID. + /// Selected Language. /// Ivr Context. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal DialogLanguageChangeInternal(string selectedLanguage, string operationContext, ResultInformation resultInformation, DialogInputType? dialogInputType, string dialogId, object ivrContext, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal DialogLanguageChangeInternal(DialogInputType? dialogInputType, string dialogId, string selectedLanguage, object ivrContext, string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) { - SelectedLanguage = selectedLanguage; - OperationContext = operationContext; - ResultInformation = resultInformation; DialogInputType = dialogInputType; DialogId = dialogId; + SelectedLanguage = selectedLanguage; IvrContext = ivrContext; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; } - /// Selected Language. - public string SelectedLanguage { 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; } /// Determines the type of the dialog. public DialogInputType? DialogInputType { get; } /// Dialog ID. public string DialogId { get; } + /// Selected Language. + public string SelectedLanguage { get; } /// Ivr Context. public object IvrContext { get; } /// Call connection ID. @@ -56,5 +52,9 @@ internal DialogLanguageChangeInternal(string selectedLanguage, string operationC 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 mid-call actions to correlate the request to the response event. + public string OperationContext { get; } + /// Contains the resulting SIP code, sub-code and message. + public ResultInformation ResultInformation { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogSensitivityUpdateInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogSensitivityUpdateInternal.Serialization.cs index b2a77fd4fae4..55e4b20229ca 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogSensitivityUpdateInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogSensitivityUpdateInternal.Serialization.cs @@ -17,51 +17,37 @@ internal static DialogSensitivityUpdateInternal DeserializeDialogSensitivityUpda { return null; } - bool? sensitiveMask = default; - string operationContext = default; - ResultInformation resultInformation = default; DialogInputType? dialogInputType = default; string dialogId = default; + bool? sensitiveMask = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("sensitiveMask"u8)) + if (property.NameEquals("dialogInputType"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - sensitiveMask = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("operationContext"u8)) - { - operationContext = property.Value.GetString(); + dialogInputType = new DialogInputType(property.Value.GetString()); continue; } - if (property.NameEquals("resultInformation"u8)) + if (property.NameEquals("dialogId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + dialogId = property.Value.GetString(); continue; } - if (property.NameEquals("dialogInputType"u8)) + if (property.NameEquals("sensitiveMask"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - dialogInputType = new DialogInputType(property.Value.GetString()); - continue; - } - if (property.NameEquals("dialogId"u8)) - { - dialogId = property.Value.GetString(); + sensitiveMask = property.Value.GetBoolean(); continue; } if (property.NameEquals("callConnectionId"u8)) @@ -79,16 +65,30 @@ internal static DialogSensitivityUpdateInternal DeserializeDialogSensitivityUpda correlationId = property.Value.GetString(); continue; } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } } return new DialogSensitivityUpdateInternal( - sensitiveMask, - operationContext, - resultInformation, dialogInputType, dialogId, + sensitiveMask, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogSensitivityUpdateInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogSensitivityUpdateInternal.cs index 7945f7da465a..c53ec140a30d 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogSensitivityUpdateInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogSensitivityUpdateInternal.cs @@ -16,41 +16,41 @@ internal DialogSensitivityUpdateInternal() } /// Initializes a new instance of . - /// SensitiveMask. - /// Used by customers when calling answerCall action to correlate the request to the response event. - /// Contains the resulting SIP code/sub-code and message from NGC services. /// Determines the type of the dialog. /// Dialog ID. + /// SensitiveMask. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal DialogSensitivityUpdateInternal(bool? sensitiveMask, string operationContext, ResultInformation resultInformation, DialogInputType? dialogInputType, string dialogId, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal DialogSensitivityUpdateInternal(DialogInputType? dialogInputType, string dialogId, bool? sensitiveMask, string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) { - SensitiveMask = sensitiveMask; - OperationContext = operationContext; - ResultInformation = resultInformation; DialogInputType = dialogInputType; DialogId = dialogId; + SensitiveMask = sensitiveMask; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; } - /// SensitiveMask. - public bool? SensitiveMask { 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; } /// Determines the type of the dialog. public DialogInputType? DialogInputType { get; } /// Dialog ID. public string DialogId { get; } + /// SensitiveMask. + public bool? SensitiveMask { get; } /// 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 mid-call actions to correlate the request to the response event. + public string OperationContext { get; } + /// Contains the resulting SIP code, sub-code and message. + public ResultInformation ResultInformation { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogStartedInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogStartedInternal.Serialization.cs index 406b22ebc90c..8150001a59f4 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogStartedInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogStartedInternal.Serialization.cs @@ -17,29 +17,15 @@ internal static DialogStartedInternal DeserializeDialogStartedInternal(JsonEleme { return null; } - string operationContext = default; - ResultInformation resultInformation = default; DialogInputType? dialogInputType = default; string dialogId = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("operationContext"u8)) - { - operationContext = property.Value.GetString(); - continue; - } - if (property.NameEquals("resultInformation"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resultInformation = ResultInformation.DeserializeResultInformation(property.Value); - continue; - } if (property.NameEquals("dialogInputType"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -69,15 +55,29 @@ internal static DialogStartedInternal DeserializeDialogStartedInternal(JsonEleme correlationId = property.Value.GetString(); continue; } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } } return new DialogStartedInternal( - operationContext, - resultInformation, dialogInputType, dialogId, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogStartedInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogStartedInternal.cs index 99c2e505fbc4..43e1e9f53b72 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogStartedInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogStartedInternal.cs @@ -16,28 +16,24 @@ internal DialogStartedInternal() } /// Initializes a new instance of . - /// Used by customers when calling answerCall action to correlate the request to the response event. - /// Contains the resulting SIP code/sub-code and message from NGC services. /// Determines the type of the dialog. /// Dialog ID. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal DialogStartedInternal(string operationContext, ResultInformation resultInformation, DialogInputType? dialogInputType, string dialogId, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal DialogStartedInternal(DialogInputType? dialogInputType, string dialogId, string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) { - OperationContext = operationContext; - ResultInformation = resultInformation; DialogInputType = dialogInputType; DialogId = dialogId; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; } - /// 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; } /// Determines the type of the dialog. public DialogInputType? DialogInputType { get; } /// Dialog ID. @@ -48,5 +44,9 @@ internal DialogStartedInternal(string operationContext, ResultInformation result 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 mid-call actions to correlate the request to the response event. + public string OperationContext { get; } + /// Contains the resulting SIP code, sub-code and message. + public ResultInformation ResultInformation { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogTransferInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogTransferInternal.Serialization.cs index 3a6cc205e4e2..4103afad0c03 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogTransferInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogTransferInternal.Serialization.cs @@ -17,42 +17,18 @@ internal static DialogTransferInternal DeserializeDialogTransferInternal(JsonEle { return null; } - string transferType = default; - string transferDestination = default; - string operationContext = default; - ResultInformation resultInformation = default; DialogInputType? dialogInputType = default; string dialogId = default; + string transferType = default; + string transferDestination = default; object ivrContext = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("transferType"u8)) - { - transferType = property.Value.GetString(); - continue; - } - if (property.NameEquals("transferDestination"u8)) - { - transferDestination = property.Value.GetString(); - continue; - } - if (property.NameEquals("operationContext"u8)) - { - operationContext = property.Value.GetString(); - continue; - } - if (property.NameEquals("resultInformation"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resultInformation = ResultInformation.DeserializeResultInformation(property.Value); - continue; - } if (property.NameEquals("dialogInputType"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -67,6 +43,16 @@ internal static DialogTransferInternal DeserializeDialogTransferInternal(JsonEle dialogId = property.Value.GetString(); continue; } + if (property.NameEquals("transferType"u8)) + { + transferType = property.Value.GetString(); + continue; + } + if (property.NameEquals("transferDestination"u8)) + { + transferDestination = property.Value.GetString(); + continue; + } if (property.NameEquals("ivrContext"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -91,18 +77,32 @@ internal static DialogTransferInternal DeserializeDialogTransferInternal(JsonEle correlationId = property.Value.GetString(); continue; } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } } return new DialogTransferInternal( - transferType, - transferDestination, - operationContext, - resultInformation, dialogInputType, dialogId, + transferType, + transferDestination, ivrContext, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogTransferInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogTransferInternal.cs index de8493143cc5..02fada96a19a 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogTransferInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogTransferInternal.cs @@ -16,43 +16,39 @@ internal DialogTransferInternal() } /// Initializes a new instance of . - /// Transfer type. - /// Transfer destination. - /// Used by customers when calling answerCall action to correlate the request to the response event. - /// Contains the resulting SIP code/sub-code and message from NGC services. /// Determines the type of the dialog. /// Dialog ID. - /// Ivr Context. + /// Transfer type. + /// Transfer destination. + /// IVR context. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal DialogTransferInternal(string transferType, string transferDestination, string operationContext, ResultInformation resultInformation, DialogInputType? dialogInputType, string dialogId, object ivrContext, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal DialogTransferInternal(DialogInputType? dialogInputType, string dialogId, string transferType, string transferDestination, object ivrContext, string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) { - TransferType = transferType; - TransferDestination = transferDestination; - OperationContext = operationContext; - ResultInformation = resultInformation; DialogInputType = dialogInputType; DialogId = dialogId; + TransferType = transferType; + TransferDestination = transferDestination; IvrContext = ivrContext; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; } - /// Transfer type. - public string TransferType { get; } - /// Transfer destination. - public string TransferDestination { 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; } /// Determines the type of the dialog. public DialogInputType? DialogInputType { get; } /// Dialog ID. public string DialogId { get; } - /// Ivr Context. + /// Transfer type. + public string TransferType { get; } + /// Transfer destination. + public string TransferDestination { get; } + /// IVR context. public object IvrContext { get; } /// Call connection ID. public string CallConnectionId { get; } @@ -60,5 +56,9 @@ internal DialogTransferInternal(string transferType, string transferDestination, 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 mid-call actions to correlate the request to the response event. + public string OperationContext { get; } + /// Contains the resulting SIP code, sub-code and message. + public ResultInformation ResultInformation { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogUpdatedInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogUpdatedInternal.Serialization.cs index 9df41fbcf0dd..8e5818d0cea6 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogUpdatedInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogUpdatedInternal.Serialization.cs @@ -17,30 +17,16 @@ internal static DialogUpdatedInternal DeserializeDialogUpdatedInternal(JsonEleme { return null; } - string operationContext = default; - ResultInformation resultInformation = default; DialogInputType? dialogInputType = default; string dialogId = default; object ivrContext = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("operationContext"u8)) - { - operationContext = property.Value.GetString(); - continue; - } - if (property.NameEquals("resultInformation"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resultInformation = ResultInformation.DeserializeResultInformation(property.Value); - continue; - } if (property.NameEquals("dialogInputType"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -79,16 +65,30 @@ internal static DialogUpdatedInternal DeserializeDialogUpdatedInternal(JsonEleme correlationId = property.Value.GetString(); continue; } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } } return new DialogUpdatedInternal( - operationContext, - resultInformation, dialogInputType, dialogId, ivrContext, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogUpdatedInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogUpdatedInternal.cs index 73adc55c569f..764fd4566ea0 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogUpdatedInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/DialogUpdatedInternal.cs @@ -16,35 +16,31 @@ internal DialogUpdatedInternal() } /// Initializes a new instance of . - /// Used by customers when calling answerCall action to correlate the request to the response event. - /// Contains the resulting SIP code/sub-code and message from NGC services. /// Determines the type of the dialog. /// Dialog ID. - /// Ivr Context. + /// IVR context. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal DialogUpdatedInternal(string operationContext, ResultInformation resultInformation, DialogInputType? dialogInputType, string dialogId, object ivrContext, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal DialogUpdatedInternal(DialogInputType? dialogInputType, string dialogId, object ivrContext, string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) { - OperationContext = operationContext; - ResultInformation = resultInformation; DialogInputType = dialogInputType; DialogId = dialogId; IvrContext = ivrContext; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; } - /// 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; } /// Determines the type of the dialog. public DialogInputType? DialogInputType { get; } /// Dialog ID. public string DialogId { get; } - /// Ivr Context. + /// IVR context. public object IvrContext { get; } /// Call connection ID. public string CallConnectionId { get; } @@ -52,5 +48,9 @@ internal DialogUpdatedInternal(string operationContext, ResultInformation result 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 mid-call actions to correlate the request to the response event. + public string OperationContext { get; } + /// Contains the resulting SIP code, sub-code and message. + public ResultInformation ResultInformation { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/HoldAudioCompleted.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/HoldAudioCompleted.cs new file mode 100644 index 000000000000..b560b8a3266e --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/HoldAudioCompleted.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.CallAutomation +{ + /// The HoldAudioCompleted. + internal partial class HoldAudioCompleted + { + /// Initializes a new instance of . + internal HoldAudioCompleted() + { + } + + /// Initializes a new instance of . + /// Call connection ID. + /// Server call ID. + /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal HoldAudioCompleted(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) + { + CallConnectionId = callConnectionId; + ServerCallId = serverCallId; + CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; + } + + /// 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 mid-call actions to correlate the request to the response event. + public string OperationContext { get; } + /// Contains the resulting SIP code, sub-code and message. + public ResultInformation ResultInformation { get; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/HoldAudioPaused.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/HoldAudioPaused.cs new file mode 100644 index 000000000000..3feca3d79e4b --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/HoldAudioPaused.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.CallAutomation +{ + /// The HoldAudioPaused. + internal partial class HoldAudioPaused + { + /// Initializes a new instance of . + internal HoldAudioPaused() + { + } + + /// Initializes a new instance of . + /// Call connection ID. + /// Server call ID. + /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal HoldAudioPaused(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) + { + CallConnectionId = callConnectionId; + ServerCallId = serverCallId; + CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; + } + + /// 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 mid-call actions to correlate the request to the response event. + public string OperationContext { get; } + /// Contains the resulting SIP code, sub-code and message. + public ResultInformation ResultInformation { get; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/HoldAudioResumed.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/HoldAudioResumed.cs new file mode 100644 index 000000000000..82ff2de95a90 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/HoldAudioResumed.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.CallAutomation +{ + /// The HoldAudioResumed. + internal partial class HoldAudioResumed + { + /// Initializes a new instance of . + internal HoldAudioResumed() + { + } + + /// Initializes a new instance of . + /// Call connection ID. + /// Server call ID. + /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal HoldAudioResumed(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) + { + CallConnectionId = callConnectionId; + ServerCallId = serverCallId; + CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; + } + + /// 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 mid-call actions to correlate the request to the response event. + public string OperationContext { get; } + /// Contains the resulting SIP code, sub-code and message. + public ResultInformation ResultInformation { get; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/HoldAudioStarted.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/HoldAudioStarted.cs new file mode 100644 index 000000000000..cc9931cd4899 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/HoldAudioStarted.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.CallAutomation +{ + /// The HoldAudioStarted. + internal partial class HoldAudioStarted + { + /// Initializes a new instance of . + internal HoldAudioStarted() + { + } + + /// Initializes a new instance of . + /// Call connection ID. + /// Server call ID. + /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal HoldAudioStarted(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) + { + CallConnectionId = callConnectionId; + ServerCallId = serverCallId; + CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; + } + + /// 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 mid-call actions to correlate the request to the response event. + public string OperationContext { get; } + /// Contains the resulting SIP code, sub-code and message. + public ResultInformation ResultInformation { get; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/HoldFailed.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/HoldFailed.cs deleted file mode 100644 index e0721196e11e..000000000000 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/HoldFailed.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.Communication.CallAutomation -{ - /// The HoldFailed. - public partial class HoldFailed - { - /// Initializes a new instance of . - internal HoldFailed() - { - } - } -} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/HoldFailedInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/HoldFailedInternal.Serialization.cs new file mode 100644 index 000000000000..318a610ebb2f --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/HoldFailedInternal.Serialization.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; + +namespace Azure.Communication.CallAutomation +{ + internal partial class HoldFailedInternal + { + internal static HoldFailedInternal DeserializeHoldFailedInternal(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string callConnectionId = default; + string serverCallId = default; + string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("callConnectionId"u8)) + { + callConnectionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("serverCallId"u8)) + { + serverCallId = property.Value.GetString(); + continue; + } + if (property.NameEquals("correlationId"u8)) + { + correlationId = property.Value.GetString(); + continue; + } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } + } + return new HoldFailedInternal(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static HoldFailedInternal FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeHoldFailedInternal(document.RootElement); + } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/HoldFailedInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/HoldFailedInternal.cs new file mode 100644 index 000000000000..ad7de579f5b9 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/HoldFailedInternal.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.CallAutomation +{ + /// The HoldFailed. + internal partial class HoldFailedInternal + { + /// Initializes a new instance of . + internal HoldFailedInternal() + { + } + + /// Initializes a new instance of . + /// Call connection ID. + /// Server call ID. + /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal HoldFailedInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) + { + CallConnectionId = callConnectionId; + ServerCallId = serverCallId; + CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; + } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/IncomingCallInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/IncomingCallInternal.Serialization.cs index 3669f80caeaa..afe821a16ad8 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/IncomingCallInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/IncomingCallInternal.Serialization.cs @@ -19,8 +19,8 @@ internal static IncomingCallInternal DeserializeIncomingCallInternal(JsonElement } CommunicationIdentifierModel to = default; CommunicationIdentifierModel @from = default; - string serverCallId = default; string callerDisplayName = default; + string serverCallId = default; CustomCallingContextInternal customContext = default; string incomingCallContext = default; CommunicationIdentifierModel onBehalfOfCallee = default; @@ -45,14 +45,14 @@ internal static IncomingCallInternal DeserializeIncomingCallInternal(JsonElement @from = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); continue; } - if (property.NameEquals("serverCallId"u8)) + if (property.NameEquals("callerDisplayName"u8)) { - serverCallId = property.Value.GetString(); + callerDisplayName = property.Value.GetString(); continue; } - if (property.NameEquals("callerDisplayName"u8)) + if (property.NameEquals("serverCallId"u8)) { - callerDisplayName = property.Value.GetString(); + serverCallId = property.Value.GetString(); continue; } if (property.NameEquals("customContext"u8)) @@ -87,8 +87,8 @@ internal static IncomingCallInternal DeserializeIncomingCallInternal(JsonElement return new IncomingCallInternal( to, @from, - serverCallId, callerDisplayName, + serverCallId, customContext, incomingCallContext, onBehalfOfCallee, diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/IncomingCallInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/IncomingCallInternal.cs index a5c3e1aa6cb8..71dfda9a4c3b 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/IncomingCallInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/IncomingCallInternal.cs @@ -18,18 +18,18 @@ internal IncomingCallInternal() /// Initializes a new instance of . /// The communication identifier of the target user. /// The communication identifier of the user who initiated the call. - /// The server call id. /// Display name of caller. + /// The server call id. /// Custom Context of Incoming Call. /// Incoming call context. /// The communication identifier of the user on behalf of whom the call is made. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal IncomingCallInternal(CommunicationIdentifierModel to, CommunicationIdentifierModel @from, string serverCallId, string callerDisplayName, CustomCallingContextInternal customContext, string incomingCallContext, CommunicationIdentifierModel onBehalfOfCallee, string correlationId) + internal IncomingCallInternal(CommunicationIdentifierModel to, CommunicationIdentifierModel @from, string callerDisplayName, string serverCallId, CustomCallingContextInternal customContext, string incomingCallContext, CommunicationIdentifierModel onBehalfOfCallee, string correlationId) { To = to; From = @from; - ServerCallId = serverCallId; CallerDisplayName = callerDisplayName; + ServerCallId = serverCallId; CustomContext = customContext; IncomingCallContext = incomingCallContext; OnBehalfOfCallee = onBehalfOfCallee; @@ -40,10 +40,10 @@ internal IncomingCallInternal(CommunicationIdentifierModel to, CommunicationIden public CommunicationIdentifierModel To { get; } /// The communication identifier of the user who initiated the call. public CommunicationIdentifierModel From { get; } - /// The server call id. - public string ServerCallId { get; } /// Display name of caller. public string CallerDisplayName { get; } + /// The server call id. + public string ServerCallId { get; } /// Custom Context of Incoming Call. public CustomCallingContextInternal CustomContext { get; } /// Incoming call context. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopHoldMusicRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/InterruptAudioAndAnnounceRequestInternal.Serialization.cs similarity index 67% rename from sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopHoldMusicRequestInternal.Serialization.cs rename to sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/InterruptAudioAndAnnounceRequestInternal.Serialization.cs index 0139a4048f65..4f676f1b1d66 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopHoldMusicRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/InterruptAudioAndAnnounceRequestInternal.Serialization.cs @@ -10,13 +10,20 @@ namespace Azure.Communication.CallAutomation { - internal partial class StopHoldMusicRequestInternal : IUtf8JsonSerializable + internal partial class InterruptAudioAndAnnounceRequestInternal : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - writer.WritePropertyName("targetParticipant"u8); - writer.WriteObjectValue(TargetParticipant); + writer.WritePropertyName("playSources"u8); + writer.WriteStartArray(); + foreach (var item in PlaySources) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + writer.WritePropertyName("playTo"u8); + writer.WriteObjectValue(PlayTo); if (Optional.IsDefined(OperationContext)) { writer.WritePropertyName("operationContext"u8); diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/InterruptAudioAndAnnounceRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/InterruptAudioAndAnnounceRequestInternal.cs new file mode 100644 index 000000000000..3e022e1f0404 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/InterruptAudioAndAnnounceRequestInternal.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Communication.CallAutomation +{ + /// The InterruptAudioAndAnnounceRequest. + internal partial class InterruptAudioAndAnnounceRequestInternal + { + /// Initializes a new instance of . + /// The source of the audio to be played. + /// + /// The list of call participants play provided audio to. + /// Plays to everyone in the call when not provided. + /// + /// or is null. + public InterruptAudioAndAnnounceRequestInternal(IEnumerable playSources, CommunicationIdentifierModel playTo) + { + Argument.AssertNotNull(playSources, nameof(playSources)); + Argument.AssertNotNull(playTo, nameof(playTo)); + + PlaySources = playSources.ToList(); + PlayTo = playTo; + } + + /// Initializes a new instance of . + /// The source of the audio to be played. + /// + /// The list of call participants play provided audio to. + /// Plays to everyone in the call when not provided. + /// + /// The value to identify context of the operation. + internal InterruptAudioAndAnnounceRequestInternal(IList playSources, CommunicationIdentifierModel playTo, string operationContext) + { + PlaySources = playSources; + PlayTo = playTo; + OperationContext = operationContext; + } + + /// The source of the audio to be played. + public IList PlaySources { get; } + /// + /// The list of call participants play provided audio to. + /// Plays to everyone in the call when not provided. + /// + public CommunicationIdentifierModel PlayTo { get; } + /// The value to identify context of the operation. + public string OperationContext { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingFailed.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingFailed.Serialization.cs index 660c0bcef9c7..a6aac2d0eb1b 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingFailed.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingFailed.Serialization.cs @@ -17,28 +17,14 @@ internal static MediaStreamingFailed DeserializeMediaStreamingFailed(JsonElement { return null; } - string operationContext = default; - ResultInformation resultInformation = default; MediaStreamingUpdate mediaStreamingUpdate = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("operationContext"u8)) - { - operationContext = property.Value.GetString(); - continue; - } - if (property.NameEquals("resultInformation"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resultInformation = ResultInformation.DeserializeResultInformation(property.Value); - continue; - } if (property.NameEquals("mediaStreamingUpdate"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -63,14 +49,28 @@ internal static MediaStreamingFailed DeserializeMediaStreamingFailed(JsonElement correlationId = property.Value.GetString(); continue; } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } } return new MediaStreamingFailed( - operationContext, - resultInformation, mediaStreamingUpdate, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingFailed.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingFailed.cs index e8fce794708e..ff75df9e64ef 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingFailed.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingFailed.cs @@ -16,22 +16,23 @@ internal MediaStreamingFailed() } /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. - /// Defines the result for audio streaming update with the current status and the details about the status. + /// Defines the result for MediaStreamingUpdate with the current status and the details about the status. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal MediaStreamingFailed(string operationContext, ResultInformation resultInformation, MediaStreamingUpdate mediaStreamingUpdate, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal MediaStreamingFailed(MediaStreamingUpdate mediaStreamingUpdate, string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) { - OperationContext = operationContext; - ResultInformation = resultInformation; MediaStreamingUpdate = mediaStreamingUpdate; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; } - /// Defines the result for audio streaming update with the current status and the details about the status. + + /// Defines the result for MediaStreamingUpdate with the current status and the details about the status. public MediaStreamingUpdate MediaStreamingUpdate { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingOptionsInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingOptionsInternal.Serialization.cs index b4802d532bd4..31e0a8d690c0 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingOptionsInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingOptionsInternal.Serialization.cs @@ -28,6 +28,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("startMediaStreaming"u8); writer.WriteBooleanValue(StartMediaStreaming.Value); } + if (Optional.IsDefined(EnableBidirectional)) + { + writer.WritePropertyName("enableBidirectional"u8); + writer.WriteBooleanValue(EnableBidirectional.Value); + } + if (Optional.IsDefined(AudioFormat)) + { + writer.WritePropertyName("audioFormat"u8); + writer.WriteStringValue(AudioFormat.Value.ToString()); + } writer.WriteEndObject(); } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingOptionsInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingOptionsInternal.cs index 304acbc8a14e..bdbc504b93fe 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingOptionsInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingOptionsInternal.cs @@ -34,13 +34,17 @@ public MediaStreamingOptionsInternal(string transportUrl, MediaStreamingTranspor /// Content type to stream, eg. audio. /// Audio channel type to stream, eg. unmixed audio, mixed audio. /// Determines if the media streaming should be started immediately after call is answered or not. - internal MediaStreamingOptionsInternal(string transportUrl, MediaStreamingTransport transportType, MediaStreamingContent contentType, MediaStreamingAudioChannel audioChannelType, bool? startMediaStreaming) + /// A value indicating whether bidirectional streaming is enabled. + /// Specifies the audio format used for encoding, including sample rate and channel type. + internal MediaStreamingOptionsInternal(string transportUrl, MediaStreamingTransport transportType, MediaStreamingContent contentType, MediaStreamingAudioChannel audioChannelType, bool? startMediaStreaming, bool? enableBidirectional, AudioFormat? audioFormat) { TransportUrl = transportUrl; TransportType = transportType; ContentType = contentType; AudioChannelType = audioChannelType; StartMediaStreaming = startMediaStreaming; + EnableBidirectional = enableBidirectional; + AudioFormat = audioFormat; } /// Transport URL for media streaming. @@ -53,5 +57,9 @@ internal MediaStreamingOptionsInternal(string transportUrl, MediaStreamingTransp public MediaStreamingAudioChannel AudioChannelType { get; } /// Determines if the media streaming should be started immediately after call is answered or not. public bool? StartMediaStreaming { get; set; } + /// A value indicating whether bidirectional streaming is enabled. + public bool? EnableBidirectional { get; set; } + /// Specifies the audio format used for encoding, including sample rate and channel type. + public AudioFormat? AudioFormat { get; set; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingStarted.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingStarted.Serialization.cs index c43cee8b4f1f..c7df048c3c98 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingStarted.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingStarted.Serialization.cs @@ -17,28 +17,14 @@ internal static MediaStreamingStarted DeserializeMediaStreamingStarted(JsonEleme { return null; } - string operationContext = default; - ResultInformation resultInformation = default; MediaStreamingUpdate mediaStreamingUpdate = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("operationContext"u8)) - { - operationContext = property.Value.GetString(); - continue; - } - if (property.NameEquals("resultInformation"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resultInformation = ResultInformation.DeserializeResultInformation(property.Value); - continue; - } if (property.NameEquals("mediaStreamingUpdate"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -63,14 +49,28 @@ internal static MediaStreamingStarted DeserializeMediaStreamingStarted(JsonEleme correlationId = property.Value.GetString(); continue; } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } } return new MediaStreamingStarted( - operationContext, - resultInformation, mediaStreamingUpdate, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingStarted.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingStarted.cs index 7d86d5b3e975..6211ba74022d 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingStarted.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingStarted.cs @@ -16,22 +16,23 @@ internal MediaStreamingStarted() } /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. - /// Defines the result for audio streaming update with the current status and the details about the status. + /// Defines the result for MediaStreamingUpdate with the current status and the details about the status. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal MediaStreamingStarted(string operationContext, ResultInformation resultInformation, MediaStreamingUpdate mediaStreamingUpdate, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal MediaStreamingStarted(MediaStreamingUpdate mediaStreamingUpdate, string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) { - OperationContext = operationContext; - ResultInformation = resultInformation; MediaStreamingUpdate = mediaStreamingUpdate; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; } - /// Defines the result for audio streaming update with the current status and the details about the status. + + /// Defines the result for MediaStreamingUpdate with the current status and the details about the status. public MediaStreamingUpdate MediaStreamingUpdate { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingStopped.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingStopped.Serialization.cs index d650b0a6f9d8..9525c902b614 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingStopped.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingStopped.Serialization.cs @@ -17,28 +17,14 @@ internal static MediaStreamingStopped DeserializeMediaStreamingStopped(JsonEleme { return null; } - string operationContext = default; - ResultInformation resultInformation = default; MediaStreamingUpdate mediaStreamingUpdate = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("operationContext"u8)) - { - operationContext = property.Value.GetString(); - continue; - } - if (property.NameEquals("resultInformation"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resultInformation = ResultInformation.DeserializeResultInformation(property.Value); - continue; - } if (property.NameEquals("mediaStreamingUpdate"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -63,14 +49,28 @@ internal static MediaStreamingStopped DeserializeMediaStreamingStopped(JsonEleme correlationId = property.Value.GetString(); continue; } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } } return new MediaStreamingStopped( - operationContext, - resultInformation, mediaStreamingUpdate, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingStopped.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingStopped.cs index a7c9979b31e6..26be58f0c2c4 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingStopped.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingStopped.cs @@ -16,22 +16,23 @@ internal MediaStreamingStopped() } /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. - /// Defines the result for audio streaming update with the current status and the details about the status. + /// Defines the result for MediaStreamingUpdate with the current status and the details about the status. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal MediaStreamingStopped(string operationContext, ResultInformation resultInformation, MediaStreamingUpdate mediaStreamingUpdate, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal MediaStreamingStopped(MediaStreamingUpdate mediaStreamingUpdate, string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) { - OperationContext = operationContext; - ResultInformation = resultInformation; MediaStreamingUpdate = mediaStreamingUpdate; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; } - /// Defines the result for audio streaming update with the current status and the details about the status. + + /// Defines the result for MediaStreamingUpdate with the current status and the details about the status. public MediaStreamingUpdate MediaStreamingUpdate { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingSubscriptionInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingSubscriptionInternal.Serialization.cs new file mode 100644 index 000000000000..63bbbe79b1b8 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingSubscriptionInternal.Serialization.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; + +namespace Azure.Communication.CallAutomation +{ + internal partial class MediaStreamingSubscriptionInternal + { + internal static MediaStreamingSubscriptionInternal DeserializeMediaStreamingSubscriptionInternal(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + MediaStreamingSubscriptionState? state = default; + IReadOnlyList subscribedContentTypes = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("state"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new MediaStreamingSubscriptionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("subscribedContentTypes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new MediaStreamingContent(item.GetString())); + } + subscribedContentTypes = array; + continue; + } + } + return new MediaStreamingSubscriptionInternal(id, state, subscribedContentTypes ?? new ChangeTrackingList()); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static MediaStreamingSubscriptionInternal FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeMediaStreamingSubscriptionInternal(document.RootElement); + } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingSubscriptionInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingSubscriptionInternal.cs new file mode 100644 index 000000000000..4f11845a0918 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingSubscriptionInternal.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Communication.CallAutomation +{ + /// Media streaming Subscription Object. + internal partial class MediaStreamingSubscriptionInternal + { + /// Initializes a new instance of . + internal MediaStreamingSubscriptionInternal() + { + SubscribedContentTypes = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Subscription Id. + /// Media streaming subscription state. + /// Subscribed media streaming content types. + internal MediaStreamingSubscriptionInternal(string id, MediaStreamingSubscriptionState? state, IReadOnlyList subscribedContentTypes) + { + Id = id; + State = state; + SubscribedContentTypes = subscribedContentTypes; + } + + /// Subscription Id. + public string Id { get; } + /// Media streaming subscription state. + public MediaStreamingSubscriptionState? State { get; } + /// Subscribed media streaming content types. + public IReadOnlyList SubscribedContentTypes { get; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingSubscriptionState.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingSubscriptionState.cs new file mode 100644 index 000000000000..512d726e1d73 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MediaStreamingSubscriptionState.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Communication.CallAutomation +{ + /// Media streaming subscription state. + public readonly partial struct MediaStreamingSubscriptionState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public MediaStreamingSubscriptionState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DisabledValue = "disabled"; + private const string InactiveValue = "inactive"; + private const string ActiveValue = "active"; + + /// disabled. + public static MediaStreamingSubscriptionState Disabled { get; } = new MediaStreamingSubscriptionState(DisabledValue); + /// inactive. + public static MediaStreamingSubscriptionState Inactive { get; } = new MediaStreamingSubscriptionState(InactiveValue); + /// active. + public static MediaStreamingSubscriptionState Active { get; } = new MediaStreamingSubscriptionState(ActiveValue); + /// Determines if two values are the same. + public static bool operator ==(MediaStreamingSubscriptionState left, MediaStreamingSubscriptionState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(MediaStreamingSubscriptionState left, MediaStreamingSubscriptionState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator MediaStreamingSubscriptionState(string value) => new MediaStreamingSubscriptionState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is MediaStreamingSubscriptionState other && Equals(other); + /// + public bool Equals(MediaStreamingSubscriptionState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ParticipantsUpdatedInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ParticipantsUpdatedInternal.Serialization.cs index d6d27dfd76c0..bac622053fe6 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ParticipantsUpdatedInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ParticipantsUpdatedInternal.Serialization.cs @@ -18,13 +18,38 @@ internal static ParticipantsUpdatedInternal DeserializeParticipantsUpdatedIntern { return null; } - IReadOnlyList participants = default; - int? sequenceNumber = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + int? sequenceNumber = default; + IReadOnlyList participants = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("callConnectionId"u8)) + { + callConnectionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("serverCallId"u8)) + { + serverCallId = property.Value.GetString(); + continue; + } + if (property.NameEquals("correlationId"u8)) + { + correlationId = property.Value.GetString(); + continue; + } + if (property.NameEquals("sequenceNumber"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sequenceNumber = property.Value.GetInt32(); + continue; + } if (property.NameEquals("participants"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -39,32 +64,23 @@ internal static ParticipantsUpdatedInternal DeserializeParticipantsUpdatedIntern participants = array; continue; } - if (property.NameEquals("sequenceNumber"u8)) + if (property.NameEquals("resultInformation"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - sequenceNumber = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("callConnectionId"u8)) - { - callConnectionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("serverCallId"u8)) - { - serverCallId = property.Value.GetString(); - continue; - } - if (property.NameEquals("correlationId"u8)) - { - correlationId = property.Value.GetString(); + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); continue; } } - return new ParticipantsUpdatedInternal(participants ?? new ChangeTrackingList(), sequenceNumber, callConnectionId, serverCallId, correlationId); + return new ParticipantsUpdatedInternal( + callConnectionId, + serverCallId, + correlationId, + sequenceNumber, + participants ?? new ChangeTrackingList(), + resultInformation); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ParticipantsUpdatedInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ParticipantsUpdatedInternal.cs index cfee784abddf..a424d240d317 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ParticipantsUpdatedInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/ParticipantsUpdatedInternal.cs @@ -19,29 +19,33 @@ internal ParticipantsUpdatedInternal() } /// Initializes a new instance of . - /// The list of participants in the call. - /// /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal ParticipantsUpdatedInternal(IReadOnlyList participants, int? sequenceNumber, string callConnectionId, string serverCallId, string correlationId) + /// The Sequence Number of the event. + /// The list of participants in the call. + /// Contains the resulting SIP code, sub-code and message. + internal ParticipantsUpdatedInternal(string callConnectionId, string serverCallId, string correlationId, int? sequenceNumber, IReadOnlyList participants, ResultInformation resultInformation) { - Participants = participants; - SequenceNumber = sequenceNumber; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + SequenceNumber = sequenceNumber; + Participants = participants; + ResultInformation = resultInformation; } - /// The list of participants in the call. - public IReadOnlyList Participants { get; } - /// Gets the sequence number. - public int? SequenceNumber { get; } /// 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; } + /// The Sequence Number of the event. + public int? SequenceNumber { get; } + /// The list of participants in the call. + public IReadOnlyList Participants { get; } + /// Contains the resulting SIP code, sub-code and message. + public ResultInformation ResultInformation { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCanceled.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCanceled.Serialization.cs index a67e5b9d60b4..90c9a1e451af 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCanceled.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCanceled.Serialization.cs @@ -17,17 +17,13 @@ internal static PlayCanceled DeserializePlayCanceled(JsonElement element) { return null; } - string operationContext = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("operationContext"u8)) - { - operationContext = property.Value.GetString(); - continue; - } if (property.NameEquals("callConnectionId"u8)) { callConnectionId = property.Value.GetString(); @@ -43,8 +39,22 @@ internal static PlayCanceled DeserializePlayCanceled(JsonElement element) correlationId = property.Value.GetString(); continue; } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } } - return new PlayCanceled(operationContext, callConnectionId, serverCallId, correlationId); + return new PlayCanceled(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCanceled.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCanceled.cs index 6186d5a5e8fc..8108f76d5297 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCanceled.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCanceled.cs @@ -16,16 +16,18 @@ internal PlayCanceled() } /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal PlayCanceled(string operationContext, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal PlayCanceled(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) { - OperationContext = operationContext; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCompleted.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCompleted.cs deleted file mode 100644 index 8cff443664ad..000000000000 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCompleted.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.Communication.CallAutomation -{ - /// The PlayCompleted. - public partial class PlayCompleted - { - /// Initializes a new instance of . - internal PlayCompleted() - { - } - } -} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCompletedInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCompletedInternal.Serialization.cs new file mode 100644 index 000000000000..97b5c73b2bce --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCompletedInternal.Serialization.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; + +namespace Azure.Communication.CallAutomation +{ + internal partial class PlayCompletedInternal + { + internal static PlayCompletedInternal DeserializePlayCompletedInternal(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string callConnectionId = default; + string serverCallId = default; + string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("callConnectionId"u8)) + { + callConnectionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("serverCallId"u8)) + { + serverCallId = property.Value.GetString(); + continue; + } + if (property.NameEquals("correlationId"u8)) + { + correlationId = property.Value.GetString(); + continue; + } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } + } + return new PlayCompletedInternal(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static PlayCompletedInternal FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializePlayCompletedInternal(document.RootElement); + } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCompletedInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCompletedInternal.cs new file mode 100644 index 000000000000..16a95b5623b8 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayCompletedInternal.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.CallAutomation +{ + /// The PlayCompleted. + internal partial class PlayCompletedInternal + { + /// Initializes a new instance of . + internal PlayCompletedInternal() + { + } + + /// Initializes a new instance of . + /// Call connection ID. + /// Server call ID. + /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal PlayCompletedInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) + { + CallConnectionId = callConnectionId; + ServerCallId = serverCallId; + CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; + } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeFailed.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayFailedInternal.Serialization.cs similarity index 86% rename from sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeFailed.Serialization.cs rename to sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayFailedInternal.Serialization.cs index 0d12ed0c8931..98b855b1bcd6 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeFailed.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayFailedInternal.Serialization.cs @@ -9,22 +9,37 @@ namespace Azure.Communication.CallAutomation { - public partial class RecognizeFailed + internal partial class PlayFailedInternal { - internal static RecognizeFailed DeserializeRecognizeFailed(JsonElement element) + internal static PlayFailedInternal DeserializePlayFailedInternal(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - string operationContext = default; - ResultInformation resultInformation = default; - int? failedPlaySourceIndex = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; + int? failedPlaySourceIndex = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("callConnectionId"u8)) + { + callConnectionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("serverCallId"u8)) + { + serverCallId = property.Value.GetString(); + continue; + } + if (property.NameEquals("correlationId"u8)) + { + correlationId = property.Value.GetString(); + continue; + } if (property.NameEquals("operationContext"u8)) { operationContext = property.Value.GetString(); @@ -48,37 +63,22 @@ internal static RecognizeFailed DeserializeRecognizeFailed(JsonElement element) failedPlaySourceIndex = property.Value.GetInt32(); continue; } - if (property.NameEquals("callConnectionId"u8)) - { - callConnectionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("serverCallId"u8)) - { - serverCallId = property.Value.GetString(); - continue; - } - if (property.NameEquals("correlationId"u8)) - { - correlationId = property.Value.GetString(); - continue; - } } - return new RecognizeFailed( - operationContext, - resultInformation, - failedPlaySourceIndex, + return new PlayFailedInternal( callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation, + failedPlaySourceIndex); } /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static RecognizeFailed FromResponse(Response response) + internal static PlayFailedInternal FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); - return DeserializeRecognizeFailed(document.RootElement); + return DeserializePlayFailedInternal(document.RootElement); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayFailed.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayFailedInternal.cs similarity index 70% rename from sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayFailed.cs rename to sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayFailedInternal.cs index 9157101f89f3..b030fb7678aa 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayFailed.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayFailedInternal.cs @@ -8,30 +8,30 @@ namespace Azure.Communication.CallAutomation { /// The PlayFailed. - public partial class PlayFailed + internal partial class PlayFailedInternal { - /// Initializes a new instance of . - internal PlayFailed() + /// Initializes a new instance of . + internal PlayFailedInternal() { } - /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. - /// Indicates the index of the failed play source. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal PlayFailed(string operationContext, ResultInformation resultInformation, int? failedPlaySourceIndex, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + /// Contains the index of the failed play source. + internal PlayFailedInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, int? failedPlaySourceIndex) { - OperationContext = operationContext; - ResultInformation = resultInformation; - FailedPlaySourceIndex = failedPlaySourceIndex; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; + FailedPlaySourceIndex = failedPlaySourceIndex; } - /// Indicates the index of the failed play source. + /// Contains the index of the failed play source. public int? FailedPlaySourceIndex { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayPaused.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayPaused.cs new file mode 100644 index 000000000000..96d0d5d4af3f --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayPaused.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.CallAutomation +{ + /// Play started event. + internal partial class PlayPaused + { + /// Initializes a new instance of . + internal PlayPaused() + { + } + + /// Initializes a new instance of . + /// Call connection ID. + /// Server call ID. + /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal PlayPaused(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) + { + CallConnectionId = callConnectionId; + ServerCallId = serverCallId; + CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; + } + + /// 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 mid-call actions to correlate the request to the response event. + public string OperationContext { get; } + /// Contains the resulting SIP code, sub-code and message. + public ResultInformation ResultInformation { get; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayResumed.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayResumed.cs new file mode 100644 index 000000000000..d434c9974b94 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayResumed.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.CallAutomation +{ + /// Play started event. + internal partial class PlayResumed + { + /// Initializes a new instance of . + internal PlayResumed() + { + } + + /// Initializes a new instance of . + /// Call connection ID. + /// Server call ID. + /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal PlayResumed(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) + { + CallConnectionId = callConnectionId; + ServerCallId = serverCallId; + CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; + } + + /// 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 mid-call actions to correlate the request to the response event. + public string OperationContext { get; } + /// Contains the resulting SIP code, sub-code and message. + public ResultInformation ResultInformation { get; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/HoldFailed.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayStarted.Serialization.cs similarity index 85% rename from sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/HoldFailed.Serialization.cs rename to sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayStarted.Serialization.cs index c8ba69d4ac3e..ed624721a9e5 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/HoldFailed.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayStarted.Serialization.cs @@ -9,35 +9,21 @@ namespace Azure.Communication.CallAutomation { - public partial class HoldFailed + public partial class PlayStarted { - internal static HoldFailed DeserializeHoldFailed(JsonElement element) + internal static PlayStarted DeserializePlayStarted(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - string operationContext = default; - ResultInformation resultInformation = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("operationContext"u8)) - { - operationContext = property.Value.GetString(); - continue; - } - if (property.NameEquals("resultInformation"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resultInformation = ResultInformation.DeserializeResultInformation(property.Value); - continue; - } if (property.NameEquals("callConnectionId"u8)) { callConnectionId = property.Value.GetString(); @@ -53,16 +39,30 @@ internal static HoldFailed DeserializeHoldFailed(JsonElement element) correlationId = property.Value.GetString(); continue; } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } } - return new HoldFailed(operationContext, resultInformation, callConnectionId, serverCallId, correlationId); + return new PlayStarted(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); } /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static HoldFailed FromResponse(Response response) + internal static PlayStarted FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); - return DeserializeHoldFailed(document.RootElement); + return DeserializePlayStarted(document.RootElement); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayStarted.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayStarted.cs new file mode 100644 index 000000000000..2e09231978d9 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayStarted.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.CallAutomation +{ + /// Play started event. + public partial class PlayStarted + { + /// Initializes a new instance of . + internal PlayStarted() + { + } + + /// Initializes a new instance of . + /// Call connection ID. + /// Server call ID. + /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal PlayStarted(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) + { + CallConnectionId = callConnectionId; + ServerCallId = serverCallId; + CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; + } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCanceled.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCanceled.Serialization.cs index 51d91445cea8..ba6e8493774c 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCanceled.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCanceled.Serialization.cs @@ -17,17 +17,13 @@ internal static RecognizeCanceled DeserializeRecognizeCanceled(JsonElement eleme { return null; } - string operationContext = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("operationContext"u8)) - { - operationContext = property.Value.GetString(); - continue; - } if (property.NameEquals("callConnectionId"u8)) { callConnectionId = property.Value.GetString(); @@ -43,8 +39,22 @@ internal static RecognizeCanceled DeserializeRecognizeCanceled(JsonElement eleme correlationId = property.Value.GetString(); continue; } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } } - return new RecognizeCanceled(operationContext, callConnectionId, serverCallId, correlationId); + return new RecognizeCanceled(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCanceled.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCanceled.cs index 96e8cf621aad..ad565aa3628f 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCanceled.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCanceled.cs @@ -16,16 +16,18 @@ internal RecognizeCanceled() } /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal RecognizeCanceled(string operationContext, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal RecognizeCanceled(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) { - OperationContext = operationContext; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCompletedInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCompletedInternal.Serialization.cs index aee590596d80..2ce77a6375e0 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCompletedInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCompletedInternal.Serialization.cs @@ -17,18 +17,32 @@ internal static RecognizeCompletedInternal DeserializeRecognizeCompletedInternal { return null; } + string callConnectionId = default; + string serverCallId = default; + string correlationId = default; string operationContext = default; ResultInformation resultInformation = default; CallMediaRecognitionType recognitionType = default; - CollectTonesResult collectTonesResult = default; DtmfResult dtmfResult = default; - SpeechResult speechResult = default; ChoiceResult choiceResult = default; - string callConnectionId = default; - string serverCallId = default; - string correlationId = default; + SpeechResult speechResult = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("callConnectionId"u8)) + { + callConnectionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("serverCallId"u8)) + { + serverCallId = property.Value.GetString(); + continue; + } + if (property.NameEquals("correlationId"u8)) + { + correlationId = property.Value.GetString(); + continue; + } if (property.NameEquals("operationContext"u8)) { operationContext = property.Value.GetString(); @@ -52,15 +66,6 @@ internal static RecognizeCompletedInternal DeserializeRecognizeCompletedInternal recognitionType = new CallMediaRecognitionType(property.Value.GetString()); continue; } - if (property.NameEquals("collectTonesResult"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - collectTonesResult = CollectTonesResult.DeserializeCollectTonesResult(property.Value); - continue; - } if (property.NameEquals("dtmfResult"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -70,51 +75,35 @@ internal static RecognizeCompletedInternal DeserializeRecognizeCompletedInternal dtmfResult = DtmfResult.DeserializeDtmfResult(property.Value); continue; } - if (property.NameEquals("speechResult"u8)) + if (property.NameEquals("choiceResult"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - speechResult = SpeechResult.DeserializeSpeechResult(property.Value); + choiceResult = ChoiceResult.DeserializeChoiceResult(property.Value); continue; } - if (property.NameEquals("choiceResult"u8)) + if (property.NameEquals("speechResult"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - choiceResult = ChoiceResult.DeserializeChoiceResult(property.Value); - continue; - } - if (property.NameEquals("callConnectionId"u8)) - { - callConnectionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("serverCallId"u8)) - { - serverCallId = property.Value.GetString(); - continue; - } - if (property.NameEquals("correlationId"u8)) - { - correlationId = property.Value.GetString(); + speechResult = SpeechResult.DeserializeSpeechResult(property.Value); continue; } } return new RecognizeCompletedInternal( + callConnectionId, + serverCallId, + correlationId, operationContext, resultInformation, recognitionType, - collectTonesResult, dtmfResult, - speechResult, choiceResult, - callConnectionId, - serverCallId, - correlationId); + speechResult); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCompletedInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCompletedInternal.cs index 5ea6ba892e5a..3492a6c8ba21 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCompletedInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeCompletedInternal.cs @@ -16,45 +16,35 @@ internal RecognizeCompletedInternal() } /// Initializes a new instance of . + /// Call connection ID. + /// Server call ID. + /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Result information defines the code, subcode and message. + /// Contains the resulting SIP code, sub-code and message. /// /// Determines the sub-type of the recognize operation. /// In case of cancel operation the this field is not set and is returned empty /// - /// - /// Defines the result for RecognitionType = Dtmf - /// Would be replaced by DtmfResult after server sdk renewed - /// /// Defines the result for RecognitionType = Dtmf. - /// Defines the result for RecognitionType = Speech and SpeechOrDtmf. /// Defines the result for RecognitionType = Choices. - /// Call connection ID. - /// Server call ID. - /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal RecognizeCompletedInternal(string operationContext, ResultInformation resultInformation, CallMediaRecognitionType recognitionType, CollectTonesResult collectTonesResult, DtmfResult dtmfResult, SpeechResult speechResult, ChoiceResult choiceResult, string callConnectionId, string serverCallId, string correlationId) + /// Defines the result for RecognitionType = Speech and SpeechOrDtmf. + internal RecognizeCompletedInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, CallMediaRecognitionType recognitionType, DtmfResult dtmfResult, ChoiceResult choiceResult, SpeechResult speechResult) { + CallConnectionId = callConnectionId; + ServerCallId = serverCallId; + CorrelationId = correlationId; OperationContext = operationContext; ResultInformation = resultInformation; RecognitionType = recognitionType; - CollectTonesResult = collectTonesResult; DtmfResult = dtmfResult; - SpeechResult = speechResult; ChoiceResult = choiceResult; - CallConnectionId = callConnectionId; - ServerCallId = serverCallId; - CorrelationId = correlationId; + SpeechResult = speechResult; } - /// - /// Defines the result for RecognitionType = Dtmf - /// Would be replaced by DtmfResult after server sdk renewed - /// - public CollectTonesResult CollectTonesResult { get; } /// Defines the result for RecognitionType = Dtmf. public DtmfResult DtmfResult { get; } - /// Defines the result for RecognitionType = Speech and SpeechOrDtmf. - public SpeechResult SpeechResult { get; } /// Defines the result for RecognitionType = Choices. public ChoiceResult ChoiceResult { get; } + /// Defines the result for RecognitionType = Speech and SpeechOrDtmf. + public SpeechResult SpeechResult { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayFailed.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeFailedInternal.Serialization.cs similarity index 85% rename from sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayFailed.Serialization.cs rename to sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeFailedInternal.Serialization.cs index 627bba292273..11dc59b640ba 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/PlayFailed.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeFailedInternal.Serialization.cs @@ -9,22 +9,37 @@ namespace Azure.Communication.CallAutomation { - public partial class PlayFailed + internal partial class RecognizeFailedInternal { - internal static PlayFailed DeserializePlayFailed(JsonElement element) + internal static RecognizeFailedInternal DeserializeRecognizeFailedInternal(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - string operationContext = default; - ResultInformation resultInformation = default; - int? failedPlaySourceIndex = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; + int? failedPlaySourceIndex = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("callConnectionId"u8)) + { + callConnectionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("serverCallId"u8)) + { + serverCallId = property.Value.GetString(); + continue; + } + if (property.NameEquals("correlationId"u8)) + { + correlationId = property.Value.GetString(); + continue; + } if (property.NameEquals("operationContext"u8)) { operationContext = property.Value.GetString(); @@ -48,37 +63,22 @@ internal static PlayFailed DeserializePlayFailed(JsonElement element) failedPlaySourceIndex = property.Value.GetInt32(); continue; } - if (property.NameEquals("callConnectionId"u8)) - { - callConnectionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("serverCallId"u8)) - { - serverCallId = property.Value.GetString(); - continue; - } - if (property.NameEquals("correlationId"u8)) - { - correlationId = property.Value.GetString(); - continue; - } } - return new PlayFailed( - operationContext, - resultInformation, - failedPlaySourceIndex, + return new RecognizeFailedInternal( callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation, + failedPlaySourceIndex); } /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static PlayFailed FromResponse(Response response) + internal static RecognizeFailedInternal FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); - return DeserializePlayFailed(document.RootElement); + return DeserializeRecognizeFailedInternal(document.RootElement); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeFailed.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeFailedInternal.cs similarity index 70% rename from sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeFailed.cs rename to sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeFailedInternal.cs index 2f606eb4b0da..62599fe20aa7 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeFailed.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeFailedInternal.cs @@ -8,30 +8,30 @@ namespace Azure.Communication.CallAutomation { /// The RecognizeFailed. - public partial class RecognizeFailed + internal partial class RecognizeFailedInternal { - /// Initializes a new instance of . - internal RecognizeFailed() + /// Initializes a new instance of . + internal RecognizeFailedInternal() { } - /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. - /// Indicates the index of the failed play source. + /// Initializes a new instance of . /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal RecognizeFailed(string operationContext, ResultInformation resultInformation, int? failedPlaySourceIndex, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + /// Contains the index of the failed play source. + internal RecognizeFailedInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, int? failedPlaySourceIndex) { - OperationContext = operationContext; - ResultInformation = resultInformation; - FailedPlaySourceIndex = failedPlaySourceIndex; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; + FailedPlaySourceIndex = failedPlaySourceIndex; } - /// Indicates the index of the failed play source. + /// Contains the index of the failed play source. public int? FailedPlaySourceIndex { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeRequestInternal.Serialization.cs index fbf6716eb523..aa8cc290a6c0 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeRequestInternal.Serialization.cs @@ -28,7 +28,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in PlayPrompts) { - writer.WriteObjectValue(item); + writer.WriteObjectValue(item); } writer.WriteEndArray(); } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeRequestInternal.cs index d6bf12aa353e..385cde631fec 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecognizeRequestInternal.cs @@ -52,8 +52,6 @@ internal RecognizeRequestInternal(RecognizeInputType recognizeInputType, PlaySou public RecognizeInputType RecognizeInputType { get; } /// The source of the audio to be played for recognition. public PlaySourceInternal PlayPrompt { get; set; } - /// The source of the audio to be played for recognition. - public IList PlayPrompts { get; } /// If set recognize can barge into other existing queued-up/currently-processing requests. public bool? InterruptCallMediaOperation { get; set; } /// Defines options for recognition. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingKind.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingKind.cs index 562d055b719c..5aed85365821 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingKind.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingKind.cs @@ -22,15 +22,15 @@ public RecordingKind(string value) _value = value ?? throw new ArgumentNullException(nameof(value)); } - private const string AzureCommunicationServicesValue = "azureCommunicationServices"; - private const string TeamsValue = "teams"; - private const string TeamsComplianceValue = "teamsCompliance"; + private const string AzureCommunicationServicesValue = "AzureCommunicationServices"; + private const string TeamsValue = "Teams"; + private const string TeamsComplianceValue = "TeamsCompliance"; - /// azureCommunicationServices. + /// Recording initiated by Azure Communication Services. public static RecordingKind AzureCommunicationServices { get; } = new RecordingKind(AzureCommunicationServicesValue); - /// teams. + /// Recording initiated by Teams user. public static RecordingKind Teams { get; } = new RecordingKind(TeamsValue); - /// teamsCompliance. + /// Recording initiated by Teams compliance policy. public static RecordingKind TeamsCompliance { get; } = new RecordingKind(TeamsComplianceValue); /// Determines if two values are the same. public static bool operator ==(RecordingKind left, RecordingKind right) => left.Equals(right); diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingStateChanged.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingStateChanged.Serialization.cs index 13e303e5007d..6e5fda422ccd 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingStateChanged.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingStateChanged.Serialization.cs @@ -18,15 +18,31 @@ internal static RecordingStateChanged DeserializeRecordingStateChanged(JsonEleme { return null; } + string callConnectionId = default; + string serverCallId = default; + string correlationId = default; string recordingId = default; RecordingState state = default; DateTimeOffset? startDateTime = default; RecordingKind? recordingKind = default; - string callConnectionId = default; - string serverCallId = default; - string correlationId = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("callConnectionId"u8)) + { + callConnectionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("serverCallId"u8)) + { + serverCallId = property.Value.GetString(); + continue; + } + if (property.NameEquals("correlationId"u8)) + { + correlationId = property.Value.GetString(); + continue; + } if (property.NameEquals("recordingId"u8)) { recordingId = property.Value.GetString(); @@ -59,30 +75,25 @@ internal static RecordingStateChanged DeserializeRecordingStateChanged(JsonEleme recordingKind = new RecordingKind(property.Value.GetString()); continue; } - if (property.NameEquals("callConnectionId"u8)) - { - callConnectionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("serverCallId"u8)) - { - serverCallId = property.Value.GetString(); - continue; - } - if (property.NameEquals("correlationId"u8)) + if (property.NameEquals("resultInformation"u8)) { - correlationId = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); continue; } } return new RecordingStateChanged( + callConnectionId, + serverCallId, + correlationId, recordingId, state, startDateTime, recordingKind, - callConnectionId, - serverCallId, - correlationId); + resultInformation); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingStateChanged.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingStateChanged.cs index 96ec50f96149..615e36a463fc 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingStateChanged.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingStateChanged.cs @@ -18,24 +18,25 @@ internal RecordingStateChanged() } /// Initializes a new instance of . + /// Call connection ID. + /// Server call ID. + /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. /// The call recording id. /// /// The time of the recording started. /// - /// Call connection ID. - /// Server call ID. - /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal RecordingStateChanged(string recordingId, RecordingState state, DateTimeOffset? startDateTime, RecordingKind? recordingKind, string callConnectionId, string serverCallId, string correlationId) + /// Contains the resulting SIP code, sub-code and message. + internal RecordingStateChanged(string callConnectionId, string serverCallId, string correlationId, string recordingId, RecordingState state, DateTimeOffset? startDateTime, RecordingKind? recordingKind, ResultInformation resultInformation) { + CallConnectionId = callConnectionId; + ServerCallId = serverCallId; + CorrelationId = correlationId; RecordingId = recordingId; State = state; StartDateTime = startDateTime; RecordingKind = recordingKind; - CallConnectionId = callConnectionId; - ServerCallId = serverCallId; - CorrelationId = correlationId; + ResultInformation = resultInformation; } - /// The call recording id. public string RecordingId { get; } /// The time of the recording started. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingStorageKind.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingStorageKind.cs index a02689765a5d..7393cf71c80a 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingStorageKind.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RecordingStorageKind.cs @@ -22,12 +22,12 @@ public RecordingStorageKind(string value) _value = value ?? throw new ArgumentNullException(nameof(value)); } - private const string AzureCommunicationServicesValue = "azureCommunicationServices"; - private const string AzureBlobStorageValue = "azureBlobStorage"; + private const string AzureCommunicationServicesValue = "AzureCommunicationServices"; + private const string AzureBlobStorageValue = "AzureBlobStorage"; - /// azureCommunicationServices. + /// Storage managed by Azure Communication Services. public static RecordingStorageKind AzureCommunicationServices { get; } = new RecordingStorageKind(AzureCommunicationServicesValue); - /// azureBlobStorage. + /// Storage managed by provided Azure blob. public static RecordingStorageKind AzureBlobStorage { get; } = new RecordingStorageKind(AzureBlobStorageValue); /// Determines if two values are the same. public static bool operator ==(RecordingStorageKind left, RecordingStorageKind right) => left.Equals(right); diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantFailedInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantFailedInternal.Serialization.cs index 0a4dab8877d0..b4f8caf52d73 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantFailedInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantFailedInternal.Serialization.cs @@ -17,14 +17,29 @@ internal static RemoveParticipantFailedInternal DeserializeRemoveParticipantFail { return null; } - string operationContext = default; - ResultInformation resultInformation = default; - CommunicationIdentifierModel participant = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; + CommunicationIdentifierModel participant = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("callConnectionId"u8)) + { + callConnectionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("serverCallId"u8)) + { + serverCallId = property.Value.GetString(); + continue; + } + if (property.NameEquals("correlationId"u8)) + { + correlationId = property.Value.GetString(); + continue; + } if (property.NameEquals("operationContext"u8)) { operationContext = property.Value.GetString(); @@ -48,29 +63,14 @@ internal static RemoveParticipantFailedInternal DeserializeRemoveParticipantFail participant = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); continue; } - if (property.NameEquals("callConnectionId"u8)) - { - callConnectionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("serverCallId"u8)) - { - serverCallId = property.Value.GetString(); - continue; - } - if (property.NameEquals("correlationId"u8)) - { - correlationId = property.Value.GetString(); - continue; - } } return new RemoveParticipantFailedInternal( - operationContext, - resultInformation, - participant, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation, + participant); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantFailedInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantFailedInternal.cs index 7cd0fd454f14..c3c4bffe5f5d 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantFailedInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantFailedInternal.cs @@ -16,33 +16,33 @@ internal RemoveParticipantFailedInternal() } /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. - /// Participant. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal RemoveParticipantFailedInternal(string operationContext, ResultInformation resultInformation, CommunicationIdentifierModel participant, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + /// Participant. + internal RemoveParticipantFailedInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, CommunicationIdentifierModel participant) { - OperationContext = operationContext; - ResultInformation = resultInformation; - Participant = participant; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; + Participant = participant; } - /// Used by customers when calling mid-call actions to correlate the request to the response event. - public string OperationContext { get; } - /// Contains the resulting SIP code, sub-code and message. - public ResultInformation ResultInformation { get; } - /// Participant. - public CommunicationIdentifierModel Participant { get; } /// 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 mid-call actions to correlate the request to the response event. + public string OperationContext { get; } + /// Contains the resulting SIP code, sub-code and message. + public ResultInformation ResultInformation { get; } + /// Participant. + public CommunicationIdentifierModel Participant { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantSucceededInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantSucceededInternal.Serialization.cs index 9bbffbe929fb..06fe51f9aefe 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantSucceededInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantSucceededInternal.Serialization.cs @@ -17,14 +17,29 @@ internal static RemoveParticipantSucceededInternal DeserializeRemoveParticipantS { return null; } - string operationContext = default; - ResultInformation resultInformation = default; - CommunicationIdentifierModel participant = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; + CommunicationIdentifierModel participant = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("callConnectionId"u8)) + { + callConnectionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("serverCallId"u8)) + { + serverCallId = property.Value.GetString(); + continue; + } + if (property.NameEquals("correlationId"u8)) + { + correlationId = property.Value.GetString(); + continue; + } if (property.NameEquals("operationContext"u8)) { operationContext = property.Value.GetString(); @@ -48,29 +63,14 @@ internal static RemoveParticipantSucceededInternal DeserializeRemoveParticipantS participant = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); continue; } - if (property.NameEquals("callConnectionId"u8)) - { - callConnectionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("serverCallId"u8)) - { - serverCallId = property.Value.GetString(); - continue; - } - if (property.NameEquals("correlationId"u8)) - { - correlationId = property.Value.GetString(); - continue; - } } return new RemoveParticipantSucceededInternal( - operationContext, - resultInformation, - participant, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation, + participant); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantSucceededInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantSucceededInternal.cs index 55af488e2748..1839a2db3878 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantSucceededInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantSucceededInternal.cs @@ -16,33 +16,33 @@ internal RemoveParticipantSucceededInternal() } /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. - /// Participant. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal RemoveParticipantSucceededInternal(string operationContext, ResultInformation resultInformation, CommunicationIdentifierModel participant, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + /// Participant. + internal RemoveParticipantSucceededInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation, CommunicationIdentifierModel participant) { - OperationContext = operationContext; - ResultInformation = resultInformation; - Participant = participant; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; + Participant = participant; } - /// Used by customers when calling mid-call actions to correlate the request to the response event. - public string OperationContext { get; } - /// Contains the resulting SIP code, sub-code and message. - public ResultInformation ResultInformation { get; } - /// Participant. - public CommunicationIdentifierModel Participant { get; } /// 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 mid-call actions to correlate the request to the response event. + public string OperationContext { get; } + /// Contains the resulting SIP code, sub-code and message. + public ResultInformation ResultInformation { get; } + /// Participant. + public CommunicationIdentifierModel Participant { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfTonesCompletedInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfTonesCompletedInternal.Serialization.cs index f98acbc0cc3c..f4b5733fd909 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfTonesCompletedInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfTonesCompletedInternal.Serialization.cs @@ -17,27 +17,13 @@ internal static SendDtmfTonesCompletedInternal DeserializeSendDtmfTonesCompleted { return null; } - string operationContext = default; - ResultInformation resultInformation = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("operationContext"u8)) - { - operationContext = property.Value.GetString(); - continue; - } - if (property.NameEquals("resultInformation"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resultInformation = ResultInformation.DeserializeResultInformation(property.Value); - continue; - } if (property.NameEquals("callConnectionId"u8)) { callConnectionId = property.Value.GetString(); @@ -53,8 +39,22 @@ internal static SendDtmfTonesCompletedInternal DeserializeSendDtmfTonesCompleted correlationId = property.Value.GetString(); continue; } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } } - return new SendDtmfTonesCompletedInternal(operationContext, resultInformation, callConnectionId, serverCallId, correlationId); + return new SendDtmfTonesCompletedInternal(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfTonesCompletedInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfTonesCompletedInternal.cs index 10c329b60036..0d7ed430172d 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfTonesCompletedInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfTonesCompletedInternal.cs @@ -16,29 +16,29 @@ internal SendDtmfTonesCompletedInternal() } /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal SendDtmfTonesCompletedInternal(string operationContext, ResultInformation resultInformation, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal SendDtmfTonesCompletedInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) { - OperationContext = operationContext; - ResultInformation = resultInformation; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; } - /// Used by customers when calling mid-call actions to correlate the request to the response event. - public string OperationContext { get; } - /// Contains the resulting SIP code, sub-code and message. - public ResultInformation ResultInformation { get; } /// 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 mid-call actions to correlate the request to the response event. + public string OperationContext { get; } + /// Contains the resulting SIP code, sub-code and message. + public ResultInformation ResultInformation { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfTonesFailedInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfTonesFailedInternal.Serialization.cs index f89702fc1745..1e63b057b14b 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfTonesFailedInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfTonesFailedInternal.Serialization.cs @@ -17,27 +17,13 @@ internal static SendDtmfTonesFailedInternal DeserializeSendDtmfTonesFailedIntern { return null; } - string operationContext = default; - ResultInformation resultInformation = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("operationContext"u8)) - { - operationContext = property.Value.GetString(); - continue; - } - if (property.NameEquals("resultInformation"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resultInformation = ResultInformation.DeserializeResultInformation(property.Value); - continue; - } if (property.NameEquals("callConnectionId"u8)) { callConnectionId = property.Value.GetString(); @@ -53,8 +39,22 @@ internal static SendDtmfTonesFailedInternal DeserializeSendDtmfTonesFailedIntern correlationId = property.Value.GetString(); continue; } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } } - return new SendDtmfTonesFailedInternal(operationContext, resultInformation, callConnectionId, serverCallId, correlationId); + return new SendDtmfTonesFailedInternal(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfTonesFailedInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfTonesFailedInternal.cs index 8c9ed39de7d8..e416f3434cd8 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfTonesFailedInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SendDtmfTonesFailedInternal.cs @@ -16,29 +16,29 @@ internal SendDtmfTonesFailedInternal() } /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal SendDtmfTonesFailedInternal(string operationContext, ResultInformation resultInformation, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal SendDtmfTonesFailedInternal(string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) { - OperationContext = operationContext; - ResultInformation = resultInformation; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; } - /// Used by customers when calling mid-call actions to correlate the request to the response event. - public string OperationContext { get; } - /// Contains the resulting SIP code, sub-code and message. - public ResultInformation ResultInformation { get; } /// 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 mid-call actions to correlate the request to the response event. + public string OperationContext { get; } + /// Contains the resulting SIP code, sub-code and message. + public ResultInformation ResultInformation { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SpeechResult.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SpeechResult.cs index 5ebcb61e3f2f..2feae855de0e 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SpeechResult.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/SpeechResult.cs @@ -7,7 +7,7 @@ namespace Azure.Communication.CallAutomation { - /// The speech recognition status as a result. + /// The speech status as a result. public partial class SpeechResult { /// Initializes a new instance of . diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartCallRecordingRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartCallRecordingRequestInternal.Serialization.cs index d0c10c77fbae..7a62d8cf9850 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartCallRecordingRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartCallRecordingRequestInternal.Serialization.cs @@ -15,8 +15,16 @@ internal partial class StartCallRecordingRequestInternal : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - writer.WritePropertyName("callLocator"u8); - writer.WriteObjectValue(CallLocator); + if (Optional.IsDefined(CallLocator)) + { + writer.WritePropertyName("callLocator"u8); + writer.WriteObjectValue(CallLocator); + } + if (Optional.IsDefined(CallConnectionId)) + { + writer.WritePropertyName("callConnectionId"u8); + writer.WriteStringValue(CallConnectionId); + } if (Optional.IsDefined(RecordingStateCallbackUri)) { writer.WritePropertyName("recordingStateCallbackUri"u8); @@ -57,16 +65,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } - if (Optional.IsDefined(ExternalStorage)) - { - writer.WritePropertyName("externalStorage"u8); - writer.WriteObjectValue(ExternalStorage); - } if (Optional.IsDefined(PauseOnStart)) { writer.WritePropertyName("pauseOnStart"u8); writer.WriteBooleanValue(PauseOnStart.Value); } + if (Optional.IsDefined(ExternalStorage)) + { + writer.WritePropertyName("externalStorage"u8); + writer.WriteObjectValue(ExternalStorage); + } writer.WriteEndObject(); } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartCallRecordingRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartCallRecordingRequestInternal.cs index d184fc58f9a1..32fc0069be27 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartCallRecordingRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartCallRecordingRequestInternal.cs @@ -5,7 +5,6 @@ #nullable disable -using System; using System.Collections.Generic; namespace Azure.Communication.CallAutomation @@ -14,19 +13,15 @@ namespace Azure.Communication.CallAutomation internal partial class StartCallRecordingRequestInternal { /// Initializes a new instance of . - /// The call locator. - /// is null. - public StartCallRecordingRequestInternal(CallLocatorInternal callLocator) + public StartCallRecordingRequestInternal() { - Argument.AssertNotNull(callLocator, nameof(callLocator)); - - CallLocator = callLocator; AudioChannelParticipantOrdering = new ChangeTrackingList(); ChannelAffinity = new ChangeTrackingList(); } /// Initializes a new instance of . - /// The call locator. + /// The call locator. (Only one of callLocator or callConnectionId to be used). + /// The call connectionId. (Only one of callLocator or callConnectionId to be used). /// The uri to send notifications to. /// The content type of call recording. /// The channel type of call recording. @@ -43,23 +38,26 @@ public StartCallRecordingRequestInternal(CallLocatorInternal callLocator) /// Channel-Participant mapping details can be found in the metadata of the recording. /// /// /// - /// Optional property to specify location where recording will be stored. /// When set to true will start recording in Pause mode, which can be resumed. - internal StartCallRecordingRequestInternal(CallLocatorInternal callLocator, string recordingStateCallbackUri, RecordingContent? recordingContentType, RecordingChannel? recordingChannelType, RecordingFormat? recordingFormatType, IList audioChannelParticipantOrdering, IList channelAffinity, RecordingStorageInternal externalStorage, bool? pauseOnStart) + /// Optional property to specify location where recording will be stored. + internal StartCallRecordingRequestInternal(CallLocatorInternal callLocator, string callConnectionId, string recordingStateCallbackUri, RecordingContent? recordingContentType, RecordingChannel? recordingChannelType, RecordingFormat? recordingFormatType, IList audioChannelParticipantOrdering, IList channelAffinity, bool? pauseOnStart, RecordingStorageInternal externalStorage) { CallLocator = callLocator; + CallConnectionId = callConnectionId; RecordingStateCallbackUri = recordingStateCallbackUri; RecordingContentType = recordingContentType; RecordingChannelType = recordingChannelType; RecordingFormatType = recordingFormatType; AudioChannelParticipantOrdering = audioChannelParticipantOrdering; ChannelAffinity = channelAffinity; - ExternalStorage = externalStorage; PauseOnStart = pauseOnStart; + ExternalStorage = externalStorage; } - /// The call locator. - public CallLocatorInternal CallLocator { get; } + /// The call locator. (Only one of callLocator or callConnectionId to be used). + public CallLocatorInternal CallLocator { get; set; } + /// The call connectionId. (Only one of callLocator or callConnectionId to be used). + public string CallConnectionId { get; set; } /// The uri to send notifications to. public string RecordingStateCallbackUri { get; set; } /// The content type of call recording. @@ -82,9 +80,9 @@ internal StartCallRecordingRequestInternal(CallLocatorInternal callLocator, stri /// /// /// public IList ChannelAffinity { get; } - /// Optional property to specify location where recording will be stored. - public RecordingStorageInternal ExternalStorage { get; set; } /// When set to true will start recording in Pause mode, which can be resumed. public bool? PauseOnStart { get; set; } + /// Optional property to specify location where recording will be stored. + public RecordingStorageInternal ExternalStorage { get; set; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartHoldMusicRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartHoldMusicRequestInternal.cs deleted file mode 100644 index 8bffe328b248..000000000000 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartHoldMusicRequestInternal.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.Communication.CallAutomation -{ - /// The request payload for holding participant from the call. - internal partial class StartHoldMusicRequestInternal - { - /// Initializes a new instance of . - /// Participant to be held from the call. - /// is null. - public StartHoldMusicRequestInternal(CommunicationIdentifierModel targetParticipant) - { - Argument.AssertNotNull(targetParticipant, nameof(targetParticipant)); - - TargetParticipant = targetParticipant; - } - - /// Initializes a new instance of . - /// Participant to be held from the call. - /// Prompt to play while in hold. - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// - /// 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. - /// - internal StartHoldMusicRequestInternal(CommunicationIdentifierModel targetParticipant, PlaySourceInternal playSourceInfo, string operationContext, string operationCallbackUri) - { - TargetParticipant = targetParticipant; - PlaySourceInfo = playSourceInfo; - OperationContext = operationContext; - OperationCallbackUri = operationCallbackUri; - } - - /// Participant to be held from the call. - public CommunicationIdentifierModel TargetParticipant { get; } - /// Prompt to play while in hold. - public PlaySourceInternal PlaySourceInfo { get; set; } - /// Used by customers when calling mid-call actions to correlate the request to the response event. - public string OperationContext { get; set; } - /// - /// 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. - /// - public string OperationCallbackUri { get; set; } - } -} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartRecordingFailed.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartRecordingFailed.cs new file mode 100644 index 000000000000..c5b283db838f --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartRecordingFailed.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.CallAutomation +{ + /// The StartRecordingFailed. + internal partial class StartRecordingFailed + { + /// Initializes a new instance of . + internal StartRecordingFailed() + { + } + + /// Initializes a new instance of . + /// Call connection ID. + /// Correlation ID for event to call correlation. + /// The call recording id. + internal StartRecordingFailed(string callConnectionId, string correlationId, string recordingId) + { + CallConnectionId = callConnectionId; + CorrelationId = correlationId; + RecordingId = recordingId; + } + + /// Call connection ID. + public string CallConnectionId { get; } + /// Correlation ID for event to call correlation. + public string CorrelationId { get; } + /// The call recording id. + public string RecordingId { get; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartTranscriptionRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartTranscriptionRequestInternal.Serialization.cs index 297f08fb1e8f..41c6a2c387e3 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartTranscriptionRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartTranscriptionRequestInternal.Serialization.cs @@ -20,11 +20,21 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("locale"u8); writer.WriteStringValue(Locale); } + if (Optional.IsDefined(SpeechRecognitionModelEndpointId)) + { + writer.WritePropertyName("speechRecognitionModelEndpointId"u8); + writer.WriteStringValue(SpeechRecognitionModelEndpointId); + } if (Optional.IsDefined(OperationContext)) { writer.WritePropertyName("operationContext"u8); writer.WriteStringValue(OperationContext); } + if (Optional.IsDefined(OperationCallbackUri)) + { + writer.WritePropertyName("operationCallbackUri"u8); + writer.WriteStringValue(OperationCallbackUri); + } writer.WriteEndObject(); } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartTranscriptionRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartTranscriptionRequestInternal.cs index 66e0e10735a0..077222ebcdc2 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartTranscriptionRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StartTranscriptionRequestInternal.cs @@ -17,16 +17,30 @@ public StartTranscriptionRequestInternal() /// Initializes a new instance of . /// Defines Locale for the transcription e,g en-US. + /// Endpoint where the custom model was deployed. /// The value to identify context of the operation. - internal StartTranscriptionRequestInternal(string locale, string operationContext) + /// + /// 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. + /// + internal StartTranscriptionRequestInternal(string locale, string speechRecognitionModelEndpointId, string operationContext, string operationCallbackUri) { Locale = locale; + SpeechRecognitionModelEndpointId = speechRecognitionModelEndpointId; OperationContext = operationContext; + OperationCallbackUri = operationCallbackUri; } /// Defines Locale for the transcription e,g en-US. public string Locale { get; set; } + /// Endpoint where the custom model was deployed. + public string SpeechRecognitionModelEndpointId { get; set; } /// The value to identify context of the operation. public string OperationContext { get; set; } + /// + /// 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. + /// + public string OperationCallbackUri { get; set; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopHoldMusicRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopHoldMusicRequestInternal.cs deleted file mode 100644 index a421aa72e9fa..000000000000 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopHoldMusicRequestInternal.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.Communication.CallAutomation -{ - /// The request payload for holding participant from the call. - internal partial class StopHoldMusicRequestInternal - { - /// Initializes a new instance of . - /// - /// 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; - } - - /// Initializes a new instance of . - /// - /// Participants to be hold from the call. - /// Only ACS Users are supported. - /// - /// Used by customers when calling mid-call actions to correlate the request to the response event. - internal StopHoldMusicRequestInternal(CommunicationIdentifierModel targetParticipant, string operationContext) - { - TargetParticipant = targetParticipant; - OperationContext = operationContext; - } - - /// - /// 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/StopMediaStreamingRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopMediaStreamingRequestInternal.Serialization.cs index 8f11e7ee6c5e..8e10ecbcac9d 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopMediaStreamingRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopMediaStreamingRequestInternal.Serialization.cs @@ -20,6 +20,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("operationCallbackUri"u8); writer.WriteStringValue(OperationCallbackUri); } + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } writer.WriteEndObject(); } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopMediaStreamingRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopMediaStreamingRequestInternal.cs index 015ec0467a8e..8437d2f394b0 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopMediaStreamingRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopMediaStreamingRequestInternal.cs @@ -20,9 +20,11 @@ public StopMediaStreamingRequestInternal() /// 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. /// - internal StopMediaStreamingRequestInternal(string operationCallbackUri) + /// The value to identify context of the operation. + internal StopMediaStreamingRequestInternal(string operationCallbackUri, string operationContext) { OperationCallbackUri = operationCallbackUri; + OperationContext = operationContext; } /// @@ -30,5 +32,7 @@ internal StopMediaStreamingRequestInternal(string operationCallbackUri) /// This setup is per-action. If this is not set, the default callback URI set by CreateCall/AnswerCall will be used. /// public string OperationCallbackUri { 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/StopTranscriptionRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopTranscriptionRequestInternal.Serialization.cs index 2ed80f343f88..5fb29980b922 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopTranscriptionRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopTranscriptionRequestInternal.Serialization.cs @@ -20,6 +20,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("operationContext"u8); writer.WriteStringValue(OperationContext); } + if (Optional.IsDefined(OperationCallbackUri)) + { + writer.WritePropertyName("operationCallbackUri"u8); + writer.WriteStringValue(OperationCallbackUri); + } writer.WriteEndObject(); } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopTranscriptionRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopTranscriptionRequestInternal.cs index b7155839ed26..4e4376055599 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopTranscriptionRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/StopTranscriptionRequestInternal.cs @@ -17,12 +17,22 @@ public StopTranscriptionRequestInternal() /// Initializes a new instance of . /// The value to identify context of the operation. - internal StopTranscriptionRequestInternal(string operationContext) + /// + /// 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. + /// + internal StopTranscriptionRequestInternal(string operationContext, string operationCallbackUri) { OperationContext = operationContext; + OperationCallbackUri = operationCallbackUri; } /// The value to identify context of the operation. public string OperationContext { get; set; } + /// + /// 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. + /// + public string OperationCallbackUri { get; set; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionFailed.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionFailed.Serialization.cs index 556a03c10254..ed17ac07b872 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionFailed.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionFailed.Serialization.cs @@ -17,28 +17,14 @@ internal static TranscriptionFailed DeserializeTranscriptionFailed(JsonElement e { return null; } - string operationContext = default; - ResultInformation resultInformation = default; TranscriptionUpdate transcriptionUpdate = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("operationContext"u8)) - { - operationContext = property.Value.GetString(); - continue; - } - if (property.NameEquals("resultInformation"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resultInformation = ResultInformation.DeserializeResultInformation(property.Value); - continue; - } if (property.NameEquals("transcriptionUpdate"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -63,14 +49,28 @@ internal static TranscriptionFailed DeserializeTranscriptionFailed(JsonElement e correlationId = property.Value.GetString(); continue; } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } } return new TranscriptionFailed( - operationContext, - resultInformation, transcriptionUpdate, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionFailed.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionFailed.cs index ee7c5e3a0d5d..2e9db7b9f1b1 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionFailed.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionFailed.cs @@ -16,21 +16,22 @@ internal TranscriptionFailed() } /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. /// Defines the result for TranscriptionUpdate with the current status and the details about the status. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal TranscriptionFailed(string operationContext, ResultInformation resultInformation, TranscriptionUpdate transcriptionUpdate, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal TranscriptionFailed(TranscriptionUpdate transcriptionUpdate, string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) { - OperationContext = operationContext; - ResultInformation = resultInformation; TranscriptionUpdate = transcriptionUpdate; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; } + /// Defines the result for TranscriptionUpdate with the current status and the details about the status. public TranscriptionUpdate TranscriptionUpdate { get; } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionOptionsInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionOptionsInternal.Serialization.cs index 351e4109d2ce..d87b20b619a9 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionOptionsInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionOptionsInternal.Serialization.cs @@ -21,8 +21,18 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(TransportType.ToString()); writer.WritePropertyName("locale"u8); writer.WriteStringValue(Locale); + if (Optional.IsDefined(SpeechRecognitionModelEndpointId)) + { + writer.WritePropertyName("speechRecognitionModelEndpointId"u8); + writer.WriteStringValue(SpeechRecognitionModelEndpointId); + } writer.WritePropertyName("startTranscription"u8); writer.WriteBooleanValue(StartTranscription); + if (Optional.IsDefined(EnableIntermediateResults)) + { + writer.WritePropertyName("enableIntermediateResults"u8); + writer.WriteBooleanValue(EnableIntermediateResults.Value); + } writer.WriteEndObject(); } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionOptionsInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionOptionsInternal.cs index 042896478b48..5e2879750900 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionOptionsInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionOptionsInternal.cs @@ -29,13 +29,34 @@ public TranscriptionOptionsInternal(string transportUrl, TranscriptionTransport StartTranscription = startTranscription; } + /// Initializes a new instance of . + /// Transport URL for live transcription. + /// The type of transport to be used for live transcription, eg. Websocket. + /// Defines the locale for the data e.g en-CA, en-AU. + /// Endpoint where the custom model was deployed. + /// Determines if the transcription should be started immediately after call is answered or not. + /// Enables intermediate results for the transcribed speech. + internal TranscriptionOptionsInternal(string transportUrl, TranscriptionTransport transportType, string locale, string speechRecognitionModelEndpointId, bool startTranscription, bool? enableIntermediateResults) + { + TransportUrl = transportUrl; + TransportType = transportType; + Locale = locale; + SpeechRecognitionModelEndpointId = speechRecognitionModelEndpointId; + StartTranscription = startTranscription; + EnableIntermediateResults = enableIntermediateResults; + } + /// Transport URL for live transcription. public string TransportUrl { get; } /// The type of transport to be used for live transcription, eg. Websocket. public TranscriptionTransport TransportType { get; } /// Defines the locale for the data e.g en-CA, en-AU. public string Locale { get; } + /// Endpoint where the custom model was deployed. + public string SpeechRecognitionModelEndpointId { get; set; } /// Determines if the transcription should be started immediately after call is answered or not. public bool StartTranscription { get; } + /// Enables intermediate results for the transcribed speech. + public bool? EnableIntermediateResults { get; set; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionResultState.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionResultState.cs new file mode 100644 index 000000000000..182f241dd5d2 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionResultState.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Communication.CallAutomation +{ + /// The TranscriptionResultType. + public readonly partial struct TranscriptionResultState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TranscriptionResultState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string FinalValue = "final"; + private const string IntermediateValue = "intermediate"; + + /// final. + public static TranscriptionResultState Final { get; } = new TranscriptionResultState(FinalValue); + /// intermediate. + public static TranscriptionResultState Intermediate { get; } = new TranscriptionResultState(IntermediateValue); + /// Determines if two values are the same. + public static bool operator ==(TranscriptionResultState left, TranscriptionResultState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TranscriptionResultState left, TranscriptionResultState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator TranscriptionResultState(string value) => new TranscriptionResultState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TranscriptionResultState other && Equals(other); + /// + public bool Equals(TranscriptionResultState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionStarted.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionStarted.Serialization.cs index 0cafb2a429d2..0ce6f440e589 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionStarted.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionStarted.Serialization.cs @@ -17,28 +17,14 @@ internal static TranscriptionStarted DeserializeTranscriptionStarted(JsonElement { return null; } - string operationContext = default; - ResultInformation resultInformation = default; TranscriptionUpdate transcriptionUpdate = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("operationContext"u8)) - { - operationContext = property.Value.GetString(); - continue; - } - if (property.NameEquals("resultInformation"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resultInformation = ResultInformation.DeserializeResultInformation(property.Value); - continue; - } if (property.NameEquals("transcriptionUpdate"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -63,14 +49,28 @@ internal static TranscriptionStarted DeserializeTranscriptionStarted(JsonElement correlationId = property.Value.GetString(); continue; } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } } return new TranscriptionStarted( - operationContext, - resultInformation, transcriptionUpdate, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionStarted.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionStarted.cs index 717e1bc76d55..08783c93ce44 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionStarted.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionStarted.cs @@ -16,21 +16,22 @@ internal TranscriptionStarted() } /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. /// Defines the result for TranscriptionUpdate with the current status and the details about the status. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal TranscriptionStarted(string operationContext, ResultInformation resultInformation, TranscriptionUpdate transcriptionUpdate, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal TranscriptionStarted(TranscriptionUpdate transcriptionUpdate, string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) { - OperationContext = operationContext; - ResultInformation = resultInformation; TranscriptionUpdate = transcriptionUpdate; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; } + /// Defines the result for TranscriptionUpdate with the current status and the details about the status. public TranscriptionUpdate TranscriptionUpdate { get; } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionStopped.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionStopped.Serialization.cs index 50f59bf7a0b3..ba92365608a4 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionStopped.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionStopped.Serialization.cs @@ -17,28 +17,14 @@ internal static TranscriptionStopped DeserializeTranscriptionStopped(JsonElement { return null; } - string operationContext = default; - ResultInformation resultInformation = default; TranscriptionUpdate transcriptionUpdate = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("operationContext"u8)) - { - operationContext = property.Value.GetString(); - continue; - } - if (property.NameEquals("resultInformation"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resultInformation = ResultInformation.DeserializeResultInformation(property.Value); - continue; - } if (property.NameEquals("transcriptionUpdate"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -63,14 +49,28 @@ internal static TranscriptionStopped DeserializeTranscriptionStopped(JsonElement correlationId = property.Value.GetString(); continue; } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } } return new TranscriptionStopped( - operationContext, - resultInformation, transcriptionUpdate, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionStopped.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionStopped.cs index f5bbf382776e..f65945b9b940 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionStopped.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionStopped.cs @@ -16,21 +16,22 @@ internal TranscriptionStopped() } /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. /// Defines the result for TranscriptionUpdate with the current status and the details about the status. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal TranscriptionStopped(string operationContext, ResultInformation resultInformation, TranscriptionUpdate transcriptionUpdate, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal TranscriptionStopped(TranscriptionUpdate transcriptionUpdate, string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) { - OperationContext = operationContext; - ResultInformation = resultInformation; TranscriptionUpdate = transcriptionUpdate; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; } + /// Defines the result for TranscriptionUpdate with the current status and the details about the status. public TranscriptionUpdate TranscriptionUpdate { get; } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionSubscriptionInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionSubscriptionInternal.Serialization.cs new file mode 100644 index 000000000000..beeb42e75602 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionSubscriptionInternal.Serialization.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; + +namespace Azure.Communication.CallAutomation +{ + internal partial class TranscriptionSubscriptionInternal + { + internal static TranscriptionSubscriptionInternal DeserializeTranscriptionSubscriptionInternal(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + TranscriptionSubscriptionState? state = default; + IReadOnlyList subscribedResultTypes = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("state"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new TranscriptionSubscriptionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("subscribedResultTypes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new TranscriptionResultState(item.GetString())); + } + subscribedResultTypes = array; + continue; + } + } + return new TranscriptionSubscriptionInternal(id, state, subscribedResultTypes ?? new ChangeTrackingList()); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static TranscriptionSubscriptionInternal FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTranscriptionSubscriptionInternal(document.RootElement); + } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionSubscriptionInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionSubscriptionInternal.cs new file mode 100644 index 000000000000..253f6d4abd65 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionSubscriptionInternal.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.Communication.CallAutomation +{ + /// Transcription Subscription Object. + internal partial class TranscriptionSubscriptionInternal + { + /// Initializes a new instance of . + internal TranscriptionSubscriptionInternal() + { + SubscribedResultTypes = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Subscription Id. + /// Transcription subscription state. + /// Subscribed transcription result types. + internal TranscriptionSubscriptionInternal(string id, TranscriptionSubscriptionState? state, IReadOnlyList subscribedResultTypes) + { + Id = id; + State = state; + SubscribedResultTypes = subscribedResultTypes; + } + + /// Subscription Id. + public string Id { get; } + /// Transcription subscription state. + public TranscriptionSubscriptionState? State { get; } + /// Subscribed transcription result types. + public IReadOnlyList SubscribedResultTypes { get; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionSubscriptionState.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionSubscriptionState.cs new file mode 100644 index 000000000000..14b1df831ff0 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionSubscriptionState.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Communication.CallAutomation +{ + /// Transcription subscription state. + public readonly partial struct TranscriptionSubscriptionState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TranscriptionSubscriptionState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DisabledValue = "disabled"; + private const string InactiveValue = "inactive"; + private const string ActiveValue = "active"; + + /// disabled. + public static TranscriptionSubscriptionState Disabled { get; } = new TranscriptionSubscriptionState(DisabledValue); + /// inactive. + public static TranscriptionSubscriptionState Inactive { get; } = new TranscriptionSubscriptionState(InactiveValue); + /// active. + public static TranscriptionSubscriptionState Active { get; } = new TranscriptionSubscriptionState(ActiveValue); + /// Determines if two values are the same. + public static bool operator ==(TranscriptionSubscriptionState left, TranscriptionSubscriptionState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TranscriptionSubscriptionState left, TranscriptionSubscriptionState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator TranscriptionSubscriptionState(string value) => new TranscriptionSubscriptionState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TranscriptionSubscriptionState other && Equals(other); + /// + public bool Equals(TranscriptionSubscriptionState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionUpdated.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionUpdated.Serialization.cs index badca0390828..65cfc2f3f0a9 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionUpdated.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionUpdated.Serialization.cs @@ -17,28 +17,14 @@ internal static TranscriptionUpdated DeserializeTranscriptionUpdated(JsonElement { return null; } - string operationContext = default; - ResultInformation resultInformation = default; TranscriptionUpdate transcriptionUpdate = default; string callConnectionId = default; string serverCallId = default; string correlationId = default; + string operationContext = default; + ResultInformation resultInformation = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("operationContext"u8)) - { - operationContext = property.Value.GetString(); - continue; - } - if (property.NameEquals("resultInformation"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resultInformation = ResultInformation.DeserializeResultInformation(property.Value); - continue; - } if (property.NameEquals("transcriptionUpdate"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -63,14 +49,28 @@ internal static TranscriptionUpdated DeserializeTranscriptionUpdated(JsonElement correlationId = property.Value.GetString(); continue; } + if (property.NameEquals("operationContext"u8)) + { + operationContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("resultInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultInformation = ResultInformation.DeserializeResultInformation(property.Value); + continue; + } } return new TranscriptionUpdated( - operationContext, - resultInformation, transcriptionUpdate, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation); } /// Deserializes the model from a raw response. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionUpdated.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionUpdated.cs index 10ac150c3eb6..2ee96f988d7b 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionUpdated.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TranscriptionUpdated.cs @@ -16,21 +16,22 @@ internal TranscriptionUpdated() } /// Initializes a new instance of . - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. /// Defines the result for TranscriptionUpdate with the current status and the details about the status. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - internal TranscriptionUpdated(string operationContext, ResultInformation resultInformation, TranscriptionUpdate transcriptionUpdate, string callConnectionId, string serverCallId, string correlationId) + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. + internal TranscriptionUpdated(TranscriptionUpdate transcriptionUpdate, string callConnectionId, string serverCallId, string correlationId, string operationContext, ResultInformation resultInformation) { - OperationContext = operationContext; - ResultInformation = resultInformation; TranscriptionUpdate = transcriptionUpdate; CallConnectionId = callConnectionId; ServerCallId = serverCallId; CorrelationId = correlationId; + OperationContext = operationContext; + ResultInformation = resultInformation; } + /// Defines the result for TranscriptionUpdate with the current status and the details about the status. public TranscriptionUpdate TranscriptionUpdate { get; } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TransferToParticipantRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TransferToParticipantRequestInternal.Serialization.cs index 17c45a9c5eb5..a8eae012d588 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TransferToParticipantRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TransferToParticipantRequestInternal.Serialization.cs @@ -17,11 +17,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartObject(); writer.WritePropertyName("targetParticipant"u8); writer.WriteObjectValue(TargetParticipant); - if (Optional.IsDefined(CustomCallingContext)) - { - writer.WritePropertyName("customCallingContext"u8); - writer.WriteObjectValue(CustomCallingContext); - } if (Optional.IsDefined(OperationContext)) { writer.WritePropertyName("operationContext"u8); @@ -37,6 +32,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("operationCallbackUri"u8); writer.WriteStringValue(OperationCallbackUri); } + if (Optional.IsDefined(CustomCallingContext)) + { + writer.WritePropertyName("customCallingContext"u8); + writer.WriteObjectValue(CustomCallingContext); + } if (Optional.IsDefined(SourceCallerIdNumber)) { writer.WritePropertyName("sourceCallerIdNumber"u8); diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TransferToParticipantRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TransferToParticipantRequestInternal.cs index 90669d7c57e4..ba20e2eaf470 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TransferToParticipantRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TransferToParticipantRequestInternal.cs @@ -24,28 +24,26 @@ public TransferToParticipantRequestInternal(CommunicationIdentifierModel targetP /// Initializes a new instance of . /// The identity of the target where call should be transferred to. - /// Used by customer to send custom calling context to targets. /// Used by customers when calling mid-call actions to correlate the request to the response event. /// Transferee is the participant who is transferred away. /// /// 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. /// + /// Used by customer to send custom calling context to targets. /// 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. - internal TransferToParticipantRequestInternal(CommunicationIdentifierModel targetParticipant, CustomCallingContextInternal customCallingContext, string operationContext, CommunicationIdentifierModel transferee, string operationCallbackUri, PhoneNumberIdentifierModel sourceCallerIdNumber) + internal TransferToParticipantRequestInternal(CommunicationIdentifierModel targetParticipant, string operationContext, CommunicationIdentifierModel transferee, string operationCallbackUri, CustomCallingContextInternal customCallingContext, PhoneNumberIdentifierModel sourceCallerIdNumber) { TargetParticipant = targetParticipant; - CustomCallingContext = customCallingContext; OperationContext = operationContext; Transferee = transferee; OperationCallbackUri = operationCallbackUri; + CustomCallingContext = customCallingContext; SourceCallerIdNumber = sourceCallerIdNumber; } /// The identity of the target where call should be transferred to. public CommunicationIdentifierModel TargetParticipant { get; } - /// Used by customer to send custom calling context to targets. - public CustomCallingContextInternal CustomCallingContext { get; set; } /// Used by customers when calling mid-call actions to correlate the request to the response event. public string OperationContext { get; set; } /// Transferee is the participant who is transferred away. @@ -55,6 +53,8 @@ internal TransferToParticipantRequestInternal(CommunicationIdentifierModel targe /// This setup is per-action. If this is not set, the default callback URI set by CreateCall/AnswerCall will be used. /// public string OperationCallbackUri { get; set; } + /// Used by customer to send custom calling context to targets. + public CustomCallingContextInternal CustomCallingContext { get; set; } /// 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. public PhoneNumberIdentifierModel SourceCallerIdNumber { get; set; } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UpdateTranscriptionRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UpdateTranscriptionRequestInternal.Serialization.cs index 7f576586a689..51aab15b3037 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UpdateTranscriptionRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UpdateTranscriptionRequestInternal.Serialization.cs @@ -17,6 +17,21 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartObject(); writer.WritePropertyName("locale"u8); writer.WriteStringValue(Locale); + if (Optional.IsDefined(SpeechRecognitionModelEndpointId)) + { + writer.WritePropertyName("speechRecognitionModelEndpointId"u8); + writer.WriteStringValue(SpeechRecognitionModelEndpointId); + } + if (Optional.IsDefined(OperationContext)) + { + writer.WritePropertyName("operationContext"u8); + writer.WriteStringValue(OperationContext); + } + if (Optional.IsDefined(OperationCallbackUri)) + { + writer.WritePropertyName("operationCallbackUri"u8); + writer.WriteStringValue(OperationCallbackUri); + } writer.WriteEndObject(); } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UpdateTranscriptionRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UpdateTranscriptionRequestInternal.cs index 865d8725f11a..7d9fccd0ed90 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UpdateTranscriptionRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UpdateTranscriptionRequestInternal.cs @@ -22,7 +22,32 @@ public UpdateTranscriptionRequestInternal(string locale) Locale = locale; } + /// Initializes a new instance of . + /// Defines new locale for transcription. + /// Sets Endpoint id where the custom model was deployed. + /// The value to identify context of the operation. + /// + /// 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. + /// + internal UpdateTranscriptionRequestInternal(string locale, string speechRecognitionModelEndpointId, string operationContext, string operationCallbackUri) + { + Locale = locale; + SpeechRecognitionModelEndpointId = speechRecognitionModelEndpointId; + OperationContext = operationContext; + OperationCallbackUri = operationCallbackUri; + } + /// Defines new locale for transcription. public string Locale { get; } + /// Sets Endpoint id where the custom model was deployed. + public string SpeechRecognitionModelEndpointId { get; set; } + /// The value to identify context of the operation. + public string OperationContext { get; set; } + /// + /// 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. + /// + public string OperationCallbackUri { get; set; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/AudioFormat.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/AudioFormat.cs new file mode 100644 index 000000000000..e2db4f8ed599 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/AudioFormat.cs @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core; + +namespace Azure.Communication.CallAutomation +{ + /// + /// The states of a call. + /// + [CodeGenModel("AudioFormat", Usage = new string[] { "output" }, Formats = new string[] { "json" })] + public readonly partial struct AudioFormat + { + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallAutomationModelFactory.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallAutomationModelFactory.cs index 85580a38ebb7..5a37ba64137d 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallAutomationModelFactory.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallAutomationModelFactory.cs @@ -13,7 +13,7 @@ namespace Azure.Communication.CallAutomation [CodeGenSuppress("CallTransferFailed", typeof(string), typeof(ResultInformation), typeof(string), typeof(string), typeof(string))] [CodeGenSuppress("ContinuousDtmfRecognitionStopped", typeof(string), typeof(ResultInformation), typeof(string), typeof(string), typeof(string))] [CodeGenSuppress("ContinuousDtmfRecognitionToneFailed", typeof(ResultInformation), typeof(string), typeof(string), typeof(string), typeof(string))] - [CodeGenSuppress("ContinuousDtmfRecognitionToneReceived", typeof(ResultInformation), typeof(int?), typeof(DtmfTone?), typeof(string), typeof(string), typeof(string), typeof(string))] + [CodeGenSuppress("ContinuousDtmfRecognitionToneReceived", typeof(int?), typeof(DtmfTone?), typeof(string), typeof(string), typeof(string), typeof(string), typeof(ResultInformation))] [CodeGenSuppress("PlayCompleted", typeof(ResultInformation), typeof(string), typeof(string), typeof(string), typeof(string))] [CodeGenSuppress("PlayFailed", typeof(string), typeof(ResultInformation), typeof(string), typeof(string), typeof(string))] [CodeGenSuppress("RecognizeFailed", typeof(string), typeof(ResultInformation), typeof(string), typeof(string), typeof(string))] @@ -52,9 +52,10 @@ public static AnswerCallResult AnswerCallResult(CallConnection callConnection = /// Source identity. /// Caller ID phone number to appear on the invitee. /// Display name to appear on the invitee. - /// The subscriptionId for Media Streaming. - /// The subscriptionId for transcription. + /// The subscription details for Media Streaming. + /// The subscription details for transcription. /// Identifier that answered the call. + /// Identity of the original Pstn target of an incoming Call. /// A new instance for mocking. public static CallConnectionProperties CallConnectionProperties( string callConnectionId = default, @@ -66,10 +67,11 @@ public static CallConnectionProperties CallConnectionProperties( PhoneNumberIdentifier sourceCallerIdNumber = default, string sourceDisplayName = default, CommunicationUserIdentifier answeredBy = default, - string mediaSubscriptionId = default, - string dataSubscriptionId = default) + MediaStreamingSubscription mediaStreamingSubscription = default, + TranscriptionSubscription transcriptionSubscription = default, + PhoneNumberIdentifier answeredFor = default) { - return new CallConnectionProperties(callConnectionId, serverCallId, targets, callConnectionState, callbackUri, sourceIdentity, sourceCallerIdNumber, sourceDisplayName, mediaSubscriptionId, dataSubscriptionId, answeredBy); + return new CallConnectionProperties(callConnectionId, serverCallId, targets, callConnectionState, callbackUri, sourceIdentity, sourceCallerIdNumber, sourceDisplayName, mediaStreamingSubscription, transcriptionSubscription, answeredBy, answeredFor); } /// Initializes a new instance of CallParticipant. @@ -130,12 +132,12 @@ private static string CreateEventSource(string callConnectionId, string eventNam public static AddParticipantFailed AddParticipantFailed(string callConnectionId = default, string serverCallId = default, string correlationId = default, string operationContext = default, ResultInformation resultInformation = default, CommunicationIdentifier participant = default) { var internalObject = new AddParticipantFailedInternal( - operationContext, - resultInformation, - participant: CommunicationIdentifierSerializer.Serialize(participant), callConnectionId, serverCallId, - correlationId + correlationId, + operationContext, + resultInformation, + participant: CommunicationIdentifierSerializer.Serialize(participant) ); return new AddParticipantFailed(internalObject); @@ -147,12 +149,12 @@ public static AddParticipantFailed AddParticipantFailed(string callConnectionId public static AddParticipantSucceeded AddParticipantSucceeded(string callConnectionId = default, string serverCallId = default, string correlationId = default, string operationContext = default, ResultInformation resultInformation = default, CommunicationIdentifier participant = default) { var internalObject = new AddParticipantSucceededInternal( - operationContext, - resultInformation, - participant: CommunicationIdentifierSerializer.Serialize(participant), callConnectionId, serverCallId, - correlationId + correlationId, + operationContext, + resultInformation, + participant: CommunicationIdentifierSerializer.Serialize(participant) ); return new AddParticipantSucceeded(internalObject); @@ -161,16 +163,17 @@ public static AddParticipantSucceeded AddParticipantSucceeded(string callConnect /// /// Initializes a new instance of Participants Updated event. /// - public static ParticipantsUpdated ParticipantsUpdated(string callConnectionId = default, string serverCallId = default, string correlationId = default, IEnumerable participants = default, int sequenceNumber = default) + public static ParticipantsUpdated ParticipantsUpdated(string callConnectionId = default, string serverCallId = default, string correlationId = default, IEnumerable participants = default, int sequenceNumber = default, ResultInformation resultInformation = null) { var internalObject = new ParticipantsUpdatedInternal( - participants == null + callConnectionId, + serverCallId, + correlationId, + sequenceNumber: sequenceNumber, + participants: participants == null ? new List() : participants.Select(p => new CallParticipantInternal(CommunicationIdentifierSerializer.Serialize(p.Identifier), p.IsMuted, p.IsOnHold)).ToList(), - sequenceNumber, - callConnectionId, - serverCallId, - correlationId + resultInformation: resultInformation ); return new ParticipantsUpdated(internalObject); @@ -182,12 +185,12 @@ public static ParticipantsUpdated ParticipantsUpdated(string callConnectionId = public static RemoveParticipantFailed RemoveParticipantFailed(string callConnectionId = default, string serverCallId = default, string correlationId = default, string operationContext = default, ResultInformation resultInformation = default, CommunicationIdentifier participant = default) { var internalObject = new RemoveParticipantFailedInternal( - operationContext, - resultInformation, - participant: CommunicationIdentifierSerializer.Serialize(participant), callConnectionId, serverCallId, - correlationId + correlationId, + operationContext, + resultInformation, + participant: CommunicationIdentifierSerializer.Serialize(participant) ); return new RemoveParticipantFailed(internalObject); @@ -199,12 +202,12 @@ public static RemoveParticipantFailed RemoveParticipantFailed(string callConnect public static RemoveParticipantSucceeded RemoveParticipantSucceeded(string callConnectionId = default, string serverCallId = default, string correlationId = default, string operationContext = default, ResultInformation resultInformation = default, CommunicationIdentifier participant = default) { var internalObject = new RemoveParticipantSucceededInternal( - operationContext, - resultInformation, - participant: CommunicationIdentifierSerializer.Serialize(participant), callConnectionId, serverCallId, - correlationId + correlationId, + operationContext, + resultInformation, + participant: CommunicationIdentifierSerializer.Serialize(participant) ); return new RemoveParticipantSucceeded(internalObject); @@ -213,14 +216,14 @@ public static RemoveParticipantSucceeded RemoveParticipantSucceeded(string callC /// Initializes a new instance of RecognizeCompletedInternal. /// Call connection ID. /// Server call ID. - /// Correlation ID for event to call corre lation. Also called ChainId for skype chain ID. + /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. /// Used by customers when calling mid-call actions to correlate the request to the response event. /// Contains the resulting SIP code/sub-code and message from NGC services. /// /// Determines the sub-type of the recognize operation. /// In case of cancel operation the this field is not set and is returned empty /// - /// Defines the result for RecognitionType = Dtmf,Choice,Speech. + /// Defines the result for general recognizeResult. /// A new instance for mocking. public static RecognizeCompleted RecognizeCompleted(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null, CallMediaRecognitionType recognitionType = default, RecognizeResult recognizeResult = null) { @@ -232,20 +235,20 @@ public static RecognizeCompleted RecognizeCompleted(string callConnectionId = nu /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code/sub-code and message from NGC services. - /// Transferee is the participant who is transferring the call. - /// The identity of the target where call should be transferred to. + /// Contains the resulting SIP code, sub-code and message. + /// Target who the call is transferred to. + /// the participant who is being transferred away. /// A new instance for mocking. public static CallTransferAccepted CallTransferAccepted(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null, CommunicationIdentifier transferee = null, CommunicationIdentifier transferTarget = null) { - var internalEvent = new CallTransferAcceptedInternal( - operationContext, - resultInformation, - transferTarget == null ? null : CommunicationIdentifierSerializer.Serialize(transferTarget), - transferee == null ? null : CommunicationIdentifierSerializer.Serialize(transferee), + var internalEvent = new CallTransferAcceptedInternal( callConnectionId, serverCallId, - correlationId + correlationId, + operationContext, + resultInformation, + transferTarget: transferTarget == null ? null : CommunicationIdentifierSerializer.Serialize(transferTarget), + transferee: transferee == null ? null : CommunicationIdentifierSerializer.Serialize(transferee) ); return new CallTransferAccepted(internalEvent); } @@ -258,17 +261,17 @@ public static CancelAddParticipantSucceeded CancelAddParticipantSucceeded( string serverCallId = default, string correlationId = default, string invitationId = default, - CommunicationIdentifier participant = default, string operationContext = default, - ResultInformation resultInformation = default) + ResultInformation resultInformation = null) { var internalObject = new CancelAddParticipantSucceededInternal( - invitationId, - operationContext, - resultInformation, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + invitationId: invitationId, + resultInformation: resultInformation + ); return new CancelAddParticipantSucceeded(internalObject); } @@ -285,34 +288,14 @@ public static CancelAddParticipantFailed CancelAddParticipantFailed( string operationContext = default) { var internalObject = new CancelAddParticipantFailedInternal( - operationContext, - resultInformation, - invitationId, callConnectionId, serverCallId, - correlationId); - - return new CancelAddParticipantFailed(internalObject); - } - - /// - /// Initializes a new instance of create call failed event. - /// - public static CreateCallFailed CreateCallFailed( - string callConnectionId = default, - string serverCallId = default, - string correlationId = default, - ResultInformation resultInformation = default, - string operationContext = default) - { - var internalObject = new CreateCallFailedInternal( + correlationId, operationContext, resultInformation, - callConnectionId, - serverCallId, - correlationId); + invitationId: invitationId); - return new CreateCallFailed(internalObject); + return new CancelAddParticipantFailed(internalObject); } /// @@ -326,11 +309,11 @@ public static AnswerFailed AnswerFailed( string operationContext = default) { var internalObject = new AnswerFailedInternal( - operationContext, - resultInformation, callConnectionId, serverCallId, - correlationId); + correlationId, + operationContext, + resultInformation); return new AnswerFailed(internalObject); } @@ -339,84 +322,100 @@ public static AnswerFailed AnswerFailed( /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Used by customers to set the context for creating a new call. This property will be null for answering a call. + /// Contains the resulting SIP code, sub-code and message. /// A new instance for mocking. - public static CallConnected CallConnected(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null) + public static CallConnected CallConnected(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null) { - return new CallConnected(operationContext, callConnectionId, serverCallId, correlationId); + return new CallConnected(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); } + ///// Initializes a new instance of CallConnected. + ///// Call connection ID. + ///// Server call ID. + ///// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + ///// Used by customers to set the context for creating a new call. This property will be null for answering a call. + ///// /// Contains the resulting SIP code, sub-code and message. + ///// A new instance for mocking. + //public static ConnectFailed ConnectFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null) + //{ + // return new ConnectFailed(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); + //} + /// Initializes a new instance of CallDisconnected. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Used by customers to set the context for creating a new call. This property will be null for answering a call. + /// Contains the resulting SIP code, sub-code and message. /// A new instance for mocking. - public static CallDisconnected CallDisconnected(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null) + public static CallDisconnected CallDisconnected(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null) { - return new CallDisconnected(operationContext, callConnectionId, serverCallId, correlationId); + return new CallDisconnected(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); } /// Initializes a new instance of CallTransferFailed. - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. /// A new instance for mocking. public static CallTransferFailed CallTransferFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null) { - return new CallTransferFailed(operationContext, resultInformation, callConnectionId, serverCallId, correlationId); + return new CallTransferFailed(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); } /// Initializes a new instance of ContinuousDtmfRecognitionStopped. - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code/sub-code and message from NGC services. /// Call connection ID. /// Server call ID. - /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + /// Correlation ID for event to call correlation. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. /// A new instance for mocking. public static ContinuousDtmfRecognitionStopped ContinuousDtmfRecognitionStopped(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null) { - return new ContinuousDtmfRecognitionStopped(operationContext, resultInformation, callConnectionId, serverCallId, correlationId); + return new ContinuousDtmfRecognitionStopped(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); } /// Initializes a new instance of ContinuousDtmfRecognitionToneFailed. - /// Result information defines the code, subcode and message. - /// Used by customers when calling mid-call actions to correlate the request to the response event. /// Call connection ID. /// Server call ID. - /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + /// Correlation ID for event to call correlation. + /// Contains the resulting SIP code, sub-code and message. + /// Used by customers when calling mid-call actions to correlate the request to the response event. /// A new instance for mocking. public static ContinuousDtmfRecognitionToneFailed ContinuousDtmfRecognitionToneFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, ResultInformation resultInformation = null, string operationContext = null) { - return new ContinuousDtmfRecognitionToneFailed(resultInformation, operationContext, callConnectionId, serverCallId, correlationId); + return new ContinuousDtmfRecognitionToneFailed(callConnectionId, serverCallId, correlationId, resultInformation, operationContext); } /// Initializes a new instance of ContinuousDtmfRecognitionToneReceived. - /// Result information defines the code, subcode and message. - /// Define the information for a tone. - /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// The sequence id which can be used to determine if the same tone was played multiple times or if any tones were missed. + /// /// Call connection ID. /// Server call ID. - /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - /// + /// Correlation ID for event to call correlation. Also called ChainId or skype chain ID. + /// Contains the resulting SIP code, sub-code and message. + /// Used by customers when calling mid-call actions to correlate the request to the response event. /// A new instance for mocking. public static ContinuousDtmfRecognitionToneReceived ContinuousDtmfRecognitionToneReceived(int? sequenceId = null, DtmfTone? tone = null, string callConnectionId = null, string serverCallId = null, string correlationId = null, ResultInformation resultInformation = null, string operationContext = null) { - return new ContinuousDtmfRecognitionToneReceived(resultInformation, sequenceId, tone, operationContext, callConnectionId, serverCallId, correlationId); + return new ContinuousDtmfRecognitionToneReceived(sequenceId, tone, callConnectionId, serverCallId, correlationId, operationContext, resultInformation); } /// Initializes a new instance of PlayCompleted. - /// Result information defines the code, subcode and message. - /// Used by customers when calling mid-call actions to correlate the request to the response event. /// Call connection ID. /// Server call ID. - /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + /// Correlation ID for event to call correlation. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. /// A new instance for mocking. public static PlayCompleted PlayCompleted(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null) { - return new PlayCompleted(resultInformation, operationContext, callConnectionId, serverCallId, correlationId); + var internalObject = new PlayCompletedInternal(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); + + return new PlayCompleted(internalObject); } /// Initializes a new instance of PlayFailed. @@ -425,32 +424,49 @@ public static PlayCompleted PlayCompleted(string callConnectionId = null, string /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. /// A new instance for mocking. - public static PlayFailed PlayFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null) + public static PlayFailed PlayFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null, int? failedPlaySourceIndex = null) { - return new PlayFailed(operationContext, resultInformation, callConnectionId, serverCallId, correlationId); + var internalObject = new PlayFailedInternal(callConnectionId, serverCallId, correlationId, operationContext, resultInformation, failedPlaySourceIndex); + + return new PlayFailed(internalObject); } + ///// Initializes a new instance of PlayFailed. + ///// Used by customers when calling mid-call actions to correlate the request to the response event. + ///// Contains the resulting SIP code, sub-code and message. + ///// Call connection ID. + ///// Server call ID. + ///// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + ///// A new instance for mocking. + //public static PlayStarted PlayStarted(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null) + //{ + // return new PlayStarted(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); + //} + /// Initializes a new instance of PlayCanceled. - /// Used by customers when calling mid-call actions to correlate the request to the response event. /// Call connection ID. /// Server call ID. - /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + /// Correlation ID for event to call correlation. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. /// A new instance for mocking. - public static PlayCanceled PlayCanceled(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null) + public static PlayCanceled PlayCanceled(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null) { - return new PlayCanceled(operationContext, callConnectionId, serverCallId, correlationId); + return new PlayCanceled(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); } /// Initializes a new instance of RecognizeCanceled. - /// Used by customers when calling mid-call actions to correlate the request to the response event. /// Call connection ID. /// Server call ID. - /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + /// Correlation ID for event to call correlation. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. /// A new instance for mocking. - public static RecognizeCanceled RecognizeCanceled(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null) + public static RecognizeCanceled RecognizeCanceled(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null) { - return new RecognizeCanceled(operationContext, callConnectionId, serverCallId, correlationId); + return new RecognizeCanceled(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); } /// Initializes a new instance of RecognizeFailed. @@ -459,64 +475,94 @@ public static RecognizeCanceled RecognizeCanceled(string callConnectionId = null /// Call connection ID. /// Server call ID. /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. /// A new instance for mocking. - public static RecognizeFailed RecognizeFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null) + public static RecognizeFailed RecognizeFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null, int? failedPlaySourceIndex = null) { - return new RecognizeFailed(operationContext, resultInformation, callConnectionId, serverCallId, correlationId); + var internalObject = new RecognizeFailedInternal(callConnectionId, serverCallId, correlationId, operationContext, resultInformation, failedPlaySourceIndex); + + return new RecognizeFailed(internalObject); } /// Initializes a new instance of RecordingStateChanged. + /// Call connection ID. + /// Server call ID. + /// Correlation ID for event to call correlation. /// The call recording id. /// /// The time of the recording started. /// - /// Call connection ID. - /// Server call ID. - /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + /// Contains the resulting SIP code, sub-code and message. /// A new instance for mocking. - public static RecordingStateChanged RecordingStateChanged(string callConnectionId = null, string serverCallId = null, string correlationId = null, string recordingId = null, RecordingState state = default, DateTimeOffset? startDateTime = null, RecordingKind? recordingKind = null) + public static RecordingStateChanged RecordingStateChanged(string callConnectionId = null, string serverCallId = null, string correlationId = null, string recordingId = null, RecordingState state = default, DateTimeOffset? startDateTime = null, RecordingKind? recordingKind = null, ResultInformation resultInformation = null) { - return new RecordingStateChanged(recordingId, state, startDateTime, recordingKind, callConnectionId, serverCallId, correlationId); + return new RecordingStateChanged(callConnectionId, serverCallId, correlationId, recordingId, state: state, startDateTime: startDateTime, recordingKind, resultInformation); + } + + /// Initializes a new instance of RecordingStateResult. + /// + /// + /// + /// A new instance for mocking. + public static RecordingStateResult RecordingStateResult(string recordingId = null, RecordingState? recordingState = null, RecordingKind? recordingKind = null) + { + return new RecordingStateResult(recordingId: recordingId, recordingState: recordingState, recordingKind: recordingKind); } /// Initializes a new instance of SendDtmfTonesCompleted. - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. /// Call connection ID. /// Server call ID. - /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + /// Correlation ID for event to call correlation. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. /// A new instance for mocking. public static SendDtmfTonesCompleted SendDtmfTonesCompleted(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null) { - var internalObject = new SendDtmfTonesCompletedInternal(operationContext, resultInformation, callConnectionId, serverCallId, correlationId); + var internalObject = new SendDtmfTonesCompletedInternal(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); return new SendDtmfTonesCompleted(internalObject); } /// Initializes a new instance of SendDtmfTonesFailed. - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. /// Call connection ID. /// Server call ID. - /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + /// Correlation ID for event to call correlation. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. /// A new instance for mocking. public static SendDtmfTonesFailed SendDtmfTonesFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null) { - var internalObject = new SendDtmfTonesFailedInternal(operationContext, resultInformation, callConnectionId, serverCallId, correlationId); + var internalObject = new SendDtmfTonesFailedInternal(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); return new SendDtmfTonesFailed(internalObject); } /// Initializes a new instance of HoldFailed. - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code, sub-code and message. /// Call connection ID. /// Server call ID. - /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. + /// Correlation ID for event to call correlation. + /// Used by customers when calling mid-call actions to correlate the request to the response event. + /// Contains the resulting SIP code, sub-code and message. /// A new instance for mocking. public static HoldFailed HoldFailed(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, ResultInformation resultInformation = null) { - return new HoldFailed(operationContext, resultInformation, callConnectionId, serverCallId, correlationId); + var internalObject = new HoldFailedInternal(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); + + return new HoldFailed(internalObject); + } + + /// + /// Initializes a new instance of create call failed event. + /// + public static CreateCallFailed CreateCallFailed( + string callConnectionId = default, + string serverCallId = default, + string correlationId = default, + ResultInformation resultInformation = default, + string operationContext = default) + { + var createdCallFailedInternal = new CreateCallFailedInternal(callConnectionId, serverCallId, correlationId, operationContext, resultInformation); + return new CreateCallFailed(createdCallFailedInternal); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallConnectionProperties.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallConnectionProperties.cs index cb2b5800decc..0b002c74f7d5 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallConnectionProperties.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallConnectionProperties.cs @@ -19,9 +19,10 @@ internal CallConnectionProperties( CommunicationIdentifier source, PhoneNumberIdentifier sourceCallerIdNumber, string sourceDisplayName, - string mediaSubscriptionId, - string dataSubscriptionId, - CommunicationUserIdentifier answeredBy + MediaStreamingSubscription mediaStreamingSubscription, + TranscriptionSubscription transcriptionSubscription, + CommunicationUserIdentifier answeredBy, + PhoneNumberIdentifier answeredFor ) { CallConnectionId = callConnectionId; @@ -32,9 +33,10 @@ CommunicationUserIdentifier answeredBy Source = source; SourceCallerIdNumber = sourceCallerIdNumber; SourceDisplayName = sourceDisplayName; - MediaSubscriptionId = mediaSubscriptionId; - DataSubscriptionId = dataSubscriptionId; + MediaStreamingSubscription = mediaStreamingSubscription; + TranscriptionSubscription = transcriptionSubscription; AnsweredBy = answeredBy; + AnsweredFor = answeredFor; } internal CallConnectionProperties(CallConnectionPropertiesInternal callConnectionPropertiesDtoInternal) @@ -43,7 +45,7 @@ internal CallConnectionProperties(CallConnectionPropertiesInternal callConnectio ServerCallId = callConnectionPropertiesDtoInternal.ServerCallId; Targets = callConnectionPropertiesDtoInternal.Targets.Select(t => CommunicationIdentifierSerializer.Deserialize(t)).ToList(); - if (callConnectionPropertiesDtoInternal.CallConnectionState == null || callConnectionPropertiesDtoInternal.CallConnectionState == default(CallConnectionState)) + if (callConnectionPropertiesDtoInternal.CallConnectionState == null || callConnectionPropertiesDtoInternal.CallConnectionState == default(CallConnectionState)) { CallConnectionState = CallConnectionState.Unknown; } @@ -53,17 +55,32 @@ internal CallConnectionProperties(CallConnectionPropertiesInternal callConnectio } CallbackUri = new Uri(callConnectionPropertiesDtoInternal.CallbackUri); - MediaSubscriptionId = callConnectionPropertiesDtoInternal.MediaSubscriptionId; - DataSubscriptionId = callConnectionPropertiesDtoInternal.DataSubscriptionId; - Source = callConnectionPropertiesDtoInternal.Source == null? null : CommunicationIdentifierSerializer.Deserialize(callConnectionPropertiesDtoInternal.Source); + MediaStreamingSubscription = callConnectionPropertiesDtoInternal.MediaStreamingSubscription != null ? + new MediaStreamingSubscription( + callConnectionPropertiesDtoInternal.MediaStreamingSubscription.Id, + callConnectionPropertiesDtoInternal.MediaStreamingSubscription.State, + callConnectionPropertiesDtoInternal.MediaStreamingSubscription.SubscribedContentTypes) + : null; + TranscriptionSubscription = callConnectionPropertiesDtoInternal.TranscriptionSubscription != null ? + new TranscriptionSubscription( + callConnectionPropertiesDtoInternal.TranscriptionSubscription.Id, + callConnectionPropertiesDtoInternal.TranscriptionSubscription.State, + callConnectionPropertiesDtoInternal.TranscriptionSubscription.SubscribedResultTypes) + : null; + Source = callConnectionPropertiesDtoInternal.Source == null ? null : CommunicationIdentifierSerializer.Deserialize(callConnectionPropertiesDtoInternal.Source); SourceDisplayName = callConnectionPropertiesDtoInternal.SourceDisplayName; CorrelationId = callConnectionPropertiesDtoInternal.CorrelationId; - AnsweredBy = callConnectionPropertiesDtoInternal.AnsweredBy == null? null : new CommunicationUserIdentifier(callConnectionPropertiesDtoInternal.AnsweredBy.Id); + AnsweredBy = callConnectionPropertiesDtoInternal.AnsweredBy == null ? null : new CommunicationUserIdentifier(callConnectionPropertiesDtoInternal.AnsweredBy.Id); if (callConnectionPropertiesDtoInternal.SourceCallerIdNumber != null) { SourceCallerIdNumber = new PhoneNumberIdentifier(callConnectionPropertiesDtoInternal.SourceCallerIdNumber.Value); } + + if (callConnectionPropertiesDtoInternal.AnsweredFor != null) + { + AnsweredFor = new PhoneNumberIdentifier(callConnectionPropertiesDtoInternal.AnsweredFor.Value); + } } /// The call connection id. @@ -77,9 +94,9 @@ internal CallConnectionProperties(CallConnectionPropertiesInternal callConnectio /// The callback URI. public Uri CallbackUri { get; } /// SubscriptionId for media streaming. - public string MediaSubscriptionId { get; } + public MediaStreamingSubscription MediaStreamingSubscription { get; } /// SubscriptionId for transcription. - public string DataSubscriptionId { get; } + public TranscriptionSubscription TranscriptionSubscription { get; } /// /// Caller ID phone number to appear on the invitee. /// @@ -102,5 +119,10 @@ internal CallConnectionProperties(CallConnectionPropertiesInternal callConnectio /// Identity of the answering entity. Only populated when identity is provided in the request. /// public CommunicationUserIdentifier AnsweredBy { get; } + + /// + /// Identity of the original Pstn target of an incoming Call. Only populated when the original target is a Pstn number. + /// + public PhoneNumberIdentifier AnsweredFor { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallLocatorSerializer.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallLocatorSerializer.cs index b5fa5f59f2ce..7aea6e214fa5 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallLocatorSerializer.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallLocatorSerializer.cs @@ -21,6 +21,11 @@ internal static CallLocatorInternal Serialize(CallLocator identifier) GroupCallId = groupCallLocator.Id, Kind = CallLocatorKindInternal.GroupCallLocator, }, + RoomCallLocator roomCallLocator => new CallLocatorInternal + { + RoomId = roomCallLocator.Id, + Kind = CallLocatorKindInternal.RoomCallLocator, + }, _ => throw new NotSupportedException(), }; @@ -37,6 +42,9 @@ public static CallLocator Deserialize(CallLocatorInternal identifier) if (identifier.Kind.Value == CallLocatorKindInternal.GroupCallLocator) return new GroupCallLocator(AssertNotNull(identifier.GroupCallId, nameof(identifier.GroupCallId), nameof(identifier.GroupCallId))); + if (identifier.Kind.Value == CallLocatorKindInternal.RoomCallLocator) + return new RoomCallLocator(AssertNotNull(identifier.RoomId, nameof(identifier.RoomId), nameof(identifier.RoomId))); + throw new JsonException("Unknown type present in CallLocatorModel"); } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallMediaRecognizeOptions.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallMediaRecognizeOptions.cs index 613d85059f6b..d94e34dfacdd 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallMediaRecognizeOptions.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallMediaRecognizeOptions.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Collections.Generic; namespace Azure.Communication.CallAutomation { @@ -43,6 +44,11 @@ protected CallMediaRecognizeOptions(RecognizeInputType inputType, CommunicationI /// public PlaySource Prompt { get; set; } + /// + /// PlaySource objects representing the sources to play. + /// + public IList PlayPrompts { get; set; } + /// /// Determines if we interrupt the prompt and start recognizing. /// diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/ConnectCallOptions.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/ConnectCallOptions.cs new file mode 100644 index 000000000000..6fb9dc41aeb7 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/ConnectCallOptions.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; + +namespace Azure.Communication.CallAutomation +{ + /// + /// Options for creating a call. + /// + public class ConnectCallOptions + { + /// + /// Creates a new instance of ConnectOptions. + /// + /// + /// + public ConnectCallOptions(CallLocator callLocator, Uri callbackUri) + { + CallLocator = callLocator; + CallbackUri = callbackUri; + } + + /// + /// Either a GroupCallLocator or ServerCallLocator or RoomCallLocator for locating the call. + /// + public CallLocator CallLocator { get; } + + /// + /// The callback URL. + /// + public Uri CallbackUri { get; } + + /// + /// Used by customers to correlate the request to the response event. + /// + public string OperationContext { get; set; } + + /// + /// Media Streaming Configuration. + /// + public MediaStreamingOptions MediaStreamingOptions { get; set; } + + /// + /// Live Transcription Configuration. + /// + public TranscriptionOptions TranscriptionOptions { get; set; } + + /// + /// AI options for the call. + /// + public CallIntelligenceOptions CallIntelligenceOptions { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/ConnectCallResult.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/ConnectCallResult.cs new file mode 100644 index 000000000000..dfdc42c4ce7e --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/ConnectCallResult.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Threading; +using System.Threading.Tasks; + +namespace Azure.Communication.CallAutomation +{ + /// The result from connect request. + public class ConnectCallResult + { + private CallAutomationEventProcessor _evHandler; + private string _callConnectionId; + + internal ConnectCallResult(CallConnectionProperties callConnectionProperties, CallConnection callConnection) + { + CallConnectionProperties = callConnectionProperties; + CallConnection = callConnection; + } + + internal void SetEventProcessor(CallAutomationEventProcessor evHandler, string callConnectionId) + { + _evHandler = evHandler; + _callConnectionId = callConnectionId; + } + + /// CallConnection instance. + public CallConnection CallConnection { get; } + + /// Properties of the call. + public CallConnectionProperties CallConnectionProperties { get; } + + /// + /// This is blocking call. Wait for using . + /// + /// Cancellation Token can be used to set timeout or cancel this WaitForEventProcessor. + /// Returns which contains event. + public ConnectCallEventResult WaitForEventProcessor(CancellationToken cancellationToken = default) + { + if (_evHandler is null) + { + throw new NullReferenceException(nameof(_evHandler)); + } + + var returnedEvent = _evHandler.WaitForEventProcessor(filter + => filter.CallConnectionId == _callConnectionId + && (filter.GetType() == typeof(ConnectFailed)), + cancellationToken); + + return SetReturnedEvent(returnedEvent); + } + + /// + /// Wait for using . + /// + /// Cancellation Token can be used to set timeout or cancel this WaitForEventProcessor. + /// Returns which contains event. + public async Task WaitForEventProcessorAsync(CancellationToken cancellationToken = default) + { + if (_evHandler is null) + { + throw new NullReferenceException(nameof(_evHandler)); + } + + var returnedEvent = await _evHandler.WaitForEventProcessorAsync(filter + => filter.CallConnectionId == _callConnectionId + && (filter.GetType() == typeof(ConnectFailed)), + cancellationToken).ConfigureAwait(false); + + return SetReturnedEvent(returnedEvent); + } + + private static ConnectCallEventResult SetReturnedEvent(CallAutomationEventBase returnedEvent) + { + return new ConnectCallEventResult(true, (ConnectFailed)returnedEvent, (CallConnected)returnedEvent); + } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/ConnectFailed.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/ConnectFailed.cs new file mode 100644 index 000000000000..fa49385465f5 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/ConnectFailed.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.CallAutomation +{ + /// + /// The Connect Failed event. + /// + [CodeGenModel("ConnectFailed", Usage = new string[] { "output" }, Formats = new string[] { "json" })] + public partial class ConnectFailed : CallAutomationEventBase + { + /// + /// Deserialize event. + /// + /// The json content. + /// The new object. + public static ConnectFailed Deserialize(string content) + { + using var document = JsonDocument.Parse(content); + JsonElement element = document.RootElement; + + // return DeserializeConnectFailed(element); + return null; + } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/ConnectRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/ConnectRequestInternal.cs new file mode 100644 index 000000000000..55c02b468bc1 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/ConnectRequestInternal.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("ConnectRequest")] + internal partial class ConnectRequestInternal + { + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/CallAutomationEventParser.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/CallAutomationEventParser.cs index 0ece0d38fd11..3c512788c273 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/CallAutomationEventParser.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/CallAutomationEventParser.cs @@ -98,6 +98,8 @@ private static CallAutomationEventBase Deserialize(string eventData, string type return AddParticipantSucceeded.Deserialize(eventData); case nameof(CallConnected): return CallConnected.Deserialize(eventData); + case nameof(ConnectFailed): + return ConnectFailed.Deserialize(eventData); case nameof(CallDisconnected): return CallDisconnected.Deserialize(eventData); case nameof(CallTransferAccepted): @@ -146,6 +148,8 @@ private static CallAutomationEventBase Deserialize(string eventData, string type return TranscriptionStopped.Deserialize(eventData); case nameof(TranscriptionFailed): return TranscriptionFailed.Deserialize(eventData); + case nameof(PlayStarted): + return PlayStarted.Deserialize(eventData); case nameof(AnswerFailed): return AnswerFailed.Deserialize(eventData); case nameof(CreateCallFailed): diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/CollectTonesResult.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/CollectTonesResult.cs deleted file mode 100644 index 5037871e2d4d..000000000000 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/CollectTonesResult.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.Linq; -using Azure.Core; - -namespace Azure.Communication.CallAutomation -{ - [CodeGenModel("CollectTonesResult", Usage = new string[] { "output" }, Formats = new string[] { "json" })] - public partial class CollectTonesResult : RecognizeResult - { - /// - /// The Tones colelcted. - /// - [CodeGenMember("Tones")] - public IReadOnlyList Tones { get; } - - /// - /// The RecognizeResultType of this RecognizeResult. - /// - public override RecognizeResultType ResultType => RecognizeResultType.CollectTonesResult; - - /// - /// Convert the collection of tones to a string like "12345#". - /// - public string ConvertToString() - { - return string.Join("", Tones.Select(x => x.ToChar())); - } - } -} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/HoldFailed.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/HoldFailed.cs index 8e0839ace51b..9449ca356ffc 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/HoldFailed.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/HoldFailed.cs @@ -9,7 +9,6 @@ namespace Azure.Communication.CallAutomation /// /// The Hold Failed event. /// - [CodeGenModel("HoldFailed", Usage = new string[] { "output" }, Formats = new string[] { "json" })] public partial class HoldFailed : CallAutomationEventBase { /// @@ -18,19 +17,15 @@ public partial class HoldFailed : CallAutomationEventBase public MediaEventReasonCode ReasonCode { get; internal set; } /// Initializes a new instance of HoldFailed. - /// Call connection ID. - /// Server call ID. - /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code/sub-code and message from NGC services. - internal HoldFailed(string operationContext, ResultInformation resultInformation, string callConnectionId, string serverCallId, string correlationId) + /// HoldFailedInternal event. + internal HoldFailed(HoldFailedInternal internalEvent) { - CallConnectionId = callConnectionId; - ServerCallId = serverCallId; - CorrelationId = correlationId; - OperationContext = operationContext; - ResultInformation = resultInformation; - ReasonCode = new MediaEventReasonCode(resultInformation.SubCode.ToString()); + CallConnectionId = internalEvent.CallConnectionId; + ServerCallId = internalEvent.ServerCallId; + CorrelationId = internalEvent.CorrelationId; + OperationContext = internalEvent.OperationContext; + ResultInformation = internalEvent.ResultInformation; + ReasonCode = new MediaEventReasonCode(ResultInformation.SubCode.ToString()); } /// @@ -43,7 +38,7 @@ public static HoldFailed Deserialize(string content) using var document = JsonDocument.Parse(content); JsonElement element = document.RootElement; - return DeserializeHoldFailed(element); + return new HoldFailed(HoldFailedInternal.DeserializeHoldFailedInternal(element)); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/HoldFailedInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/HoldFailedInternal.cs new file mode 100644 index 000000000000..4e1888b6efbf --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/HoldFailedInternal.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Text.Json.Serialization; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.CallAutomation +{ + /// + /// The recognize completed event internal. + /// + [CodeGenModel("HoldFailed", Usage = new string[] { "output" }, Formats = new string[] { "json" })] + internal partial class HoldFailedInternal : CallAutomationEventBase + { + /// + /// Reason code. + /// + public MediaEventReasonCode ReasonCode { get; internal set; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/PlayCompleted.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/PlayCompleted.cs index e3b0b52db6a9..235c2097a344 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/PlayCompleted.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/PlayCompleted.cs @@ -9,7 +9,6 @@ namespace Azure.Communication.CallAutomation /// /// The play completed event. /// - [CodeGenModel("PlayCompleted", Usage = new string[] { "output" }, Formats = new string[] { "json" })] public partial class PlayCompleted : CallAutomationEventBase { /// @@ -18,19 +17,15 @@ public partial class PlayCompleted : CallAutomationEventBase public MediaEventReasonCode ReasonCode { get; internal set; } /// Initializes a new instance of PlayCompleted. - /// Call connection ID. - /// Server call ID. - /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code/sub-code and message from NGC services. - internal PlayCompleted(ResultInformation resultInformation, string operationContext, string callConnectionId, string serverCallId, string correlationId) + /// PlayCompletedInternal event. + internal PlayCompleted(PlayCompletedInternal internalEvent) { - CallConnectionId = callConnectionId; - ServerCallId = serverCallId; - CorrelationId = correlationId; - OperationContext = operationContext; - ResultInformation = resultInformation; - ReasonCode = new MediaEventReasonCode(resultInformation.SubCode.ToString()); + CallConnectionId = internalEvent.CallConnectionId; + ServerCallId = internalEvent.ServerCallId; + CorrelationId = internalEvent.CorrelationId; + OperationContext = internalEvent.OperationContext; + ResultInformation = internalEvent.ResultInformation; + ReasonCode = new MediaEventReasonCode(ResultInformation.SubCode.ToString()); } /// @@ -43,7 +38,7 @@ public static PlayCompleted Deserialize(string content) using var document = JsonDocument.Parse(content); JsonElement element = document.RootElement; - return DeserializePlayCompleted(element); + return new PlayCompleted(PlayCompletedInternal.DeserializePlayCompletedInternal(element)); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/PlayCompletedInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/PlayCompletedInternal.cs new file mode 100644 index 000000000000..a7a9872ee338 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/PlayCompletedInternal.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Text.Json.Serialization; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.CallAutomation +{ + /// + /// The recognize completed event internal. + /// + [CodeGenModel("PlayCompleted", Usage = new string[] { "output" }, Formats = new string[] { "json" })] + internal partial class PlayCompletedInternal : CallAutomationEventBase + { + /// + /// Reason code. + /// + public MediaEventReasonCode ReasonCode { get; internal set; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/PlayFailed.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/PlayFailed.cs index fe40d5f574d0..22d639ee2c9c 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/PlayFailed.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/PlayFailed.cs @@ -9,7 +9,6 @@ namespace Azure.Communication.CallAutomation /// /// The Play Failed event. /// - [CodeGenModel("PlayFailed", Usage = new string[] { "output" }, Formats = new string[] { "json" })] public partial class PlayFailed : CallAutomationEventBase { /// @@ -17,20 +16,20 @@ public partial class PlayFailed : CallAutomationEventBase /// public MediaEventReasonCode ReasonCode { get; internal set; } + /// Contains the index of the failed play source. + public int? FailedPlaySourceIndex { get; internal set; } + /// Initializes a new instance of PlayFailed. - /// Call connection ID. - /// Server call ID. - /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code/sub-code and message from NGC services. - internal PlayFailed(string operationContext, ResultInformation resultInformation, string callConnectionId, string serverCallId, string correlationId) + /// PlayFailedInternal event. + internal PlayFailed(PlayFailedInternal internalEvent) { - CallConnectionId = callConnectionId; - ServerCallId = serverCallId; - CorrelationId = correlationId; - OperationContext = operationContext; - ResultInformation = resultInformation; - ReasonCode = new MediaEventReasonCode(resultInformation.SubCode.ToString()); + CallConnectionId = internalEvent.CallConnectionId; + ServerCallId = internalEvent.ServerCallId; + CorrelationId = internalEvent.CorrelationId; + OperationContext = internalEvent.OperationContext; + ResultInformation = internalEvent.ResultInformation; + ReasonCode = new MediaEventReasonCode(ResultInformation.SubCode.ToString()); + FailedPlaySourceIndex = internalEvent.FailedPlaySourceIndex; } /// @@ -43,7 +42,7 @@ public static PlayFailed Deserialize(string content) using var document = JsonDocument.Parse(content); JsonElement element = document.RootElement; - return DeserializePlayFailed(element); + return new PlayFailed(PlayFailedInternal.DeserializePlayFailedInternal(element)); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/PlayFailedInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/PlayFailedInternal.cs new file mode 100644 index 000000000000..980f2440aad2 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/PlayFailedInternal.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Text.Json.Serialization; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.CallAutomation +{ + /// + /// The recognize completed event internal. + /// + [CodeGenModel("PlayFailed", Usage = new string[] { "output" }, Formats = new string[] { "json" })] + internal partial class PlayFailedInternal : CallAutomationEventBase + { + /// + /// Reason code. + /// + public MediaEventReasonCode ReasonCode { get; internal set; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/PlayStarted.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/PlayStarted.cs new file mode 100644 index 000000000000..3fc5a141ac8a --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/PlayStarted.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.CallAutomation +{ + /// + /// The Play Started event. + /// + [CodeGenModel("PlayStarted", Usage = new string[] { "output" }, Formats = new string[] { "json" })] + public partial class PlayStarted : CallAutomationEventBase + { + /// + /// Deserialize event. + /// + /// The json content. + /// The new object. + public static PlayStarted Deserialize(string content) + { + using var document = JsonDocument.Parse(content); + JsonElement element = document.RootElement; + + return DeserializePlayStarted(element); + } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/RecognizeFailed.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/RecognizeFailed.cs index a94ba4d6fb90..2e063d8583ed 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/RecognizeFailed.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/RecognizeFailed.cs @@ -9,7 +9,6 @@ namespace Azure.Communication.CallAutomation /// /// The Recognize failed event. /// - [CodeGenModel("RecognizeFailed", Usage = new string[] { "output" }, Formats = new string[] { "json" })] public partial class RecognizeFailed : CallAutomationEventBase { /// @@ -17,20 +16,20 @@ public partial class RecognizeFailed : CallAutomationEventBase /// public MediaEventReasonCode ReasonCode { get; internal set; } + /// Contains the index of the failed play source. + public int? FailedPlaySourceIndex { get; internal set; } + /// Initializes a new instance of RecognizeFailed. - /// Call connection ID. - /// Server call ID. - /// Correlation ID for event to call correlation. Also called ChainId for skype chain ID. - /// Used by customers when calling mid-call actions to correlate the request to the response event. - /// Contains the resulting SIP code/sub-code and message from NGC services. - internal RecognizeFailed(string operationContext, ResultInformation resultInformation, string callConnectionId, string serverCallId, string correlationId) + /// RecognizeFailedInternal event + internal RecognizeFailed(RecognizeFailedInternal internalEvent) { - CallConnectionId = callConnectionId; - ServerCallId = serverCallId; - CorrelationId = correlationId; - OperationContext = operationContext; - ResultInformation = resultInformation; - ReasonCode = new MediaEventReasonCode(resultInformation.SubCode.ToString()); + CallConnectionId = internalEvent.CallConnectionId; + ServerCallId = internalEvent.ServerCallId; + CorrelationId = internalEvent.CorrelationId; + OperationContext = internalEvent.OperationContext; + ResultInformation = internalEvent.ResultInformation; + ReasonCode = new MediaEventReasonCode(ResultInformation.SubCode.ToString()); + FailedPlaySourceIndex = internalEvent.FailedPlaySourceIndex; } /// @@ -43,7 +42,7 @@ public static RecognizeFailed Deserialize(string content) using var document = JsonDocument.Parse(content); JsonElement element = document.RootElement; - return DeserializeRecognizeFailed(element); + return new RecognizeFailed(RecognizeFailedInternal.DeserializeRecognizeFailedInternal(element)); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/RecognizeFailedInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/RecognizeFailedInternal.cs new file mode 100644 index 000000000000..3453a083beae --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/RecognizeFailedInternal.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Text.Json.Serialization; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.CallAutomation +{ + /// + /// The recognize completed event internal. + /// + [CodeGenModel("RecognizeFailed", Usage = new string[] { "output" }, Formats = new string[] { "json" })] + internal partial class RecognizeFailedInternal : CallAutomationEventBase + { + /// + /// Reason code. + /// + public MediaEventReasonCode ReasonCode { get; internal set; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/TranscriptionFailed.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/TranscriptionFailed.cs index 9b5dd5baa4e2..54ab3e315b2d 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/TranscriptionFailed.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/TranscriptionFailed.cs @@ -13,6 +13,11 @@ namespace Azure.Communication.CallAutomation [CodeGenModel("TranscriptionFailed", Usage = new string[] { "output" }, Formats = new string[] { "json" })] public partial class TranscriptionFailed : CallAutomationEventBase { + /// + /// Reason code. + /// + public MediaEventReasonCode ReasonCode { get; internal set; } + /// /// Deserialize event. /// diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/HoldOptions.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/HoldOptions.cs index bfaec92d42f6..e0abe4cd6b53 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/HoldOptions.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/HoldOptions.cs @@ -26,7 +26,7 @@ public HoldOptions(CommunicationIdentifier targetParticipant) /// /// Prompt to play while on hold. /// - public PlaySource PlaySourceInfo { get; set; } + public PlaySource PlaySource { get; set; } /// /// The operation context to correlate the request to the response event. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/HoldResult.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/HoldResult.cs new file mode 100644 index 000000000000..6f299ff1c513 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/HoldResult.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Threading.Tasks; +using System; +using System.Threading; + +namespace Azure.Communication.CallAutomation +{ + /// The result from playing audio. + public class HoldResult + { + private CallAutomationEventProcessor _evHandler; + private string _callConnectionId; + private string _operationContext; + + internal HoldResult() + { + } + + internal void SetEventProcessor(CallAutomationEventProcessor evHandler, string callConnectionId, string operationContext) + { + _evHandler = evHandler; + _callConnectionId = callConnectionId; + _operationContext = operationContext; + } + + /// + /// This is blocking call. Wait for using . + /// + /// Cancellation Token can be used to set timeout or cancel this WaitForEventProcessor. + /// Returns which contains either event or event. + public HoldEventResult WaitForEventProcessor(CancellationToken cancellationToken = default) + { + if (_evHandler is null) + { + throw new NullReferenceException(nameof(_evHandler)); + } + + var returnedEvent = _evHandler.WaitForEventProcessor(filter + => filter.CallConnectionId == _callConnectionId + && (filter.OperationContext == _operationContext || _operationContext is null) + && (filter.GetType() == typeof(HoldFailed)), + cancellationToken); + + return SetReturnedEvent(returnedEvent); + } + + /// + /// Wait for using . + /// + /// Cancellation Token can be used to set timeout or cancel this WaitForEventProcessor. + /// Returns which contains event. + public async Task WaitForEventProcessorAsync(CancellationToken cancellationToken = default) + { + if (_evHandler is null) + { + throw new NullReferenceException(nameof(_evHandler)); + } + + var returnedEvent = await _evHandler.WaitForEventProcessorAsync(filter + => filter.CallConnectionId == _callConnectionId + && (filter.OperationContext == _operationContext || _operationContext is null) + && (filter.GetType() == typeof(HoldFailed)), + cancellationToken).ConfigureAwait(false); + + return SetReturnedEvent(returnedEvent); + } + + private static HoldEventResult SetReturnedEvent(CallAutomationEventBase returnedEvent) + { + HoldEventResult result = default; + switch (returnedEvent) + { + case HoldFailed: + result = new HoldEventResult(false, (HoldFailed)returnedEvent); + break; + default: + throw new NotSupportedException(returnedEvent.GetType().Name); + } + + return result; + } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/InterruptAudioAndAnnounceRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/InterruptAudioAndAnnounceRequestInternal.cs new file mode 100644 index 000000000000..e1375cf90f40 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/InterruptAudioAndAnnounceRequestInternal.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("InterruptAudioAndAnnounceRequest")] + internal partial class InterruptAudioAndAnnounceRequestInternal + { + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/MediaStreamingConfiguration.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/MediaStreamingConfiguration.cs deleted file mode 100644 index 5a6fb4056a93..000000000000 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/MediaStreamingConfiguration.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; - -namespace Azure.Communication.CallAutomation -{ - /// The MediaStreamingConfiguration. - public class MediaStreamingConfiguration - { - /// Initializes a new instance of MediaStreamingConfiguration. - public MediaStreamingConfiguration(Uri transportUrl, MediaStreamingTransport transportType, - MediaStreamingContent contentType, MediaStreamingAudioChannel audioChannelType) - { - TransportUrl = transportUrl; - TransportType = transportType; - ContentType = contentType; - AudioChannelType = audioChannelType; - } - - /// Transport URL for media streaming. - public Uri TransportUrl { get; } - /// The type of tranport to be used for media streaming, eg. Websocket. - public MediaStreamingTransport TransportType { get; } - /// Content type to stream, eg. audio, audio/video. - public MediaStreamingContent ContentType { get; } - /// Audio channel type to stream, eg. unmixed audio, mixed audio. - public MediaStreamingAudioChannel AudioChannelType { get; } - } -} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/MediaStreamingContent.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/MediaStreamingContent.cs index 89234cc8b867..a4d674d8c911 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/MediaStreamingContent.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/MediaStreamingContent.cs @@ -1,15 +1,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; +using System.Text.Json.Serialization; using Azure.Core; namespace Azure.Communication.CallAutomation { - /// - /// The states of a call. - /// - [CodeGenModel("MediaStreamingContentType", Usage = new string[] { "input" }, Formats = new string[] { "json" })] - public readonly partial struct MediaStreamingContent + [CodeGenModel("MediaStreamingContentType", Usage = new string[] { "output" }, Formats = new string[] { "json" })] + [JsonConverter(typeof(EquatableEnumJsonConverter))] + public readonly partial struct MediaStreamingContent : IEquatable { } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/MediaStreamingOptions.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/MediaStreamingOptions.cs index a6725f3cbcf5..ca3beaa2dc5b 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/MediaStreamingOptions.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/MediaStreamingOptions.cs @@ -9,13 +9,14 @@ namespace Azure.Communication.CallAutomation public class MediaStreamingOptions { /// Initializes a new instance of MediaStreamingOptions. - public MediaStreamingOptions(Uri transportUri, MediaStreamingTransport transportType, - MediaStreamingContent contentType, MediaStreamingAudioChannel audioChannelType) + public MediaStreamingOptions(Uri transportUri, + MediaStreamingContent contentType, MediaStreamingAudioChannel audioChannelType, MediaStreamingTransport transportType = default, bool? startMediaStreaming = null) { TransportUri = transportUri; MediaStreamingTransport = transportType; MediaStreamingContent = contentType; MediaStreamingAudioChannel = audioChannelType; + StartMediaStreaming = startMediaStreaming; } /// Transport URL for media streaming. @@ -26,5 +27,11 @@ public MediaStreamingOptions(Uri transportUri, MediaStreamingTransport transport public MediaStreamingContent MediaStreamingContent { get; } /// Audio channel type to stream, eg. unmixed audio, mixed audio. public MediaStreamingAudioChannel MediaStreamingAudioChannel { get; } + /// Determines if the media streaming should be started immediately after call is answered or not. + public bool? StartMediaStreaming { get; set; } + /// A value indicating whether bidirectional streaming is enabled. + public bool? EnableBidirectional { get; set; } + /// Specifies the audio format used for encoding, including sample rate and channel type. + public AudioFormat? AudioFormat { get; set; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/MediaStreamingOptionsInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/MediaStreamingOptionsInternal.cs index a316fd34c49c..cc3594cf3d56 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/MediaStreamingOptionsInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/MediaStreamingOptionsInternal.cs @@ -5,7 +5,7 @@ namespace Azure.Communication.CallAutomation { - [CodeGenModel("MediaStreamingConfiguration")] + [CodeGenModel("MediaStreamingOptions")] internal partial class MediaStreamingOptionsInternal { } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/MediaStreamingSubscription.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/MediaStreamingSubscription.cs new file mode 100644 index 000000000000..8d010a4b771e --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/MediaStreamingSubscription.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; + +namespace Azure.Communication.CallAutomation +{ + /// The MediaStreamingSubscription. + public class MediaStreamingSubscription + { + /// Initializes a new instance of . + /// Gets or Sets subscription Id. + /// Gets or Sets media streaming subscription state. + /// Gets or Sets the subscribed media streaming content types. + public MediaStreamingSubscription(string id, MediaStreamingSubscriptionState? state, IReadOnlyList subscribedContentTypes) + { + Id = id; + State = state; + SubscribedContentTypes = subscribedContentTypes; + } + + /// Gets or Sets subscription Id. + public string Id { get; } + /// Gets or Sets media streaming subscription state. + public MediaStreamingSubscriptionState? State { get; } + /// Gets or Sets the subscribed media streaming content types. + public IReadOnlyList SubscribedContentTypes { get; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/MediaStreamingSubscriptionInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/MediaStreamingSubscriptionInternal.cs new file mode 100644 index 000000000000..5b2349783807 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/MediaStreamingSubscriptionInternal.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("MediaStreamingSubscription")] + internal partial class MediaStreamingSubscriptionInternal + { + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/MediaStreamingSubscriptionState.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/MediaStreamingSubscriptionState.cs new file mode 100644 index 000000000000..93319cf11ca0 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/MediaStreamingSubscriptionState.cs @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Text.Json.Serialization; +using Azure.Core; + +namespace Azure.Communication.CallAutomation +{ + [CodeGenModel("MediaStreamingSubscriptionState", Usage = new string[] { "output" }, Formats = new string[] { "json" })] + [JsonConverter(typeof(EquatableEnumJsonConverter))] + public readonly partial struct MediaStreamingSubscriptionState : IEquatable + { + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/RecognizeRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/RecognizeRequestInternal.cs index 18389273af11..3c3f95d20ae4 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/RecognizeRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/RecognizeRequestInternal.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Collections.Generic; using Azure.Core; namespace Azure.Communication.CallAutomation @@ -8,5 +9,7 @@ namespace Azure.Communication.CallAutomation [CodeGenModel("RecognizeRequest")] internal partial class RecognizeRequestInternal { + [CodeGenMember("PlayPrompts")] + public IList PlayPrompts { get; set; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/RoomCallLocator.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/RoomCallLocator.cs new file mode 100644 index 000000000000..0acbeaf062ad --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/RoomCallLocator.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core; + +namespace Azure.Communication.CallAutomation +{ + /// The room call locator. + public class RoomCallLocator : CallLocator + { + /// + /// Initializes a new instance of . + /// + /// The room call id. + /// + /// Thrown when the is null. + /// + /// + /// Thrown when the is empty. + /// + public RoomCallLocator(string id) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Id = id; + } + + /// + public override string ToString() => Id; + + /// + public override int GetHashCode() => Id.GetHashCode(); + + /// + public override bool Equals(CallLocator other) + => other is RoomCallLocator otherId && otherId.Id == Id; + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/StartMediaStreamingOptions.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/StartMediaStreamingOptions.cs new file mode 100644 index 000000000000..9736523b3e3d --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/StartMediaStreamingOptions.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; + +namespace Azure.Communication.CallAutomation +{ + /// + /// Options for the Start Media Streaming Request. + /// + public class StartMediaStreamingOptions + { + /// + /// 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. + /// + public Uri OperationCallbackUri { get; set; } + + /// The value to identify context of the operation. + public string OperationContext { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/StartTranscriptionOptions.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/StartTranscriptionOptions.cs index 7c88f00a3c0b..c0ff74711ea2 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/StartTranscriptionOptions.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/StartTranscriptionOptions.cs @@ -13,8 +13,14 @@ public class StartTranscriptionOptions { /// Defines Locale for the transcription e,g en-US. public string Locale { get; set; } - + /// Endpoint where the custom model was deployed. + public string SpeechRecognitionModelEndpointId { get; set; } /// The value to identify context of the operation. public string OperationContext { get; set; } + /// + /// 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. + /// + public string OperationCallbackUri { get; set; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/StopMediaStreamingOptions.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/StopMediaStreamingOptions.cs new file mode 100644 index 000000000000..75d30ed3f5cc --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/StopMediaStreamingOptions.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; + +namespace Azure.Communication.CallAutomation +{ + /// + /// Options for the Stop Media Streaming Request. + /// + public class StopMediaStreamingOptions + { + /// + /// 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. + /// + public Uri OperationCallbackUri { get; set; } + + /// The value to identify context of the operation. + public string OperationContext { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/StopTranscriptionOptions.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/StopTranscriptionOptions.cs index 7973652d6a58..5bb98b762797 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/StopTranscriptionOptions.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/StopTranscriptionOptions.cs @@ -13,5 +13,13 @@ public class StopTranscriptionOptions { /// The value to identify context of the operation. public string OperationContext { get; set; } + + /// Endpoint where the custom model was deployed. + public string SpeechRecognitionModelEndpointId { get; set; } + /// + /// 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. + /// + public string OperationCallbackUri { get; set; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Media/AudioChannel.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Media/AudioChannel.cs new file mode 100644 index 000000000000..e2e4c0cbfb37 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Media/AudioChannel.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Text.Json.Serialization; + +namespace Azure.Communication.CallAutomation +{ + /// + /// Specifies the Audio Channels + /// + [JsonConverter(typeof(JsonStringEnumConverter))] + public enum AudioChannel + { + /// + /// Unknown Audio channel type + /// + Unknown = 0, + + /// + /// Audio channel type + /// F + Mono = 1, + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Media/AudioData.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Media/AudioData.cs index fa9ee97eb31e..f8fc678fa696 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Media/AudioData.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Media/AudioData.cs @@ -10,33 +10,45 @@ namespace Azure.Communication.CallAutomation /// public class AudioData : StreamingData { - internal AudioData(string data, DateTime timestamp, string participantId, bool silent) + /// + /// The audio data, encoded as a base64 string + /// + /// + public AudioData(byte[] data) { Data = data; + } + + internal AudioData(string data, DateTime timestamp, string participantId, bool silent) + { + Data = !string.IsNullOrWhiteSpace(data) ? Convert.FromBase64String(data) : default; Timestamp = timestamp; if (participantId != null) { - Participant = CommunicationIdentifier.FromRawId(participantId);; + Participant = CommunicationIdentifier.FromRawId(participantId); } IsSilent = silent; } /// - /// The audio data in base64 string. + /// The audio data in base64 byte. /// - public string Data { get; } + public byte[] Data { get; } /// - /// The timestamp of thwn the media was sourced. + /// The timestamp indicating when the media content was received by the bot, + /// or if the bot is sending media, the timestamp of when the media was sourced. + /// The format is ISO 8601 (yyyy-mm-ddThh:mm). /// - public DateTime Timestamp { get; } + public DateTimeOffset Timestamp { get; } + /// - /// Participant ID + /// The raw ID of the participant. /// public CommunicationIdentifier Participant { get; } /// - /// Indicates if the received audio buffer contains only silence. + /// Indicates whether the received audio buffer contains only silence. /// public bool IsSilent { get; } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Media/AudioMetadata.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Media/AudioMetadata.cs index 015ac85f9632..552fa8756cbf 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Media/AudioMetadata.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Media/AudioMetadata.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System.Text.Json.Serialization; - namespace Azure.Communication.CallAutomation { /// @@ -10,31 +8,36 @@ namespace Azure.Communication.CallAutomation /// public class AudioMetadata : StreamingData { + internal AudioMetadata(AudioMetadataInternal audioMetadataInternal) + { + MediaSubscriptionId = audioMetadataInternal.MediaSubscriptionId; + Encoding = audioMetadataInternal.Encoding; + SampleRate = audioMetadataInternal.SampleRate; + Channels = (AudioChannel)audioMetadataInternal.Channels; + Length = audioMetadataInternal.Length; + } + /// - /// Subscription Id. + /// A unique identifier for the media subscription. /// - [JsonPropertyName("subscriptionId")] public string MediaSubscriptionId { get; set; } /// - /// The Encoding. + /// The format used to encode the audio. Currently, only "pcm" (Pulse Code Modulation) is supported. /// - [JsonPropertyName("encoding")] public string Encoding { get; set; } /// - /// Sample Rate. + /// The number of samples per second in the audio. Supported values are 16kHz or 24kHz. /// - [JsonPropertyName("sampleRate")] public int SampleRate { get; set; } /// - /// Channels. + /// Specifies the number of audio channels in the audio configuration. + /// Currently, only "mono" (single channel) is supported. /// - [JsonPropertyName("channels")] - public int Channels { get; set; } + public AudioChannel Channels { get; set; } /// - /// Length. + /// The size of the audio data being sent, based on the sample rate and duration. /// - [JsonPropertyName("length")] public int Length { get; set; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Media/AudioMetadataInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Media/AudioMetadataInternal.cs new file mode 100644 index 000000000000..b34de464cdbc --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Media/AudioMetadataInternal.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Text.Json.Serialization; + +namespace Azure.Communication.CallAutomation +{ + /// + /// Internal Metadata model for Audio Streaming. + /// + internal class AudioMetadataInternal + { + /// + /// A unique identifier for the media subscription. + /// + [JsonPropertyName("subscriptionId")] + public string MediaSubscriptionId { get; set; } + + /// + /// The format used to encode the audio. Currently, only "pcm" (Pulse Code Modulation) is supported. + /// + [JsonPropertyName("encoding")] + public string Encoding { get; set; } + /// + /// The number of samples per second in the audio. Supported values are 16kHz or 24kHz. + /// + [JsonPropertyName("sampleRate")] + public int SampleRate { get; set; } + /// + /// Specifies the number of audio channels in the audio configuration. + /// Currently, only "mono" (single channel) is supported. + /// + [JsonPropertyName("channels")] + public int Channels { get; set; } + /// + /// The size of the audio data being sent, based on the sample rate and duration. + /// + [JsonPropertyName("length")] + public int Length { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Media/MediaKind.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Media/MediaKind.cs new file mode 100644 index 000000000000..574c5d61d9bb --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Media/MediaKind.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Text.Json.Serialization; + +namespace Azure.Communication.CallAutomation +{ + /// + /// Messages sent from websocket server + /// + [JsonConverter(typeof(JsonStringEnumConverter))] + public enum MediaKind + { + /// + /// Audio data type + /// F + AudioData, + /// + /// stop audio data type + /// + StopAudio + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Media/StopAudio.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Media/StopAudio.cs new file mode 100644 index 000000000000..1c4ae59012c6 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Media/StopAudio.cs @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Azure.Communication.CallAutomation +{ + /// + /// Stop Streaming Audio. + /// + public class StopAudio + { + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/OutStreamingData.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/OutStreamingData.cs new file mode 100644 index 000000000000..b3818f20b308 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/OutStreamingData.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Text.Json; + +namespace Azure.Communication.CallAutomation +{ + /// + /// Base class for Out Streaming Data + /// + public class OutStreamingData + { + /// + /// Create the new instance of outstreamingdata with kind + /// + /// + internal OutStreamingData(MediaKind kind) + { + this.Kind = kind; + } + + /// + /// Out streaming data kind ex. StopAudio, AudioData + /// + public MediaKind Kind { get; } + + /// + /// Out streaming Audio Data + /// + public AudioData AudioData { get; internal set; } + + /// + /// Out streaming Stop Audio Data + /// s + public StopAudio StopAudio { get; internal set; } + + /// + /// Get the streaming data for outbound + /// + /// + /// the string of outstreaming data + public static string GetAudioDataForOutbound(byte[] audioData) + { + // Create a ServerAudioData object for this chunk + var audio = new OutStreamingData(MediaKind.AudioData) + { + AudioData = new AudioData(audioData) + }; + // Serialize the JSON object to a string + return JsonSerializer.Serialize(audio); + } + + /// + /// Get the stop audiofor outbound + /// + /// the string of outstreaming data with the stop audio. + public static string GetStopAudioForOutbound() + { + var jsonObject = new OutStreamingData(MediaKind.StopAudio) + { + StopAudio = new StopAudio() + }; + + // Serialize the JSON object to a string + return JsonSerializer.Serialize(jsonObject); + } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/StreamingData.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/StreamingData.cs index 63ca3a12d21b..532a3672ec27 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/StreamingData.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/StreamingData.cs @@ -1,6 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; +using System.Text.Json; + namespace Azure.Communication.CallAutomation { /// @@ -8,5 +11,83 @@ namespace Azure.Communication.CallAutomation /// public abstract class StreamingData { + /// + /// Kind of the streaming data ex.AudioData, AudioMetadata, TranscriptionData, TranscriptionMetadata. + /// + public static StreamingDataKind Kind { get; internal set; } + + /// + /// Parses a base64 encoded string into a StreamingData object, + /// which can be one of the following subtypes: AudioData, AudioMetadata, TranscriptionData, or TranscriptionMetadata. + /// + /// The base64 string represents streaming data that will be converted into the appropriate subtype of StreamingData. + /// the type of StreamingData. + /// Throws a NotSupportedException if the provided base64 string does not correspond + /// to a supported data type for the specified Kind. + public static StreamingData Parse(string data) + { + return ParseStreamingData(data); + } + + /// + /// Parses a base64 encoded string into a StreamingData object, + /// which can be one of the following subtypes: AudioData, AudioMetadata, TranscriptionData, or TranscriptionMetadata. + /// + /// Subtypes of StreamingData -> AudioData, AudioMetadata, TranscriptionData, or TranscriptionMetadata + /// The base64 string represents streaming data that will be converted into the appropriate subtype of StreamingData. + /// the type of StreamingData. + /// Throws a NotSupportedException if the provided base64 string does not correspond + /// to a supported data type for the specified Kind. + public static T Parse(string data) where T : StreamingData + { + return (T)ParseStreamingData(data); + } + + private static StreamingData ParseStreamingData(string base64Data) + { + JsonElement streamingData = JsonDocument.Parse(base64Data).RootElement; + + string kind = streamingData.GetProperty("kind").ToString(); + Kind = (StreamingDataKind)Enum.Parse(typeof(StreamingDataKind), kind); + + switch (kind) + { + #region Audio + case "AudioMetadata": + var audioMetadataInternal = JsonSerializer.Deserialize(streamingData.GetProperty("audioMetadata").ToString()); + return new AudioMetadata(audioMetadataInternal); + + case "AudioData": + AudioDataInternal audioInternal = JsonSerializer.Deserialize(streamingData.GetProperty("audioData").ToString()); + return new AudioData( + audioInternal.Data, audioInternal.Timestamp, audioInternal.ParticipantRawId, audioInternal.Silent); + + #endregion + + #region Transcription + case "TranscriptionMetadata": + return JsonSerializer.Deserialize(streamingData.GetProperty("transcriptionMetadata").ToString()); + + case "TranscriptionData": + TranscriptionDataInternal transcriptionDataInternal = JsonSerializer.Deserialize( + streamingData.GetProperty("transcriptionData").ToString() + ); + return new TranscriptionData( + transcriptionDataInternal.Text, + transcriptionDataInternal.Format, + transcriptionDataInternal.Confidence, + transcriptionDataInternal.Offset, + transcriptionDataInternal.Duration, + transcriptionDataInternal.Words, + transcriptionDataInternal.ParticipantRawID, + transcriptionDataInternal.ResultState + ); + + #endregion + + default: + throw new NotSupportedException($"The provided base64 string does not correspond to a supported data type for the Kind: {Kind}"); + } + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/StreamingDataKind.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/StreamingDataKind.cs new file mode 100644 index 000000000000..9c33e973a5d8 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/StreamingDataKind.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Text.Json.Serialization; + +namespace Azure.Communication.CallAutomation +{ + /// + /// Kind of streaming data when websocket receives the data + /// + [JsonConverter(typeof(JsonStringEnumConverter))] + public enum StreamingDataKind + { + /// + /// Audio data type + /// + AudioData, + /// + /// Audio metadata type + /// + AudioMetadata, + /// + /// Transcription data type + /// + TranscriptionData, + /// + /// Transcription metadata type + /// + TranscriptionMetadata + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/StreamingDataParser.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/StreamingDataParser.cs index c544fb05716e..33708357369d 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/StreamingDataParser.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/StreamingDataParser.cs @@ -16,11 +16,11 @@ public static class StreamingDataParser /// /// Parsing a MediaStreaming package from BinaryData. /// - /// + /// /// - public static StreamingData Parse(BinaryData json) + public static StreamingData Parse(BinaryData binaryData) { - return Parse(json.ToString()); + return Parse(binaryData.ToString()); } /// @@ -74,10 +74,10 @@ public static StreamingData Parse(string stringJson) transcriptionDataInternal.Duration, transcriptionDataInternal.Words, transcriptionDataInternal.ParticipantRawID, - transcriptionDataInternal.ResultStatus + transcriptionDataInternal.ResultState ); - #endregion + #endregion default: throw new NotSupportedException(stringJson); diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Transcription/ResultStatus.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Transcription/ResultStatus.cs deleted file mode 100644 index 54387c86fef2..000000000000 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Transcription/ResultStatus.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace Azure.Communication.CallAutomation -{ - /// - /// The status of the result of transcription - /// - public enum ResultStatus - { - /// - /// Intermediate result - /// - Intermediate, - - /// - /// Final result - /// - Final - } -} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Transcription/TranscriptionData.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Transcription/TranscriptionData.cs index 6b6cd4ee4276..c875122cbd59 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Transcription/TranscriptionData.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Transcription/TranscriptionData.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.Communication.CallAutomation { @@ -11,19 +12,19 @@ namespace Azure.Communication.CallAutomation /// public class TranscriptionData : StreamingData { - internal TranscriptionData(string text, string format, double confidence, ulong offset, ulong duration, IEnumerable words, string participantRawID, string resultStatus) + internal TranscriptionData(string text, string format, double confidence, long offset, long duration, IEnumerable words, string participantRawID, TranscriptionResultState resultState) { Text = text; Format = ConvertToTextFormatEnum(format); Confidence = confidence; - Offset = offset; - Duration = duration; - Words = words; + Offset = TimeSpan.FromTicks(offset); + Duration = TimeSpan.FromTicks(duration); + Words = ConvertToWordData(words); if (participantRawID != null) { Participant = CommunicationIdentifier.FromRawId(participantRawID); } - ResultStatus = ConvertToResultStatusEnum(resultStatus); + ResultState = resultState; } /// @@ -45,12 +46,12 @@ internal TranscriptionData(string text, string format, double confidence, ulong /// The position of this payload /// - public ulong Offset { get; set; } + public TimeSpan Offset { get; set; } /// /// Duration in ticks. 1 tick = 100 nanoseconds. /// - public ulong Duration { get; set; } + public TimeSpan Duration { get; set; } /// /// The result for each word of the phrase @@ -65,24 +66,19 @@ internal TranscriptionData(string text, string format, double confidence, ulong /// /// Status of the result of transcription /// - public ResultStatus ResultStatus { get; set; } - - private static ResultStatus ConvertToResultStatusEnum(string resultStatus) - { - if ("Intermediate".Equals(resultStatus, StringComparison.OrdinalIgnoreCase)) - return ResultStatus.Intermediate; - else if ("Final".Equals(resultStatus, StringComparison.OrdinalIgnoreCase)) - return ResultStatus.Final; - else - throw new NotSupportedException(resultStatus); - } + public TranscriptionResultState ResultState { get; set; } private static TextFormat ConvertToTextFormatEnum(string format) { - if ("Display".Equals(format, StringComparison.OrdinalIgnoreCase)) + if (TextFormat.Display.ToString().Equals(format, StringComparison.OrdinalIgnoreCase)) return TextFormat.Display; else throw new NotSupportedException(format); } + + private static IEnumerable ConvertToWordData(IEnumerable wordData) + { + return wordData.Select(w => new WordData(w.Text, w.Offset, w.Duration)); + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Transcription/TranscriptionDataInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Transcription/TranscriptionDataInternal.cs index 9e37c5c6a273..c0f5572db0e7 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Transcription/TranscriptionDataInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Transcription/TranscriptionDataInternal.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; using System.Collections.Generic; using System.Text.Json.Serialization; @@ -34,19 +35,19 @@ internal class TranscriptionDataInternal /// [JsonPropertyName("offset")] - public ulong Offset { get; set; } + public long Offset { get; set; } /// /// Duration in ticks. 1 tick = 100 nanoseconds. /// [JsonPropertyName("duration")] - public ulong Duration { get; set; } + public long Duration { get; set; } /// /// The result for each word of the phrase /// [JsonPropertyName("words")] - public IEnumerable Words { get; set; } + public IEnumerable Words { get; set; } /// /// The identified speaker based on participant raw ID @@ -58,6 +59,6 @@ internal class TranscriptionDataInternal /// Status of the result of transcription /// [JsonPropertyName("resultStatus")] - public string ResultStatus { get; set; } + public TranscriptionResultState ResultState { get; set; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Transcription/WordData.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Transcription/WordData.cs index df490a3799bf..61eb609ce12c 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Transcription/WordData.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Transcription/WordData.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; using System.Text.Json.Serialization; namespace Azure.Communication.CallAutomation @@ -10,6 +11,19 @@ namespace Azure.Communication.CallAutomation /// public class WordData { + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + internal WordData(string text, long offset, long duration) + { + Text = text; + Offset = TimeSpan.FromTicks(offset); + Duration = TimeSpan.FromTicks(duration); + } + /// /// Text in the phrase. /// @@ -19,12 +33,12 @@ public class WordData /// The word's position within the phrase. /// [JsonPropertyName("offset")] - public ulong Offset { get; set; } + public TimeSpan Offset { get; set; } /// /// Duration in ticks. 1 tick = 100 nanoseconds. /// [JsonPropertyName("duration")] - public ulong Duration { get; set; } + public TimeSpan Duration { get; set; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Transcription/WordDataInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Transcription/WordDataInternal.cs new file mode 100644 index 000000000000..c0f138b71b21 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Streaming/Transcription/WordDataInternal.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Text.Json.Serialization; + +namespace Azure.Communication.CallAutomation +{ + /// + /// The result for each word of the phrase + /// + internal class WordDataInternal + { + /// + /// Text in the phrase. + /// + [JsonPropertyName("text")] + public string Text { get; set; } + /// + /// The word's position within the phrase. + /// + [JsonPropertyName("offset")] + public long Offset { get; set; } + + /// + /// Duration in ticks. 1 tick = 100 nanoseconds. + /// + [JsonPropertyName("duration")] + public long Duration { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/TranscriptionOptions.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/TranscriptionOptions.cs index 28f5687b881f..25fd37a98a0f 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/TranscriptionOptions.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/TranscriptionOptions.cs @@ -15,17 +15,17 @@ public partial class TranscriptionOptions { /// Initializes a new instance of TranscriptionOptions. /// Transport URL for live transcription. - /// The type of transport to be used for live transcription, eg. Websocket. /// Defines the locale for the data e.g en-CA, en-AU. /// Determines if the transcription should be started immediately after call is answered or not. + /// The type of transport to be used for live transcription, eg. Websocket. /// or is null. - public TranscriptionOptions(Uri transportUri, TranscriptionTransport transportType, string locale, bool startTranscription) + public TranscriptionOptions(Uri transportUri, string locale, bool? startTranscription = null, TranscriptionTransport transcriptionTransport = default) { Argument.AssertNotNull(transportUri, nameof(transportUri)); Argument.AssertNotNull(locale, nameof(locale)); TransportUrl = transportUri; - TranscriptionTransport = transportType; + TranscriptionTransport = transcriptionTransport; Locale = locale; StartTranscription = startTranscription; } @@ -37,6 +37,10 @@ public TranscriptionOptions(Uri transportUri, TranscriptionTransport transportTy /// Defines the locale for the data e.g en-CA, en-AU. public string Locale { get; } /// Determines if the transcription should be started immediately after call is answered or not. - public bool StartTranscription { get; } + public bool? StartTranscription { get; } + /// Endpoint where the custom model was deployed. + public string SpeechRecognitionModelEndpointId { get; set; } + /// Enables intermediate results for the transcribed speech. + public bool? EnableIntermediateResults { get; set; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/TranscriptionOptionsInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/TranscriptionOptionsInternal.cs index 4832ba8e5fcb..5e19efdd11f9 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/TranscriptionOptionsInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/TranscriptionOptionsInternal.cs @@ -5,7 +5,7 @@ namespace Azure.Communication.CallAutomation { - [CodeGenModel("TranscriptionConfiguration")] + [CodeGenModel("TranscriptionOptions")] internal partial class TranscriptionOptionsInternal { } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/TranscriptionResultState.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/TranscriptionResultState.cs new file mode 100644 index 000000000000..1b0634b1e85a --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/TranscriptionResultState.cs @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Text.Json.Serialization; +using Azure.Core; + +namespace Azure.Communication.CallAutomation +{ + [CodeGenModel("TranscriptionResultType", Usage = new string[] { "output" }, Formats = new string[] { "json" })] + [JsonConverter(typeof(EquatableEnumJsonConverter))] + public readonly partial struct TranscriptionResultState : IEquatable + { + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/TranscriptionSubscription.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/TranscriptionSubscription.cs new file mode 100644 index 000000000000..3cb87c1ad50b --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/TranscriptionSubscription.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; + +namespace Azure.Communication.CallAutomation +{ + /// The TranscriptionSubscription. + public class TranscriptionSubscription + { + /// Initializes a new instance of . + /// Gets or Sets subscription Id. + /// Gets or Sets media streaming subscription state. + /// Gets or Sets the subscribed media streaming content types. + internal TranscriptionSubscription(string id, TranscriptionSubscriptionState? state, IReadOnlyList subscribedResultStates) + { + Id = id; + State = state; + SubscribedResultStates = subscribedResultStates; + } + + /// Gets or Sets subscription Id. + public string Id { get; } + /// Gets or Sets transcription subscription state. + public TranscriptionSubscriptionState? State { get; } + /// Gets or Sets the subscribed transcription result types. + public IReadOnlyList SubscribedResultStates { get; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/TranscriptionSubscriptionInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/TranscriptionSubscriptionInternal.cs new file mode 100644 index 000000000000..a289488d8020 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/TranscriptionSubscriptionInternal.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("TranscriptionSubscription")] + internal partial class TranscriptionSubscriptionInternal + { + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/TranscriptionSubscriptionState.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/TranscriptionSubscriptionState.cs new file mode 100644 index 000000000000..4b1d9bc489e5 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/TranscriptionSubscriptionState.cs @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Text.Json.Serialization; +using Azure.Core; + +namespace Azure.Communication.CallAutomation +{ + [CodeGenModel("TranscriptionSubscriptionState", Usage = new string[] { "output" }, Formats = new string[] { "json" })] + [JsonConverter(typeof(EquatableEnumJsonConverter))] + public readonly partial struct TranscriptionSubscriptionState : IEquatable + { + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/UpdateTranscriptionOptions.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/UpdateTranscriptionOptions.cs new file mode 100644 index 000000000000..390c688cbd79 --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/UpdateTranscriptionOptions.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Azure.Communication.CallAutomation +{ + /// + /// Options for the stop transcription Request. + /// + public class UpdateTranscriptionOptions + { + /// + /// Options for the Update Transcription operation. + /// + public UpdateTranscriptionOptions(string locale) + { + this.Locale = locale; + } + + /// Defines Locale for the transcription e,g en-US. + internal string Locale { get; set; } + + /// The value to identify context of the operation. + public string OperationContext { get; set; } + + /// Endpoint where the custom model was deployed. + public string SpeechRecognitionModelEndpointId { get; set; } + /// + /// 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. + /// + public string OperationCallbackUri { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/autorest.md b/sdk/communication/Azure.Communication.CallAutomation/src/autorest.md index a86cd2009fbf..d074d86693ba 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/autorest.md +++ b/sdk/communication/Azure.Communication.CallAutomation/src/autorest.md @@ -7,10 +7,10 @@ From Folder that contains autorest.md, Run `dotnet msbuild /t:GenerateCode` to g ```yaml model-namespace: false -tag: package-2023-10-03-preview +tag: package-2024-09-01-preview require: - - https://github.com/Azure/azure-rest-api-specs/blob/caabf7f24ee18b923a01bd51461c188e861a044e/specification/communication/data-plane/CallAutomation/readme.md + - https://github.com/Azure/azure-rest-api-specs/blob/b9e2d84df17975c0269246afb701eeba545958d0/specification/communication/data-plane/CallAutomation/readme.md title: Azure Communication Services diff --git a/sdk/communication/Azure.Communication.CallAutomation/tests/CallAutomationClients/CallAutomationClientAutomatedLiveTests.cs b/sdk/communication/Azure.Communication.CallAutomation/tests/CallAutomationClients/CallAutomationClientAutomatedLiveTests.cs index f19cd590a0e8..f58159d0b7bf 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/tests/CallAutomationClients/CallAutomationClientAutomatedLiveTests.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/tests/CallAutomationClients/CallAutomationClientAutomatedLiveTests.cs @@ -130,6 +130,11 @@ public async Task CreateCallAndReject() // check reject response Assert.IsFalse(rejectResponse.IsError); + var createCallFailedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(createCallFailedEvent); + Assert.IsTrue(createCallFailedEvent is CreateCallFailed); + Assert.AreEqual(callConnectionId, ((CreateCallFailed)createCallFailedEvent!).CallConnectionId); + try { // test get properties @@ -158,5 +163,203 @@ public async Task CreateCallAndReject() await CleanUpCall(client, callConnectionId); } } + + [RecordedTest] + public async Task CreateCallToAcsConnectCallAndHangupForEveryoneTest() + { + /* Tests: CreateCall, AnswerCall, Connect call, Hangup(true), GetCallConnectionProperties, CallConnectedEvent, CallDisconnectedEvent + * Test case: ACS to ACS call + * 1. create a CallAutomationClient. + * 2. create a call from source to one ACS target. + * 3. connect call. + * 4. get updated call properties and check for the connected state. + * 5. hang up the call. + * 6. once call is hung up, verify disconnected event + */ + + // create caller and receiver + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + + // create call and assert response + var createCallOptions = new CreateCallOptions(new CallInvite(target), new Uri(TestEnvironment.DispatcherCallback + $"?q={uniqueId}")); + CreateCallResult response = await client.CreateCallAsync(createCallOptions).ConfigureAwait(false); + callConnectionId = response.CallConnectionProperties.CallConnectionId; + Assert.IsNotEmpty(response.CallConnectionProperties.CallConnectionId); + + // wait for incomingcall context + string? incomingCallContext = await WaitForIncomingCallContext(uniqueId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(incomingCallContext); + + // answer the call + var answerCallOptions = new AnswerCallOptions(incomingCallContext, new Uri(TestEnvironment.DispatcherCallback)); + AnswerCallResult answerResponse = await targetClient.AnswerCallAsync(answerCallOptions); + + // wait for callConnected + var connectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(connectedEvent); + Assert.IsTrue(connectedEvent is CallConnected); + Assert.AreEqual(callConnectionId, ((CallConnected)connectedEvent!).CallConnectionId); + + // server call locator for connect call. + CallLocator callLocator = new ServerCallLocator(connectedEvent.ServerCallId); + + // connect call. + ConnectCallResult connectCallResult = await client.ConnectCallAsync(callLocator, new Uri(TestEnvironment.DispatcherCallback + $"?q={uniqueId}")); + var connectCallConnectionId = connectCallResult.CallConnectionProperties.CallConnectionId.ToString(); + + // wait for connect call connected. + var connectCallConnectedEvent = await WaitForEvent(connectCallConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(connectCallConnectedEvent); + Assert.IsTrue(connectCallConnectedEvent is CallConnected); + Assert.AreEqual(connectCallConnectionId, ((CallConnected)connectCallConnectedEvent!).CallConnectionId); + + CallConnection ConnectCallConnection = connectCallResult.CallConnection; + + // test get properties + Response properties = await ConnectCallConnection.GetCallConnectionPropertiesAsync().ConfigureAwait(false); + Assert.AreEqual(CallConnectionState.Connected, properties.Value.CallConnectionState); + + // try hangup + await connectCallResult.CallConnection.HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(connectCallConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(connectCallConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + connectCallConnectionId = null; + + // try hangup + try + { + await answerResponse.CallConnection.HangUpAsync(true).ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + Assert.AreEqual(ex.Status, 404); + } + + callConnectionId = null; + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task CreateCallToAcsConnectCallAndHangupTest() + { + /* Tests: CreateCall, AnswerCall, Connect call, Hangup(true), GetCallConnectionProperties, CallConnectedEvent, CallDisconnectedEvent + * Test case: ACS to ACS call + * 1. create a CallAutomationClient. + * 2. create a call from source to one ACS target. + * 3. connect call. + * 4. get updated call properties and check for the connected state. + * 5. hang up the call. + * 6. once call is hung up, verify disconnected event + */ + + // create caller and receiver + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + + // create call and assert response + var createCallOptions = new CreateCallOptions(new CallInvite(target), new Uri(TestEnvironment.DispatcherCallback + $"?q={uniqueId}")); + CreateCallResult response = await client.CreateCallAsync(createCallOptions).ConfigureAwait(false); + callConnectionId = response.CallConnectionProperties.CallConnectionId; + Assert.IsNotEmpty(response.CallConnectionProperties.CallConnectionId); + + // wait for incomingcall context + string? incomingCallContext = await WaitForIncomingCallContext(uniqueId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(incomingCallContext); + + // answer the call + var answerCallOptions = new AnswerCallOptions(incomingCallContext, new Uri(TestEnvironment.DispatcherCallback)); + AnswerCallResult answerResponse = await targetClient.AnswerCallAsync(answerCallOptions); + + // wait for callConnected + var connectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(connectedEvent); + Assert.IsTrue(connectedEvent is CallConnected); + Assert.AreEqual(callConnectionId, ((CallConnected)connectedEvent!).CallConnectionId); + + // server call locator for connect call. + CallLocator callLocator = new ServerCallLocator(connectedEvent.ServerCallId); + + // connect call. + ConnectCallResult connectCallResult = await client.ConnectCallAsync(callLocator, new Uri(TestEnvironment.DispatcherCallback + $"?q={uniqueId}")); + var connectCallConnectionId = connectCallResult.CallConnectionProperties.CallConnectionId.ToString(); + + // wait for connect call connected. + var connectCallConnectedEvent = await WaitForEvent(connectCallConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(connectCallConnectedEvent); + Assert.IsTrue(connectCallConnectedEvent is CallConnected); + Assert.AreEqual(connectCallConnectionId, ((CallConnected)connectCallConnectedEvent!).CallConnectionId); + + CallConnection ConnectCallConnection = connectCallResult.CallConnection; + + // test get properties + Response properties = await ConnectCallConnection.GetCallConnectionPropertiesAsync().ConfigureAwait(false); + Assert.AreEqual(CallConnectionState.Connected, properties.Value.CallConnectionState); + + // try hangup + await connectCallResult.CallConnection.HangUpAsync(false).ConfigureAwait(false); + var disconnectedConnectEvent = await WaitForEvent(connectCallConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedConnectEvent); + Assert.IsTrue(disconnectedConnectEvent is CallDisconnected); + Assert.AreEqual(connectCallConnectionId, ((CallDisconnected)disconnectedConnectEvent!).CallConnectionId); + connectCallConnectionId = null; + + // try to hangup for anwercall + await answerResponse.CallConnection.HangUpAsync(false).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + callConnectionId = null; + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/tests/CallAutomationClients/CallAutomationClientTests.cs b/sdk/communication/Azure.Communication.CallAutomation/tests/CallAutomationClients/CallAutomationClientTests.cs index 01d53df712a8..3b8e6fe98118 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/tests/CallAutomationClients/CallAutomationClientTests.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/tests/CallAutomationClients/CallAutomationClientTests.cs @@ -14,15 +14,15 @@ public class CallAutomationClientTests : CallAutomationTestBase { private readonly MediaStreamingOptions _mediaStreamingConfiguration = new MediaStreamingOptions( new Uri("https://websocket"), - MediaStreamingTransport.Websocket, MediaStreamingContent.Audio, - MediaStreamingAudioChannel.Mixed); + MediaStreamingAudioChannel.Mixed, + MediaStreamingTransport.Websocket); private readonly TranscriptionOptions _transcriptionConfiguration = new TranscriptionOptions( new Uri("https://websocket"), - TranscriptionTransport.Websocket, "en-CA", - true); + true, + TranscriptionTransport.Websocket); [TestCaseSource(nameof(TestData_AnswerCall))] public async Task AnswerCallAsync_200OK(string incomingCallContext, Uri callbackUri) @@ -33,8 +33,8 @@ public async Task AnswerCallAsync_200OK(string incomingCallContext, Uri callback Assert.NotNull(response); Assert.AreEqual((int)HttpStatusCode.OK, response.GetRawResponse().Status); verifyCallConnectionProperties(response.Value.CallConnectionProperties); - Assert.Null(response.Value.CallConnectionProperties.MediaSubscriptionId); - Assert.Null(response.Value.CallConnectionProperties.DataSubscriptionId); + Assert.Null(response.Value.CallConnectionProperties.MediaStreamingSubscription); + Assert.Null(response.Value.CallConnectionProperties.TranscriptionSubscription); Assert.AreEqual(CallConnectionId, response.Value.CallConnection.CallConnectionId); } @@ -47,8 +47,8 @@ public void AnswerCall_200OK(string incomingCallContext, Uri callbackUri) Assert.NotNull(response); Assert.AreEqual((int)HttpStatusCode.OK, response.GetRawResponse().Status); verifyCallConnectionProperties(response.Value.CallConnectionProperties); - Assert.Null(response.Value.CallConnectionProperties.MediaSubscriptionId); - Assert.Null(response.Value.CallConnectionProperties.DataSubscriptionId); + Assert.Null(response.Value.CallConnectionProperties.MediaStreamingSubscription); + Assert.Null(response.Value.CallConnectionProperties.TranscriptionSubscription); Assert.AreEqual(CallConnectionId, response.Value.CallConnection.CallConnectionId); } @@ -68,8 +68,8 @@ public async Task AnswerCallWithOptionsAsync_200OK(string incomingCallContext, U Assert.AreEqual((int)HttpStatusCode.OK, response.GetRawResponse().Status); verifyCallConnectionProperties(response.Value.CallConnectionProperties); Assert.AreEqual(CallConnectionId, response.Value.CallConnection.CallConnectionId); - Assert.AreEqual("mediaSubscriptionId", response.Value.CallConnectionProperties.MediaSubscriptionId); - Assert.AreEqual("dataSubscriptionId", response.Value.CallConnectionProperties.DataSubscriptionId); + Assert.NotNull(response.Value.CallConnectionProperties.MediaStreamingSubscription); + Assert.NotNull(response.Value.CallConnectionProperties.TranscriptionSubscription); } [TestCaseSource(nameof(TestData_AnswerCall))] @@ -87,8 +87,8 @@ public void AnswerCallWithOptions_200OK(string incomingCallContext, Uri callback Assert.AreEqual((int)HttpStatusCode.OK, response.GetRawResponse().Status); verifyCallConnectionProperties(response.Value.CallConnectionProperties); Assert.AreEqual(CallConnectionId, response.Value.CallConnection.CallConnectionId); - Assert.AreEqual("mediaSubscriptionId", response.Value.CallConnectionProperties.MediaSubscriptionId); - Assert.AreEqual("dataSubscriptionId", response.Value.CallConnectionProperties.DataSubscriptionId); + Assert.NotNull(response.Value.CallConnectionProperties.MediaStreamingSubscription); + Assert.NotNull(response.Value.CallConnectionProperties.TranscriptionSubscription); } [TestCaseSource(nameof(TestData_AnswerCall))] @@ -136,7 +136,7 @@ public void RedirectCallAsync_404NotFound(string incomingCallContext, CallInvite { CallAutomationClient callAutomationClient = CreateMockCallAutomationClient(404); - RequestFailedException? ex = Assert.ThrowsAsync(async() => await callAutomationClient.RedirectCallAsync(incomingCallContext, callInvite).ConfigureAwait(false)); + RequestFailedException? ex = Assert.ThrowsAsync(async () => await callAutomationClient.RedirectCallAsync(incomingCallContext, callInvite).ConfigureAwait(false)); Assert.NotNull(ex); Assert.AreEqual(ex?.Status, 404); } @@ -185,7 +185,7 @@ public void RejectCallAsync_404NotFound(string incomingCallContext, CallRejectRe RejectCallOptions rejectOption = new RejectCallOptions(incomingCallContext); rejectOption.CallRejectReason = reason; - RequestFailedException? ex = Assert.ThrowsAsync(async() => await callAutomationClient.RejectCallAsync(rejectOption).ConfigureAwait(false)); + RequestFailedException? ex = Assert.ThrowsAsync(async () => await callAutomationClient.RejectCallAsync(rejectOption).ConfigureAwait(false)); Assert.NotNull(ex); Assert.AreEqual(ex?.Status, 404); } @@ -214,8 +214,8 @@ public async Task CreateCallAsync_201Created(CallInvite target, Uri callbackUri) Assert.NotNull(result); Assert.AreEqual((int)HttpStatusCode.Created, response.GetRawResponse().Status); verifyCallConnectionProperties(result.CallConnectionProperties); - Assert.Null(result.CallConnectionProperties.MediaSubscriptionId); - Assert.Null(result.CallConnectionProperties.DataSubscriptionId); + Assert.Null(response.Value.CallConnectionProperties.MediaStreamingSubscription); + Assert.Null(response.Value.CallConnectionProperties.TranscriptionSubscription); Assert.AreEqual(CallConnectionId, result.CallConnection.CallConnectionId); } @@ -230,40 +230,8 @@ public void CreateCall_201Created(CallInvite target, Uri callbackUri) Assert.NotNull(result); Assert.AreEqual((int)HttpStatusCode.Created, response.GetRawResponse().Status); verifyCallConnectionProperties(result.CallConnectionProperties); - Assert.Null(result.CallConnectionProperties.MediaSubscriptionId); - Assert.Null(result.CallConnectionProperties.DataSubscriptionId); - Assert.AreEqual(CallConnectionId, result.CallConnection.CallConnectionId); - } - - [TestCaseSource(nameof(TestData_CreateCall))] - public async Task CreateCallWithOPSSourceAsync_201Created(CallInvite target, Uri callbackUri) - { - CallAutomationClient callAutomationClient = CreateMockCallAutomationClient(201, CreateOrAnswerCallOrGetCallConnectionPayloadForOPSCall, isOPSCall:true); - - var options = new CreateCallOptions(target, callbackUri); - var response = await callAutomationClient.CreateCallAsync(options).ConfigureAwait(false); - CreateCallResult result = (CreateCallResult)response; - Assert.NotNull(result); - Assert.AreEqual((int)HttpStatusCode.Created, response.GetRawResponse().Status); - verifyOPSCallConnectionProperties(result.CallConnectionProperties); - Assert.Null(result.CallConnectionProperties.MediaSubscriptionId); - Assert.Null(result.CallConnectionProperties.DataSubscriptionId); - Assert.AreEqual(CallConnectionId, result.CallConnection.CallConnectionId); - } - - [TestCaseSource(nameof(TestData_CreateCall))] - public void CreateCallWithOPSSource_201Created(CallInvite target, Uri callbackUri) - { - CallAutomationClient callAutomationClient = CreateMockCallAutomationClient(201, CreateOrAnswerCallOrGetCallConnectionPayloadForOPSCall, isOPSCall: true); - - var options = new CreateCallOptions(target, callbackUri); - var response = callAutomationClient.CreateCall(options); - CreateCallResult result = (CreateCallResult)response; - Assert.NotNull(result); - Assert.AreEqual((int)HttpStatusCode.Created, response.GetRawResponse().Status); - verifyOPSCallConnectionProperties(result.CallConnectionProperties); - Assert.Null(result.CallConnectionProperties.MediaSubscriptionId); - Assert.Null(result.CallConnectionProperties.DataSubscriptionId); + Assert.Null(response.Value.CallConnectionProperties.MediaStreamingSubscription); + Assert.Null(response.Value.CallConnectionProperties.TranscriptionSubscription); Assert.AreEqual(CallConnectionId, result.CallConnection.CallConnectionId); } @@ -285,8 +253,8 @@ public async Task CreateCallWithOptionsAsync_201Created(CallInvite target, Uri c Assert.AreEqual((int)HttpStatusCode.Created, response.GetRawResponse().Status); verifyCallConnectionProperties(result.CallConnectionProperties); Assert.AreEqual(CallConnectionId, result.CallConnection.CallConnectionId); - Assert.AreEqual("mediaSubscriptionId", result.CallConnectionProperties.MediaSubscriptionId); - Assert.AreEqual("dataSubscriptionId", result.CallConnectionProperties.DataSubscriptionId); + Assert.NotNull(response.Value.CallConnectionProperties.MediaStreamingSubscription); + Assert.NotNull(response.Value.CallConnectionProperties.TranscriptionSubscription); } [TestCaseSource(nameof(TestData_CreateCall))] @@ -307,8 +275,8 @@ public void CreateCallWithOptions_201Created(CallInvite target, Uri callbackUri) Assert.AreEqual((int)HttpStatusCode.Created, response.GetRawResponse().Status); verifyCallConnectionProperties(result.CallConnectionProperties); Assert.AreEqual(CallConnectionId, result.CallConnection.CallConnectionId); - Assert.AreEqual("mediaSubscriptionId", result.CallConnectionProperties.MediaSubscriptionId); - Assert.AreEqual("dataSubscriptionId", result.CallConnectionProperties.DataSubscriptionId); + Assert.NotNull(response.Value.CallConnectionProperties.MediaStreamingSubscription); + Assert.NotNull(response.Value.CallConnectionProperties.TranscriptionSubscription); } [TestCaseSource(nameof(TestData_CreateCall))] @@ -331,6 +299,60 @@ public void CreateCall_404NotFound(CallInvite target, Uri callbackUri) Assert.AreEqual(ex?.Status, 404); } + [TestCaseSource(nameof(TestData_ConnectCall))] + public async Task ConnectCallAsync_200OK(CallLocator callLocator, Uri callbackUri) + { + CallAutomationClient callAutomationClient = CreateMockCallAutomationClient(200, DummyConnectPayload); + + var response = await callAutomationClient.ConnectCallAsync(callLocator, callbackUri).ConfigureAwait(false); + ConnectCallResult result = (ConnectCallResult)response; + Assert.NotNull(result); + Assert.AreEqual((int)HttpStatusCode.OK, response.GetRawResponse().Status); + verifyCallConnectionProperties(result.CallConnectionProperties, isConnectApi: true); + Assert.AreEqual(CallConnectionId, result.CallConnection.CallConnectionId); + } + + [TestCaseSource(nameof(TestData_ConnectCall))] + public void ConnectCall_200OK(CallLocator callLocator, Uri callbackUri) + { + CallAutomationClient callAutomationClient = CreateMockCallAutomationClient(200, DummyConnectPayload); + + var response = callAutomationClient.ConnectCall(callLocator, callbackUri); + ConnectCallResult result = (ConnectCallResult)response; + Assert.NotNull(result); + Assert.AreEqual((int)HttpStatusCode.OK, response.GetRawResponse().Status); + verifyCallConnectionProperties(result.CallConnectionProperties, isConnectApi: true); + Assert.AreEqual(CallConnectionId, result.CallConnection.CallConnectionId); + } + + [TestCaseSource(nameof(TestData_ConnectCall))] + public async Task ConnectCallWithOptionsAsync_200OK(CallLocator callLocator, Uri callbackUri) + { + CallAutomationClient callAutomationClient = CreateMockCallAutomationClient(200, DummyConnectPayload); + + var options = new ConnectCallOptions(callLocator, callbackUri); + var response = await callAutomationClient.ConnectCallAsync(options).ConfigureAwait(false); + ConnectCallResult result = (ConnectCallResult)response; + Assert.NotNull(result); + Assert.AreEqual((int)HttpStatusCode.OK, response.GetRawResponse().Status); + verifyCallConnectionProperties(result.CallConnectionProperties, isConnectApi: true); + Assert.AreEqual(CallConnectionId, result.CallConnection.CallConnectionId); + } + + [TestCaseSource(nameof(TestData_ConnectCall))] + public void ConnectCallWithOptions_200OK(CallLocator callLocator, Uri callbackUri) + { + CallAutomationClient callAutomationClient = CreateMockCallAutomationClient(200, DummyConnectPayload); + + var options = new ConnectCallOptions(callLocator, callbackUri); + var response = callAutomationClient.ConnectCall(options); + ConnectCallResult result = (ConnectCallResult)response; + Assert.NotNull(result); + Assert.AreEqual((int)HttpStatusCode.OK, response.GetRawResponse().Status); + verifyCallConnectionProperties(result.CallConnectionProperties, isConnectApi: true); + Assert.AreEqual(CallConnectionId, result.CallConnection.CallConnectionId); + } + [TestCaseSource(nameof(TestData_GetCallConnection))] public void GetCallConnection(string callConnectionId) { @@ -366,8 +388,8 @@ public async Task CreateGroupCallAsync_201Created(IEnumerable TestData_CreateOPSCall() - { - return new[] - { - new object?[] - { - new CallInvite(new MicrosoftTeamsAppIdentifier("28:acs:12345")), + new CallInvite(new CommunicationUserIdentifier("12345")), new Uri("https://bot.contoso.com/callback") }, }; @@ -522,5 +532,16 @@ private static void ValidateCallConnectionProperties(CallConnectionProperties pr }, }; } + private static IEnumerable TestData_ConnectCall() + { + return new[] + { + new object?[] + { + _serverCallLocator, + new Uri("https://bot.contoso.com/callback") + }, + }; + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/tests/CallMedias/CallMediaAutomatedLiveTests.cs b/sdk/communication/Azure.Communication.CallAutomation/tests/CallMedias/CallMediaAutomatedLiveTests.cs index 0854c0b49654..f40a149f4c95 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/tests/CallMedias/CallMediaAutomatedLiveTests.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/tests/CallMedias/CallMediaAutomatedLiveTests.cs @@ -2,13 +2,13 @@ // Licensed under the MIT License. using System; +using System.Collections.Generic; using System.Threading.Tasks; -using NUnit.Framework; using Azure.Communication.CallAutomation.Tests.Infrastructure; +using Azure.Communication.PhoneNumbers; using Azure.Core.TestFramework; using Microsoft.AspNetCore.Http; -using Azure.Communication.PhoneNumbers; -using System.Collections.Generic; +using NUnit.Framework; namespace Azure.Communication.CallAutomation.Tests.CallMedias { @@ -141,5 +141,2777 @@ public async Task continuousDtmfDetectionAndSendDtmfTest() await CleanUpCall(client, callConnectionId); } } + + [RecordedTest] + public async Task PlayMultipleFilesSourcesWithPlayMediaTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId, false); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + // multiple File Source + var playFileSources = new List() { + new FileSource(new Uri(TestEnvironment.FileSourceUrl) ), + new FileSource(new Uri(TestEnvironment.FileSourceUrl) ), + new FileSource(new Uri(TestEnvironment.FileSourceUrl) ) + }; + + PlayOptions options = new PlayOptions(playFileSources, new List() { target }) { OperationContext = "context" }; + + // Assert the Play with multiple File Sources + await callConnection.GetCallMedia().PlayAsync(options).ConfigureAwait(false); + var playCompletedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(playCompletedEvent); + Assert.IsTrue(playCompletedEvent is PlayCompleted); + Assert.AreEqual(callConnectionId, ((PlayCompleted)playCompletedEvent!).CallConnectionId); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task PlayMultipleFilesSourcesWithPlayMediaAllTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId, false); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + // multiple File Source + var playFileSources = new List() { + new FileSource(new Uri(TestEnvironment.FileSourceUrl) ), + new FileSource(new Uri(TestEnvironment.FileSourceUrl) ), + new FileSource(new Uri(TestEnvironment.FileSourceUrl) ) + }; + + PlayToAllOptions options = new PlayToAllOptions(playFileSources) { OperationContext = "context" }; + + // Assert the Play with multiple File Sources + await callConnection.GetCallMedia().PlayToAllAsync(options).ConfigureAwait(false); + var playCompletedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(playCompletedEvent); + Assert.IsTrue(playCompletedEvent is PlayCompleted); + Assert.AreEqual(callConnectionId, ((PlayCompleted)playCompletedEvent!).CallConnectionId); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task PlayMultipleTextSourcesWithPlayMediaTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId, true); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + // multiple Text Source + var playTextSources = new List() { + new TextSource("Test prompt1") { VoiceName = "en-US-NancyNeural" }, + new TextSource("Test prompt2") { VoiceName = "en-US-NancyNeural" }, + new TextSource("Test prompt3") { VoiceName = "en-US-NancyNeural" } + }; + + PlayOptions options = new PlayOptions(playTextSources, new List() { target }) { OperationContext = "context" }; + + // Assert the Play with multiple Text Sources + await callConnection.GetCallMedia().PlayAsync(options).ConfigureAwait(false); + var playCompletedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(playCompletedEvent); + Assert.IsTrue(playCompletedEvent is PlayCompleted); + Assert.AreEqual(callConnectionId, ((PlayCompleted)playCompletedEvent!).CallConnectionId); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task PlayMultipleTextSourcesWithPlayMediaAllTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId, true); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + // multiple Text Source + var playTextSources = new List() { + new TextSource("Test prompt1") { VoiceName = "en-US-NancyNeural" }, + new TextSource("Test prompt2") { VoiceName = "en-US-NancyNeural" }, + new TextSource("Test prompt3") { VoiceName = "en-US-NancyNeural" } + }; + + PlayToAllOptions options = new PlayToAllOptions(playTextSources) { OperationContext = "context" }; + + // Assert the Play with multiple Text Sources + await callConnection.GetCallMedia().PlayToAllAsync(options).ConfigureAwait(false); + var playCompletedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(playCompletedEvent); + Assert.IsTrue(playCompletedEvent is PlayCompleted); + Assert.AreEqual(callConnectionId, ((PlayCompleted)playCompletedEvent!).CallConnectionId); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task PlayCombinedTextAndFileSourcesWithPlayMediaTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId, true); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + // multiple Sources + var playMultipleSources = new List() { + new FileSource(new Uri(TestEnvironment.FileSourceUrl) ), + new TextSource("Test prompt1") { VoiceName = "en-US-NancyNeural" } + }; + + PlayOptions options = new PlayOptions(playMultipleSources, new List() { target }) { OperationContext = "context" }; + + // Assert the Play with multiple Text Sources + await callConnection.GetCallMedia().PlayAsync(options).ConfigureAwait(false); + var playCompletedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(playCompletedEvent); + Assert.IsTrue(playCompletedEvent is PlayCompleted); + Assert.AreEqual(callConnectionId, ((PlayCompleted)playCompletedEvent!).CallConnectionId); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task PlayCombinedTextAndFileSourcesWithPlayMediaAllTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId, true); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + // multiple Sources + var playMultipleSources = new List() { + new FileSource(new Uri(TestEnvironment.FileSourceUrl) ), + new TextSource("Test prompt1") { VoiceName = "en-US-NancyNeural" } + }; + + PlayToAllOptions options = new PlayToAllOptions(playMultipleSources) { OperationContext = "context" }; + + // Assert the Play with multiple Text Sources + await callConnection.GetCallMedia().PlayToAllAsync(options).ConfigureAwait(false); + var playCompletedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(playCompletedEvent); + Assert.IsTrue(playCompletedEvent is PlayCompleted); + Assert.AreEqual(callConnectionId, ((PlayCompleted)playCompletedEvent!).CallConnectionId); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task PlayInvalidFileSourceWithPlayMediaTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId, false); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + // Assert multiple Text Source with wrong file source play failed event + var playMultipleSources = new List() { + new FileSource(new Uri("https://dummy.com/dummyurl.wav")) + }; + + PlayOptions options = new PlayOptions(playMultipleSources, new List() { target }) { OperationContext = "context" }; + + // Assert the Play with multiple Text Sources + await callConnection.GetCallMedia().PlayAsync(options).ConfigureAwait(false); + var playFailedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(playFailedEvent); + Assert.IsTrue(playFailedEvent is PlayFailed); + Assert.AreEqual(callConnectionId, ((PlayFailed)playFailedEvent!).CallConnectionId); + Assert.AreEqual(0, ((PlayFailed)playFailedEvent!).FailedPlaySourceIndex); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task PlayInvalidAndValidFileSourceWithPlayMediaTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId, false); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + // Assert multiple Text Source with wrong file source play failed event + var playMultipleSources = new List() { + new FileSource(new Uri(TestEnvironment.FileSourceUrl) ), + new FileSource(new Uri("https://dummy.com/dummyurl.wav")) + }; + + PlayOptions options = new PlayOptions(playMultipleSources, new List() { target }) { OperationContext = "context" }; + + // Assert the Play with multiple Text Sources + await callConnection.GetCallMedia().PlayAsync(options).ConfigureAwait(false); + var playFailedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(playFailedEvent); + Assert.IsTrue(playFailedEvent is PlayFailed); + Assert.AreEqual(callConnectionId, ((PlayFailed)playFailedEvent!).CallConnectionId); + Assert.AreEqual(1, ((PlayFailed)playFailedEvent!).FailedPlaySourceIndex); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task PlayInvalidFileSourceWithPlayMediaAllTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId, false); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + // Assert multiple Text Source with wrong file source play failed event + var playMultipleSources = new List() { + new FileSource(new Uri("https://dummy.com/dummyurl.wav")) + }; + + PlayToAllOptions options = new PlayToAllOptions(playMultipleSources) { OperationContext = "context" }; + + // Assert the Play with invalid file source + await callConnection.GetCallMedia().PlayToAllAsync(options).ConfigureAwait(false); + var playFailedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(playFailedEvent); + Assert.IsTrue(playFailedEvent is PlayFailed); + Assert.AreEqual(callConnectionId, ((PlayFailed)playFailedEvent!).CallConnectionId); + Assert.AreEqual(0, ((PlayFailed)playFailedEvent!).FailedPlaySourceIndex); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task PlayInvalidAndInvalidFileSourceWithPlayMediaAllTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId, false); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + // Assert multiple Text Source with wrong file source play failed event + var playMultipleSources = new List() { + new FileSource(new Uri(TestEnvironment.FileSourceUrl) ), + new FileSource(new Uri("https://dummy.com/dummyurl.wav")) + }; + + PlayToAllOptions options = new PlayToAllOptions(playMultipleSources) { OperationContext = "context" }; + + // Assert the Play with multiple Text Sources + await callConnection.GetCallMedia().PlayToAllAsync(options).ConfigureAwait(false); + var playFailedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(playFailedEvent); + Assert.IsTrue(playFailedEvent is PlayFailed); + Assert.AreEqual(callConnectionId, ((PlayFailed)playFailedEvent!).CallConnectionId); + Assert.AreEqual(1, ((PlayFailed)playFailedEvent!).FailedPlaySourceIndex); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task DtmfRecognizeWithMultipleFileSourcesTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId, true); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + RecognizeInputType recognizeInputType = RecognizeInputType.Dtmf; + + // Assert combination of text and file source + var playMultipleSources = new List() { + new FileSource(new Uri(TestEnvironment.FileSourceUrl)), + new FileSource(new Uri(TestEnvironment.FileSourceUrl)) + }; + + await VerifyRecognizeFailedEventForMultipleSources(callConnectionId, client, playMultipleSources, target, recognizeInputType); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task DtmfRecognizeWithMultipleTextSourcesTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId, true); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + string SpeechToTextVoice = "en-US-NancyNeural"; + RecognizeInputType recognizeInputType = RecognizeInputType.Dtmf; + + // Assert multiple Text Sources + var playTextSources = new List() { + new TextSource("Test prompt1") { VoiceName = SpeechToTextVoice }, + new TextSource("Test prompt2") { VoiceName = SpeechToTextVoice }, + }; + + await VerifyRecognizeFailedEventForMultipleSources(callConnectionId, client, playTextSources, target, recognizeInputType); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task DtmfRecognizeWithCombinationOfTextAndFileSourcesTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId, true); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + string SpeechToTextVoice = "en-US-NancyNeural"; + RecognizeInputType recognizeInputType = RecognizeInputType.Dtmf; + + // Assert combination of text and file source + var playMultipleSources = new List() { + new FileSource(new Uri(TestEnvironment.FileSourceUrl)), + new TextSource("Test prompt1") { VoiceName = SpeechToTextVoice } + }; + + await VerifyRecognizeFailedEventForMultipleSources(callConnectionId, client, playMultipleSources, target, recognizeInputType); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task DtmfRecognizeWithInvalidFileSourcesTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId, true); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + RecognizeInputType recognizeInputType = RecognizeInputType.Dtmf; + + // Assert multiple Text Source with wrong file source + var playMultipleSources = new List() { + new FileSource(new Uri("https://dummy.com/dummyurl.wav")) + }; + + await VerifyRecognizeFailedEventForMultipleSources(callConnectionId, client, playMultipleSources, target, recognizeInputType, null, true); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task DtmfRecognizeWithInvalidFileSourceWithValidSourceTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId, true); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + RecognizeInputType recognizeInputType = RecognizeInputType.Dtmf; + + // Assert multiple Text Source with wrong file source + var playMultipleSources = new List() { + new FileSource(new Uri("https://dummy.com/dummyurl.wav")), + new TextSource("Test prompt1") { VoiceName = "en-US-NancyNeural" } + }; + + await VerifyRecognizeFailedEventForMultipleSources(callConnectionId, client, playMultipleSources, target, recognizeInputType, null, true); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task SpeechRecognizeWithMultipleFileSourcesTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId, true); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + RecognizeInputType recognizeInputType = RecognizeInputType.Speech; + + // Assert combination of text and file source + var playMultipleSources = new List() { + new FileSource(new Uri(TestEnvironment.FileSourceUrl)), + new FileSource(new Uri(TestEnvironment.FileSourceUrl)) + }; + + await VerifyRecognizeFailedEventForMultipleSources(callConnectionId, client, playMultipleSources, target, recognizeInputType); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task SpeechRecognizeWithMultipleTextSourcesTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId, true); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + string SpeechToTextVoice = "en-US-NancyNeural"; + RecognizeInputType recognizeInputType = RecognizeInputType.Speech; + + // Assert multiple Text Sources + var playTextSources = new List() { + new TextSource("Test prompt1") { VoiceName = SpeechToTextVoice }, + new TextSource("Test prompt2") { VoiceName = SpeechToTextVoice }, + }; + + await VerifyRecognizeFailedEventForMultipleSources(callConnectionId, client, playTextSources, target, recognizeInputType); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task SpeechRecognizeWithCombinationOfTextAndFileSourcesTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId, true); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + string SpeechToTextVoice = "en-US-NancyNeural"; + RecognizeInputType recognizeInputType = RecognizeInputType.Speech; + + // Assert combination of text and file source + var playMultipleSources = new List() { + new FileSource(new Uri(TestEnvironment.FileSourceUrl)), + new TextSource("Test prompt1") { VoiceName = SpeechToTextVoice } + }; + + await VerifyRecognizeFailedEventForMultipleSources(callConnectionId, client, playMultipleSources, target, recognizeInputType); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task SpeechRecognizeWithInvalidFileSourcesTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId, true); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + RecognizeInputType recognizeInputType = RecognizeInputType.Speech; + + // Assert multiple Text Source with wrong file source + var playMultipleSources = new List() { + new FileSource(new Uri("https://dummy.com/dummyurl.wav")) + }; + + await VerifyRecognizeFailedEventForMultipleSources(callConnectionId, client, playMultipleSources, target, recognizeInputType, null, true); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task SpeechRecognizeWithInvalidFileSourceWithValidSourceTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId, true); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + RecognizeInputType recognizeInputType = RecognizeInputType.Speech; + + // Assert multiple Text Source with wrong file source + var playMultipleSources = new List() { + new FileSource(new Uri("https://dummy.com/dummyurl.wav")), + new TextSource("Test prompt1") { VoiceName = "en-US-NancyNeural" } + }; + + await VerifyRecognizeFailedEventForMultipleSources(callConnectionId, client, playMultipleSources, target, recognizeInputType, null, true); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task ChoiceRecognizeWithMultipleFileSourcesTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId, true); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + RecognizeInputType recognizeInputType = RecognizeInputType.Choices; + + // Assert combination of text and file source + var playMultipleSources = new List() { + new FileSource(new Uri(TestEnvironment.FileSourceUrl)), + new FileSource(new Uri(TestEnvironment.FileSourceUrl)) + }; + + await VerifyRecognizeFailedEventForMultipleSources(callConnectionId, client, playMultipleSources, target, recognizeInputType); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task ChoiceRecognizeWithMultipleTextSourcesTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId, true); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + string SpeechToTextVoice = "en-US-NancyNeural"; + RecognizeInputType recognizeInputType = RecognizeInputType.Choices; + + // Assert multiple Text Sources + var playTextSources = new List() { + new TextSource("Test prompt1") { VoiceName = SpeechToTextVoice }, + new TextSource("Test prompt2") { VoiceName = SpeechToTextVoice }, + }; + + await VerifyRecognizeFailedEventForMultipleSources(callConnectionId, client, playTextSources, target, recognizeInputType); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task ChoiceRecognizeWithCombinationOfTextAndFileSourcesTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId, true); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + string SpeechToTextVoice = "en-US-NancyNeural"; + RecognizeInputType recognizeInputType = RecognizeInputType.Choices; + + // Assert combination of text and file source + var playMultipleSources = new List() { + new FileSource(new Uri(TestEnvironment.FileSourceUrl)), + new TextSource("Test prompt1") { VoiceName = SpeechToTextVoice } + }; + + await VerifyRecognizeFailedEventForMultipleSources(callConnectionId, client, playMultipleSources, target, recognizeInputType); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task ChoiceRecognizeWithInvalidFileSourcesTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId, true); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + RecognizeInputType recognizeInputType = RecognizeInputType.Choices; + + // Assert multiple Text Source with wrong file source + var playMultipleSources = new List() { + new FileSource(new Uri("https://dummy.com/dummyurl.wav")) + }; + + await VerifyRecognizeFailedEventForMultipleSources(callConnectionId, client, playMultipleSources, target, recognizeInputType, null, true); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task ChoiceRecognizeWithInvalidFileSourceWithValidSourceTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId, true); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + RecognizeInputType recognizeInputType = RecognizeInputType.Choices; + + // Assert multiple Text Source with wrong file source + var playMultipleSources = new List() { + new FileSource(new Uri("https://dummy.com/dummyurl.wav")), + new TextSource("Test prompt1") { VoiceName = "en-US-NancyNeural" } + }; + + await VerifyRecognizeFailedEventForMultipleSources(callConnectionId, client, playMultipleSources, target, recognizeInputType, null, true); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task SpeechOrDtmfRecognizeWithMultipleFileSourcesTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId, true); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + RecognizeInputType recognizeInputType = RecognizeInputType.SpeechOrDtmf; + + // Assert combination of text and file source + var playMultipleSources = new List() { + new FileSource(new Uri(TestEnvironment.FileSourceUrl)), + new FileSource(new Uri(TestEnvironment.FileSourceUrl)) + }; + + await VerifyRecognizeFailedEventForMultipleSources(callConnectionId, client, playMultipleSources, target, recognizeInputType); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task SpeechOrDtmfRecognizeWithMultipleTextSourcesTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId, true); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + string SpeechToTextVoice = "en-US-NancyNeural"; + RecognizeInputType recognizeInputType = RecognizeInputType.SpeechOrDtmf; + + // Assert multiple Text Sources + var playTextSources = new List() { + new TextSource("Test prompt1") { VoiceName = SpeechToTextVoice }, + new TextSource("Test prompt2") { VoiceName = SpeechToTextVoice }, + }; + + await VerifyRecognizeFailedEventForMultipleSources(callConnectionId, client, playTextSources, target, recognizeInputType); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task SpeechOrDtmfRecognizeWithCombinationOfTextAndFileSourcesTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId, true); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + string SpeechToTextVoice = "en-US-NancyNeural"; + RecognizeInputType recognizeInputType = RecognizeInputType.SpeechOrDtmf; + + // Assert combination of text and file source + var playMultipleSources = new List() { + new FileSource(new Uri(TestEnvironment.FileSourceUrl)), + new TextSource("Test prompt1") { VoiceName = SpeechToTextVoice } + }; + + await VerifyRecognizeFailedEventForMultipleSources(callConnectionId, client, playMultipleSources, target, recognizeInputType); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task SpeechOrDtmfRecognizeWithInvalidFileSourcesTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId, true); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + RecognizeInputType recognizeInputType = RecognizeInputType.SpeechOrDtmf; + + // Assert multiple Text Source with wrong file source + var playMultipleSources = new List() { + new FileSource(new Uri("https://dummy.com/dummyurl.wav")) + }; + + await VerifyRecognizeFailedEventForMultipleSources(callConnectionId, client, playMultipleSources, target, recognizeInputType, null, true); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task SpeechOrDtmfRecognizeWithInvalidFileSourceWithValidSourceTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId, true); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + RecognizeInputType recognizeInputType = RecognizeInputType.SpeechOrDtmf; + + // Assert multiple Text Source with wrong file source + var playMultipleSources = new List() { + new FileSource(new Uri("https://dummy.com/dummyurl.wav")), + new TextSource("Test prompt1") { VoiceName = "en-US-NancyNeural" } + }; + + await VerifyRecognizeFailedEventForMultipleSources(callConnectionId, client, playMultipleSources, target, recognizeInputType, null, true); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task HoldUnholdParticipantInACallTest() + { + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + var result = await CreateAndAnswerCall(client, targetClient, target, uniqueId); + callConnectionId = result.CallerCallConnectionId; + var participantToAdd = await CreateIdentityUserAsync().ConfigureAwait(false); + var callConnection = client.GetCallConnection(callConnectionId); + + // wait for callConnected + var addParticipantSucceededEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(addParticipantSucceededEvent); + Assert.IsTrue(addParticipantSucceededEvent is ParticipantsUpdated); + Assert.IsTrue(((ParticipantsUpdated)addParticipantSucceededEvent!).CallConnectionId == callConnectionId); + + // Assert the participant hold + await callConnection.GetCallMedia().HoldAsync(target).ConfigureAwait(false); + await Task.Delay(1000); + var participantResult = await callConnection.GetParticipantAsync(target).ConfigureAwait(false); + Assert.IsNotNull(participantResult); + Assert.IsTrue(participantResult.Value.IsOnHold); + + // Assert the participant unhold + await callConnection.GetCallMedia().UnholdAsync(target).ConfigureAwait(false); + + await Task.Delay(1000); + + participantResult = await callConnection.GetParticipantAsync(target).ConfigureAwait(false); + Assert.IsNotNull(participantResult); + Assert.IsFalse(participantResult.Value.IsOnHold); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task CreateCallWithMediaStreamingTest() + { + /* Tests: CreateCall, Media Streaming + * Test case: ACS to ACS call + * 1. create a CallAutomationClient. + * 2. Start Media Streaming and Stop Media Streaming + * 3. See Media Streaming started and stopped in call + */ + + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + + // create call and assert response + MediaStreamingOptions mediaStreamingOptions = new MediaStreamingOptions( + new Uri(TestEnvironment.TransportUrl), + MediaStreamingContent.Audio, + MediaStreamingAudioChannel.Mixed, + MediaStreamingTransport.Websocket, + false); + + var result = await CreateAndAnswerCallWithMediaOrTranscriptionOptions(client, targetClient, target, uniqueId, true, + mediaStreamingOptions, transcriptionOptions: null); + callConnectionId = result.CallerCallConnectionId; + await VerifyMediaStreaming(client, result.CallerCallConnectionId); + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task AnswerCallWithMediaStreamingTest() + { + /* Tests: CreateCall, Media Streaming + * Test case: ACS to ACS call + * 1. create a CallAutomationClient. + * 2. Start Media Streaming and Stop Media Streaming + * 3. See Media Streaming started and stopped in call + */ + + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + + // create call and assert response + MediaStreamingOptions mediaStreamingOptions = new MediaStreamingOptions( + new Uri(TestEnvironment.TransportUrl), + MediaStreamingContent.Audio, + MediaStreamingAudioChannel.Mixed, + MediaStreamingTransport.Websocket, + false); + + var result = await CreateAndAnswerCallWithMediaOrTranscriptionOptions(client, targetClient, target, uniqueId, false, + mediaStreamingOptions, transcriptionOptions: null); + callConnectionId = result.TargetCallConnectionId; + await VerifyMediaStreaming(targetClient, result.TargetCallConnectionId); + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task AnswerCallWithMediaStreamingUnmixedTest() + { + /* Tests: CreateCall, Media Streaming + * Test case: ACS to ACS call + * 1. create a CallAutomationClient. + * 2. Start Media Streaming and Stop Media Streaming + * 3. See Media Streaming started and stopped in call + */ + + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + + // create call and assert response + MediaStreamingOptions mediaStreamingOptions = new MediaStreamingOptions( + new Uri(TestEnvironment.TransportUrl), + MediaStreamingContent.Audio, + MediaStreamingAudioChannel.Unmixed, + MediaStreamingTransport.Websocket, + false); + + var result = await CreateAndAnswerCallWithMediaOrTranscriptionOptions(client, targetClient, target, uniqueId, false, + mediaStreamingOptions, transcriptionOptions: null); + callConnectionId = result.TargetCallConnectionId; + await VerifyMediaStreaming(targetClient, result.TargetCallConnectionId); + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task CreateCallAndTranscriptionTest() + { + /* Tests: CreateCall, Transcription + * Test case: ACS to ACS call + * 1. create a call with transcription options + * 2. Answer a call + * 3. Start Transcription and Stop Transcription + * 3. See Transcription started and stopped event triggerred + */ + + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + + // create call and assert response + TranscriptionOptions transcriptionOptions = new TranscriptionOptions( + new Uri(TestEnvironment.TransportUrl), + "en-CA", + false); + var result = await CreateAndAnswerCallWithMediaOrTranscriptionOptions(client, targetClient, target, uniqueId, true, + null, transcriptionOptions); + callConnectionId = result.CallerCallConnectionId; + await VerifyTranscription(targetClient, result.CallerCallConnectionId); + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + [RecordedTest] + public async Task AnswerCallAndTranscriptionTest() + { + /* Tests: CreateCall, Transcription + * Test case: ACS to ACS call + * 1. create a call + * 2. Answer a call with transcription options + * 3. Start Transcription and Stop Transcription + * 3. See Transcription started and stopped event triggerred + */ + + // create caller and receiver + CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false); + CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false); + CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user); + CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target); + string? callConnectionId = null; + + try + { + try + { + // setup service bus + var uniqueId = await ServiceBusWithNewCall(user, target); + + // create call and assert response + TranscriptionOptions transcriptionOptions = new TranscriptionOptions( + new Uri(TestEnvironment.TransportUrl), + "en-CA", + false); + var result = await CreateAndAnswerCallWithMediaOrTranscriptionOptions(client, targetClient, target, uniqueId, false, + null, transcriptionOptions); + callConnectionId = result.TargetCallConnectionId; + await VerifyTranscription(targetClient, result.TargetCallConnectionId); + try + { + // test get properties + Response properties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (ex.Status == 404) + { + callConnectionId = null; + return; + } + } + } + catch (Exception) + { + throw; + } + } + catch (Exception ex) + { + Assert.Fail($"Unexpected error: {ex}"); + } + finally + { + await CleanUpCall(client, callConnectionId); + } + } + + public async Task<(string CallerCallConnectionId, string TargetCallConnectionId)> CreateAndAnswerCall(CallAutomationClient client, + CallAutomationClient targetClient, + CommunicationUserIdentifier target, + string uniqueId, + bool createCallWithCogService = false) + { + try + { + // create call and assert response + var createCallOptions = new CreateCallOptions(new CallInvite(target), new Uri(TestEnvironment.DispatcherCallback + $"?q={uniqueId}")); + if (createCallWithCogService) + { + createCallOptions.CallIntelligenceOptions = new CallIntelligenceOptions() { CognitiveServicesEndpoint = new Uri(TestEnvironment.CognitiveServiceEndpoint) }; + } + CreateCallResult response = await client.CreateCallAsync(createCallOptions).ConfigureAwait(false); + var callerCallConnectionId = response.CallConnectionProperties.CallConnectionId; + Assert.IsNotEmpty(response.CallConnectionProperties.CallConnectionId); + + // wait for incomingcall context + string? incomingCallContext = await WaitForIncomingCallContext(uniqueId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(incomingCallContext); + + // answer the call + var answerCallOptions = new AnswerCallOptions(incomingCallContext, new Uri(TestEnvironment.DispatcherCallback + $"?q={uniqueId}")); + AnswerCallResult answerResponse = await targetClient.AnswerCallAsync(answerCallOptions); + + var targetCallConnectionId = answerResponse.CallConnectionProperties.CallConnectionId; + // wait for callConnected + + var connectedEvent = await WaitForEvent(targetCallConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(connectedEvent); + Assert.IsTrue(connectedEvent is CallConnected); + Assert.AreEqual(targetCallConnectionId, ((CallConnected)connectedEvent!).CallConnectionId); + return (callerCallConnectionId, targetCallConnectionId); + } + catch (Exception) + { + throw; + } + } + private async Task<(string CallerCallConnectionId, string TargetCallConnectionId)> CreateAndAnswerCallWithMediaOrTranscriptionOptions( + CallAutomationClient client, + CallAutomationClient targetClient, + CommunicationUserIdentifier target, + string uniqueId, + bool isOutboundValidation, + MediaStreamingOptions? mediaStreamingOptions, + TranscriptionOptions? transcriptionOptions + ) + { + try + { + // create call and assert response + var createCallOptions = new CreateCallOptions(new CallInvite(target), new Uri(TestEnvironment.DispatcherCallback + $"?q={uniqueId}")); + if (isOutboundValidation) + { + if (mediaStreamingOptions != null) + { + createCallOptions.MediaStreamingOptions = mediaStreamingOptions; + } + if (transcriptionOptions != null) + { + createCallOptions.TranscriptionOptions = transcriptionOptions; + createCallOptions.CallIntelligenceOptions = new CallIntelligenceOptions() + { + CognitiveServicesEndpoint = new Uri(TestEnvironment.CognitiveServiceEndpoint) + }; + } + } + CreateCallResult response = await client.CreateCallAsync(createCallOptions).ConfigureAwait(false); + var callerCallConnectionId = response.CallConnectionProperties.CallConnectionId; + Assert.IsNotEmpty(response.CallConnectionProperties.CallConnectionId); + + // wait for incomingcall context + string? incomingCallContext = await WaitForIncomingCallContext(uniqueId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(incomingCallContext); + + // answer the call + var answerCallOptions = new AnswerCallOptions(incomingCallContext, new Uri(TestEnvironment.DispatcherCallback + $"?q={uniqueId}")); + if (!isOutboundValidation) + { + if (mediaStreamingOptions != null) + { + answerCallOptions.MediaStreamingOptions = mediaStreamingOptions; + } + if (transcriptionOptions != null) + { + answerCallOptions.TranscriptionOptions = transcriptionOptions; + answerCallOptions.CallIntelligenceOptions = new CallIntelligenceOptions() + { + CognitiveServicesEndpoint = new Uri(TestEnvironment.CognitiveServiceEndpoint) + }; + } + } + AnswerCallResult answerResponse = await targetClient.AnswerCallAsync(answerCallOptions); + + var targetCallConnectionId = answerResponse.CallConnectionProperties.CallConnectionId; + // wait for callConnected + + var connectedEvent = await WaitForEvent(targetCallConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(connectedEvent); + Assert.IsTrue(connectedEvent is CallConnected); + Assert.AreEqual(targetCallConnectionId, ((CallConnected)connectedEvent!).CallConnectionId); + return (callerCallConnectionId, targetCallConnectionId); + } + catch (Exception) + { + throw; + } + } + + private async Task VerifyMediaStreaming(CallAutomationClient client, + string callConnectionId) + { + //Start media streaming + StartMediaStreamingOptions startMediaStreamingOptions = new StartMediaStreamingOptions() + { + OperationContext = "startMediaStreamingContext" + }; + + var callerMedia = client.GetCallConnection(callConnectionId).GetCallMedia(); + await callerMedia.StartMediaStreamingAsync(startMediaStreamingOptions); + + // wait for callConnected + var mediaStreamingStartedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(mediaStreamingStartedEvent); + Assert.IsTrue(mediaStreamingStartedEvent is MediaStreamingStarted); + + // Assert call connection properties + var connectionProperties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + Assert.IsNotNull(connectionProperties); + Assert.IsNotNull(connectionProperties.Value.MediaStreamingSubscription); + Assert.AreEqual(connectionProperties.Value.MediaStreamingSubscription.State, MediaStreamingSubscriptionState.Active); + + //Stop media streaming + StopMediaStreamingOptions stopMediaStreamingOptions = new StopMediaStreamingOptions(); + + await callerMedia.StopMediaStreamingAsync(stopMediaStreamingOptions); + + // wait for callConnected + var stopMediaStreamingEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(stopMediaStreamingEvent); + Assert.IsTrue(stopMediaStreamingEvent is MediaStreamingStopped); + + // Assert call connection properties + connectionProperties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + Assert.IsNotNull(connectionProperties); + Assert.IsNotNull(connectionProperties.Value.MediaStreamingSubscription); + Assert.AreEqual(connectionProperties.Value.MediaStreamingSubscription.State, MediaStreamingSubscriptionState.Inactive); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + } + + private async Task VerifyTranscription(CallAutomationClient client, string callConnectionId) + { + //Start Transcription + StartTranscriptionOptions startTranscriptionOptions = new StartTranscriptionOptions() + { + Locale = "en-CA", + OperationContext = "StartTranscription" + }; + + var callerMedia = client.GetCallConnection(callConnectionId).GetCallMedia(); + var startTranscriptionResponse = await callerMedia.StartTranscriptionAsync(startTranscriptionOptions); + var startTranscriptionEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(startTranscriptionEvent); + Assert.IsTrue(startTranscriptionEvent is TranscriptionStarted); + + var source = new TextSource("Hello, this is live test", "en-US-ElizabethNeural"); + var options = new PlayToAllOptions(source) { OperationContext = "playalloptionduringtranscription" }; + callerMedia.PlayToAll(options); + + // test get properties + var connectionProperties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + Assert.IsNotNull(connectionProperties); + Assert.IsNotNull(connectionProperties.Value.TranscriptionSubscription); + Assert.AreEqual(connectionProperties.Value.TranscriptionSubscription.State, TranscriptionSubscriptionState.Active); + + // Update Transcription + UpdateTranscriptionOptions updateTranscriptionOptions = new UpdateTranscriptionOptions("en-US") { OperationContext = "UpdateTranscription" }; + var updateTranscriptionResponse = await callerMedia.UpdateTranscriptionAsync(updateTranscriptionOptions); + var updateTranscriptionEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(updateTranscriptionEvent); + Assert.IsTrue(updateTranscriptionEvent is TranscriptionUpdated); + + connectionProperties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + Assert.IsNotNull(connectionProperties); + Assert.IsNotNull(connectionProperties.Value.TranscriptionSubscription); + Assert.AreEqual(connectionProperties.Value.TranscriptionSubscription.State, TranscriptionSubscriptionState.Active); + + //Stop Transcription + StopTranscriptionOptions stopTranscriptionOptions = new StopTranscriptionOptions() { OperationContext = "StopTranscription" }; + var stopTranscriptionResponse = await callerMedia.StopTranscriptionAsync(stopTranscriptionOptions); + + var stopTranscriptionEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(stopTranscriptionEvent); + Assert.IsTrue(stopTranscriptionEvent is TranscriptionStopped); + + connectionProperties = await client.GetCallConnection(callConnectionId).GetCallConnectionPropertiesAsync().ConfigureAwait(false); + Assert.IsNotNull(connectionProperties); + Assert.IsNotNull(connectionProperties.Value.TranscriptionSubscription); + Assert.AreEqual(connectionProperties.Value.TranscriptionSubscription.State, TranscriptionSubscriptionState.Inactive); + + // try hangup + await client.GetCallConnection(callConnectionId).HangUpAsync(true).ConfigureAwait(false); + var disconnectedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(disconnectedEvent); + Assert.IsTrue(disconnectedEvent is CallDisconnected); + Assert.AreEqual(callConnectionId, ((CallDisconnected)disconnectedEvent!).CallConnectionId); + } + + private async Task VerifyRecognizeFailedEventForMultipleSources(string callConnectionId, + CallAutomationClient client, List playMultipleSources, + CommunicationUserIdentifier target, + RecognizeInputType recognizeInputType, + PlaySource? playSource = null, + bool isInvalidSourceCheck = false, + bool expectedBadRequestCheck = false) + { + // Assert the playall with multiple Text Sources + var recognizeOptions = GetRecognizeOptions(playMultipleSources, target, recognizeInputType, playSource); + Assert.IsNotNull(recognizeOptions); + + var callConnection = client.GetCallConnection(callConnectionId); + + try + { + await callConnection.GetCallMedia().StartRecognizingAsync(recognizeOptions).ConfigureAwait(false); + } + catch (RequestFailedException ex) + { + if (expectedBadRequestCheck) + { + if (ex.Status == 400) + { + return; + } + } + } + + // Assert the playall with multiple Text Sources + var recognizeFailedEvent = await WaitForEvent(callConnectionId, TimeSpan.FromSeconds(20)); + Assert.IsNotNull(recognizeFailedEvent); + Assert.IsTrue(recognizeFailedEvent is RecognizeFailed); + Assert.AreEqual(callConnectionId, ((RecognizeFailed)recognizeFailedEvent!).CallConnectionId); + if (expectedBadRequestCheck) + { + Assert.AreEqual(MediaEventReasonCode.PlayInvalidFileFormat, ((RecognizeFailed)recognizeFailedEvent!).ReasonCode); + } + else if (isInvalidSourceCheck) + { + Assert.AreEqual(0, ((RecognizeFailed)recognizeFailedEvent!).FailedPlaySourceIndex); + } + else + { + Assert.AreEqual(MediaEventReasonCode.RecognizeInitialSilenceTimedOut, ((RecognizeFailed)recognizeFailedEvent!).ReasonCode); + if (recognizeInputType != RecognizeInputType.Dtmf) + Assert.IsNull(((RecognizeFailed)recognizeFailedEvent!).FailedPlaySourceIndex); + } + } + + private CallMediaRecognizeOptions? GetRecognizeOptions(List playSources, + CommunicationUserIdentifier target, + RecognizeInputType type, + PlaySource? playSource = null) + { + CallMediaRecognizeOptions? recognizeOptions = type.ToString() switch + { + "dtmf" => new CallMediaRecognizeDtmfOptions(targetParticipant: target, 2) + { + InterruptPrompt = false, + InitialSilenceTimeout = TimeSpan.FromSeconds(5), + PlayPrompts = playSources, + Prompt = playSource ?? null, + OperationContext = "dtmfContext", + InterToneTimeout = TimeSpan.FromSeconds(5) + }, + "choices" => new CallMediaRecognizeChoiceOptions(targetParticipant: target, GetChoices()) + { + InterruptCallMediaOperation = false, + InterruptPrompt = false, + InitialSilenceTimeout = TimeSpan.FromSeconds(5), + Prompt = playSource ?? null, + PlayPrompts = playSources, + OperationContext = "choiceContext" + }, + "speech" => new CallMediaRecognizeSpeechOptions(target) + { + Prompt = playSource ?? null, + PlayPrompts = playSources, + EndSilenceTimeout = TimeSpan.FromMilliseconds(1000), + OperationContext = "speechContext" + }, + "speechOrDtmf" => new CallMediaRecognizeSpeechOrDtmfOptions(target, 2) + { + PlayPrompts = playSources, + Prompt = playSource ?? null, + EndSilenceTimeout = TimeSpan.FromMilliseconds(1000), + InitialSilenceTimeout = TimeSpan.FromSeconds(10), + InterruptPrompt = true, + OperationContext = "speechordtmfContext" + }, + _ => null + }; + + return recognizeOptions; + } + + private List GetChoices() + { + return new List { + new RecognitionChoice("Confirm", new List { + "Confirm", + "First", + "One" + }) { + Tone = DtmfTone.One + }, + new RecognitionChoice("Cancel", new List { + "Cancel", + "Second", + "Two" + }) { + Tone = DtmfTone.Two + } + }; + } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/tests/CallMedias/CallMediaTests.cs b/sdk/communication/Azure.Communication.CallAutomation/tests/CallMedias/CallMediaTests.cs index c81a7f59b54e..5ec9e51ce66b 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/tests/CallMedias/CallMediaTests.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/tests/CallMedias/CallMediaTests.cs @@ -89,6 +89,17 @@ public class CallMediaTests : CallAutomationTestBase Prompt = new FileSource(new Uri("https://localhost")) }; + private static readonly CallMediaRecognizeOptions _dmtfRecognizeOptionsWithMultiplePlaySources = new CallMediaRecognizeDtmfOptions(new CommunicationUserIdentifier("targetUserId"), maxTonesToCollect: 5) + { + InterruptCallMediaOperation = true, + InterToneTimeout = TimeSpan.FromSeconds(10), + StopTones = new DtmfTone[] { DtmfTone.Pound }, + InitialSilenceTimeout = TimeSpan.FromSeconds(5), + InterruptPrompt = true, + OperationContext = "operationContext", + PlayPrompts = new List { new FileSource(new Uri("https://localhost")), new TextSource("Multiple Play Prompt Test") } + }; + private static CallMediaRecognizeOptions _choiceRecognizeOptions = new CallMediaRecognizeChoiceOptions(new CommunicationUserIdentifier("targetUserId"), s_recognizeChoices) { InterruptCallMediaOperation = true, @@ -105,11 +116,10 @@ public class CallMediaTests : CallAutomationTestBase SpeechModelEndpointId = "customModelEndpointId" }; - private static CallMediaRecognizeSpeechOptions _speechRecognizeOptions = new CallMediaRecognizeSpeechOptions(new CommunicationUserIdentifier("targetUserId")) + private static CallMediaRecognizeOptions _choiceRecognizeOptionsWithMultiplePlaySources = new CallMediaRecognizeChoiceOptions(new CommunicationUserIdentifier("targetUserId"), s_recognizeChoices) { InterruptCallMediaOperation = true, InitialSilenceTimeout = TimeSpan.FromSeconds(5), - EndSilenceTimeout = TimeSpan.FromMilliseconds(500), InterruptPrompt = true, OperationContext = "operationContext", Prompt = new TextSource("PlayTTS test text.") @@ -119,10 +129,11 @@ public class CallMediaTests : CallAutomationTestBase VoiceName = "LULU" }, SpeechLanguage = "en-US", - SpeechModelEndpointId = "customModelEndpointId" + SpeechModelEndpointId = "customModelEndpointId", + PlayPrompts = new List { new FileSource(new Uri("https://localhost")), new TextSource("Multiple Play Prompt Test") } }; - private static CallMediaRecognizeSpeechOrDtmfOptions _speechOrDtmfRecognizeOptions = new CallMediaRecognizeSpeechOrDtmfOptions(new CommunicationUserIdentifier("targetUserId"), 10) + private static CallMediaRecognizeSpeechOptions _speechRecognizeOptions = new CallMediaRecognizeSpeechOptions(new CommunicationUserIdentifier("targetUserId")) { InterruptCallMediaOperation = true, InitialSilenceTimeout = TimeSpan.FromSeconds(5), @@ -135,32 +146,69 @@ public class CallMediaTests : CallAutomationTestBase VoiceKind = VoiceKind.Female, VoiceName = "LULU" }, - SpeechLanguage= "en-US", + SpeechLanguage = "en-US", SpeechModelEndpointId = "customModelEndpointId" }; - private static readonly CallMediaRecognizeOptions _emptyRecognizeOptions = new CallMediaRecognizeDtmfOptions(new CommunicationUserIdentifier("targetUserId"), maxTonesToCollect: 1); - - private static readonly StartHoldMusicOptions _startHoldMusicOptions = new StartHoldMusicOptions(new CommunicationUserIdentifier("targetUserId"), _textSource) + private static CallMediaRecognizeSpeechOptions _speechRecognizeOptionsWithMultiplePlaySources = new CallMediaRecognizeSpeechOptions(new CommunicationUserIdentifier("targetUserId")) { + InterruptCallMediaOperation = true, + InitialSilenceTimeout = TimeSpan.FromSeconds(5), + EndSilenceTimeout = TimeSpan.FromMilliseconds(500), + InterruptPrompt = true, OperationContext = "operationContext", + Prompt = new TextSource("PlayTTS test text.") + { + SourceLocale = "en-US", + VoiceKind = VoiceKind.Female, + VoiceName = "LULU" + }, + SpeechLanguage = "en-US", + SpeechModelEndpointId = "customModelEndpointId", + PlayPrompts = new List { new FileSource(new Uri("https://localhost")), new TextSource("Multiple Play Prompt Test") } }; - private static readonly StopHoldMusicOptions _stopHoldMusicOptions = new StopHoldMusicOptions(new CommunicationUserIdentifier("targetUserId")) + private static CallMediaRecognizeSpeechOrDtmfOptions _speechOrDtmfRecognizeOptions = new CallMediaRecognizeSpeechOrDtmfOptions(new CommunicationUserIdentifier("targetUserId"), 10) { - OperationContext = "operationContext" + InterruptCallMediaOperation = true, + InitialSilenceTimeout = TimeSpan.FromSeconds(5), + EndSilenceTimeout = TimeSpan.FromMilliseconds(500), + InterruptPrompt = true, + OperationContext = "operationContext", + Prompt = new TextSource("PlayTTS test text.") + { + SourceLocale = "en-US", + VoiceKind = VoiceKind.Female, + VoiceName = "LULU" + }, + SpeechLanguage = "en-US", + SpeechModelEndpointId = "customModelEndpointId" }; - private static readonly HoldOptions _holdOptions = new HoldOptions(new CommunicationUserIdentifier("targetUserId")) + private static CallMediaRecognizeSpeechOrDtmfOptions _speechOrDtmfRecognizeOptionsWithMultiplePlaySources = new CallMediaRecognizeSpeechOrDtmfOptions(new CommunicationUserIdentifier("targetUserId"), 10) { + InterruptCallMediaOperation = true, + InitialSilenceTimeout = TimeSpan.FromSeconds(5), + EndSilenceTimeout = TimeSpan.FromMilliseconds(500), + InterruptPrompt = true, OperationContext = "operationContext", - PlaySourceInfo = _textSource, - OperationCallbackUri = new Uri("https://localhost") + Prompt = new TextSource("PlayTTS test text.") + { + SourceLocale = "en-US", + VoiceKind = VoiceKind.Female, + VoiceName = "LULU" + }, + SpeechLanguage = "en-US", + SpeechModelEndpointId = "customModelEndpointId", + PlayPrompts = new List { new FileSource(new Uri("https://localhost")), new TextSource("Multiple Play Prompt Test") } }; - private static readonly HoldOptions _holdOptionsNoMusic = new HoldOptions(new CommunicationUserIdentifier("targetUserId")) + private static readonly CallMediaRecognizeOptions _emptyRecognizeOptions = new CallMediaRecognizeDtmfOptions(new CommunicationUserIdentifier("targetUserId"), maxTonesToCollect: 1); + + private static readonly HoldOptions _holdOptions = new HoldOptions(new CommunicationUserIdentifier("targetUserId")) { OperationContext = "operationContext", + PlaySource = _textSource, OperationCallbackUri = new Uri("https://localhost") }; @@ -264,6 +312,24 @@ public async Task UpdateTranscriptionOperationsAsync_Return202Accepted(Func> operation) + { + _callMedia = GetCallMedia(202); + var result = await operation(_callMedia); + Assert.IsNotNull(result); + Assert.AreEqual((int)HttpStatusCode.Accepted, result.Status); + } + + [TestCaseSource(nameof(TestData_StopMediaStreamingOperationsAsync))] + public async Task StopMediaStreamingOperationsAsync_Return202Accepted(Func> operation) + { + _callMedia = GetCallMedia(202); + var result = await operation(_callMedia); + Assert.IsNotNull(result); + Assert.AreEqual((int)HttpStatusCode.Accepted, result.Status); + } + [TestCaseSource(nameof(TestData_PlayOperations))] public void MediaOperations_Return202Accepted(Func> operation) { @@ -354,6 +420,24 @@ public void UpdateTranscriptionOperations_Return202Accepted(Func operation) + { + _callMedia = GetCallMedia(202); + var result = operation(_callMedia); + Assert.IsNotNull(result); + Assert.AreEqual((int)HttpStatusCode.Accepted, result.Status); + } + + [TestCaseSource(nameof(TestData_StopMediaStreamingOperations))] + public void StopMediaStreamingOperations_Return202Accepted(Func operation) + { + _callMedia = GetCallMedia(202); + var result = operation(_callMedia); + Assert.IsNotNull(result); + Assert.AreEqual((int)HttpStatusCode.Accepted, result.Status); + } + [TestCaseSource(nameof(TestData_PlayOperationsAsync))] public void PlayOperationsAsync_Return404NotFound(Func>> operation) { @@ -444,6 +528,26 @@ public void StopTranscriptionOperationsAsync_Return404NotFound(Func> operation) + { + _callMedia = GetCallMedia(404); + RequestFailedException? ex = Assert.ThrowsAsync( + async () => await operation(_callMedia)); + Assert.NotNull(ex); + Assert.AreEqual(ex?.Status, 404); + } + + [TestCaseSource(nameof(TestData_StopMediaStreamingOperationsAsync))] + public void StopMediaStreamingOperationsAsync_Return404NotFound(Func> operation) + { + _callMedia = GetCallMedia(404); + RequestFailedException? ex = Assert.ThrowsAsync( + async () => await operation(_callMedia)); + Assert.NotNull(ex); + Assert.AreEqual(ex?.Status, 404); + } + [TestCaseSource(nameof(TestData_PlayOperations))] public void PlayOperations_Return404NotFound(Func> operation) { @@ -562,6 +666,26 @@ public void HoldMusicOperations_Return200Ok(Func operation) Assert.AreEqual((int)HttpStatusCode.OK, result.Status); } + [TestCaseSource(nameof(TestData_StartMediaStreamingOperations))] + public void StartMediaStreamingOperations_Return404NotFound(Func operation) + { + _callMedia = GetCallMedia(404); + RequestFailedException? ex = Assert.Throws( + () => operation(_callMedia)); + Assert.NotNull(ex); + Assert.AreEqual(ex?.Status, 404); + } + + [TestCaseSource(nameof(TestData_StopMediaStreamingOperations))] + public void StopMediaStreamingOperations_Return404NotFound(Func operation) + { + _callMedia = GetCallMedia(404); + RequestFailedException? ex = Assert.Throws( + () => operation(_callMedia)); + Assert.NotNull(ex); + Assert.AreEqual(ex?.Status, 404); + } + private static IEnumerable TestData_PlayOperationsAsync() { return new[] @@ -641,16 +765,32 @@ public void HoldMusicOperations_Return200Ok(Func operation) callMedia => callMedia.StartRecognizingAsync(_dmtfRecognizeOptions) }, new Func>>?[] + { + callMedia => callMedia.StartRecognizingAsync(_dmtfRecognizeOptionsWithMultiplePlaySources) + }, + new Func>>?[] { callMedia => callMedia.StartRecognizingAsync(_choiceRecognizeOptions) + }, + new Func>>?[] + { + callMedia => callMedia.StartRecognizingAsync(_choiceRecognizeOptionsWithMultiplePlaySources) }, new Func>>?[] { callMedia => callMedia.StartRecognizingAsync(_speechRecognizeOptions) }, new Func>>?[] + { + callMedia => callMedia.StartRecognizingAsync(_speechRecognizeOptionsWithMultiplePlaySources) + }, + new Func>>?[] { callMedia => callMedia.StartRecognizingAsync(_speechOrDtmfRecognizeOptions) + }, + new Func>>?[] + { + callMedia => callMedia.StartRecognizingAsync(_speechOrDtmfRecognizeOptionsWithMultiplePlaySources) }, new Func>>?[] { @@ -805,19 +945,11 @@ public void HoldMusicOperations_Return200Ok(Func operation) { return new[] { - new Func>?[] - { - callMedia => callMedia.StartHoldMusicAsync(_startHoldMusicOptions) - }, new Func>?[] { callMedia => callMedia.HoldAsync(_holdOptions) }, new Func>?[] - { - callMedia => callMedia.HoldAsync(_holdOptionsNoMusic) - }, - new Func>?[] { callMedia => callMedia.UnholdAsync(_unholdOptions) } @@ -829,19 +961,11 @@ public void HoldMusicOperations_Return200Ok(Func operation) { return new[] { - new Func?[] - { - callMedia => callMedia.StartHoldMusic(_startHoldMusicOptions) - }, new Func?[] { callMedia => callMedia.Hold(_holdOptions) }, new Func?[] - { - callMedia => callMedia.Hold(_holdOptionsNoMusic) - }, - new Func?[] { callMedia => callMedia.Unhold(_unholdOptions) } @@ -910,6 +1034,54 @@ public void HoldMusicOperations_Return200Ok(Func operation) new Func>?[] { callMedia => callMedia.UpdateTranscriptionAsync("locale") + }, + new Func>?[] + { + callMedia => callMedia.UpdateTranscriptionAsync(new UpdateTranscriptionOptions("locale"){SpeechRecognitionModelEndpointId = "customEndpoint", OperationContext="context" }) + } + }; + } + + private static IEnumerable TestData_StartMediaStreamingOperations() + { + return new[] + { + new Func?[] + { + callMedia => callMedia.StartMediaStreaming() + } + }; + } + + private static IEnumerable TestData_StartMediaStreamingOperationsAsync() + { + return new[] + { + new Func>?[] + { + callMedia => callMedia.StartMediaStreamingAsync(new StartMediaStreamingOptions(){OperationCallbackUri = new Uri("https://localhost"), OperationContext = "OperationContext"}) + } + }; + } + + private static IEnumerable TestData_StopMediaStreamingOperations() + { + return new[] + { + new Func?[] + { + callMedia => callMedia.StopMediaStreaming() + } + }; + } + + private static IEnumerable TestData_StopMediaStreamingOperationsAsync() + { + return new[] + { + new Func>?[] + { + callMedia => callMedia.StopMediaStreamingAsync(new StopMediaStreamingOptions(){ OperationCallbackUri = new Uri("https://localhost")}) } }; } diff --git a/sdk/communication/Azure.Communication.CallAutomation/tests/EventProcessors/AttachEventProcessorTests.cs b/sdk/communication/Azure.Communication.CallAutomation/tests/EventProcessors/AttachEventProcessorTests.cs index d15f89a8f080..66b587ebeb96 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/tests/EventProcessors/AttachEventProcessorTests.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/tests/EventProcessors/AttachEventProcessorTests.cs @@ -25,7 +25,7 @@ public void OnGoingHandlerAttach() handler.AttachOngoingEventProcessor(CallConnectionId, passedEvent => callConnectionIdPassedFromOngoingEventProcessor = passedEvent.CallConnectionId); // Create and send event to event processor first - SendAndProcessEvent(handler, new CallConnected(null, CallConnectionId, ServerCallId, CorelationId)); + SendAndProcessEvent(handler, new CallConnected(CallConnectionId, ServerCallId, CorelationId, null, null)); // Assert if the delegate was also called Assert.AreEqual(CallConnectionId, callConnectionIdPassedFromOngoingEventProcessor); @@ -46,7 +46,7 @@ public void OnGoingHandlerDetach() handler.DetachOngoingEventProcessor(CallConnectionId); // Create and send event to event processor first - SendAndProcessEvent(handler, new CallConnected(null, CallConnectionId, ServerCallId, CorelationId)); + SendAndProcessEvent(handler, new CallConnected(CallConnectionId, ServerCallId, CorelationId, null, null)); // Assert if the delegate didnt get called Assert.AreEqual(ServerCallId, callConnectionIdPassedFromOngoingEventProcessor); @@ -66,7 +66,7 @@ public void ReplaceExistingOnGoingHandler() // Then replace with correct one handler.AttachOngoingEventProcessor(CallConnectionId, passedEvent => callConnectionIdPassedFromOngoingEventProcessor = passedEvent.CallConnectionId); - SendAndProcessEvent(handler, new CallConnected(null, CallConnectionId, ServerCallId, CorelationId)); + SendAndProcessEvent(handler, new CallConnected(CallConnectionId, ServerCallId, CorelationId, null, null)); // Assert if the delegate was also called Assert.AreEqual(CallConnectionId, callConnectionIdPassedFromOngoingEventProcessor); @@ -82,7 +82,7 @@ public void EventMismatch() // Add delegate for call connected event handler.AttachOngoingEventProcessor(CallConnectionId, passedEvent => callConnectionIdPassedFromOngoingEventProcessor = passedEvent.CallConnectionId); - var internalEvent = new CallTransferAcceptedInternal(null, null, null, null, CallConnectionId, ServerCallId, CorelationId); + var internalEvent = new CallTransferAcceptedInternal(CallConnectionId, ServerCallId, CorelationId, null, null, null, null); // Create and send event to event processor first SendAndProcessEvent(handler, new CallTransferAccepted(internalEvent)); @@ -103,9 +103,9 @@ public void CheckIfOngoingProcessorIsDetachedAfterCallDisconnect() handler.AttachOngoingEventProcessor(CallConnectionId, passedEvent => callConnectionIdPassedFromOngoingEventProcessor = passedEvent.CallConnectionId); // Create and send event to event processor first - SendAndProcessEvent(handler, new CallDisconnected(null, CallConnectionId, ServerCallId, CorelationId)); + SendAndProcessEvent(handler, new CallDisconnected(CallConnectionId, ServerCallId, CorelationId, null, null)); - SendAndProcessEvent(handler, new CallConnected(null,CallConnectionId, ServerCallId, CorelationId)); + SendAndProcessEvent(handler, new CallConnected(CallConnectionId, ServerCallId, CorelationId, null, null)); // Assert if the delegate was never called Assert.AreEqual(ServerCallId, callConnectionIdPassedFromOngoingEventProcessor); diff --git a/sdk/communication/Azure.Communication.CallAutomation/tests/EventProcessors/EventProcessorAsyncTests.cs b/sdk/communication/Azure.Communication.CallAutomation/tests/EventProcessors/EventProcessorAsyncTests.cs index 831f0906c845..1b92dfe0d5eb 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/tests/EventProcessors/EventProcessorAsyncTests.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/tests/EventProcessors/EventProcessorAsyncTests.cs @@ -26,7 +26,7 @@ public async Task ProcessEventAndWaitForIt() && ev.GetType() == typeof(CallConnected)); // Create and send event to event processor - SendAndProcessEvent(handler, new CallConnected(null, CallConnectionId, ServerCallId, CorelationId)); + SendAndProcessEvent(handler, new CallConnected(CallConnectionId, ServerCallId, CorelationId, null, null)); CallAutomationEventBase returnedBaseEvent = await baseEventTask; @@ -44,10 +44,10 @@ public async Task ProcessEventFirstThenWaitForIt() CallAutomationEventProcessor handler = callAutomationClient.GetEventProcessor(); // Create and send event to event processor first - SendAndProcessEvent(handler, new CallConnected(null, CallConnectionId, ServerCallId, CorelationId)); + SendAndProcessEvent(handler, new CallConnected(CallConnectionId, ServerCallId, CorelationId, null, null)); // Wait for Event after - CallAutomationEventBase returnedBaseEvent = await handler.WaitForEventProcessorAsync(ev + CallAutomationEventBase returnedBaseEvent = await handler.WaitForEventProcessorAsync(ev => ev.CallConnectionId == CallConnectionId && ev.GetType() == typeof(CallConnected)); @@ -79,7 +79,7 @@ public async Task NoMatchTimeOutException() }; // Create and send event to event processor - SendAndProcessEvent(handler, new CallConnected(null, CallConnectionId, ServerCallId, CorelationId)); + SendAndProcessEvent(handler, new CallConnected(CallConnectionId, ServerCallId, CorelationId, null, null)); try { @@ -108,7 +108,7 @@ public async Task WaitForMultipleEventsInSequence() var task = handler.WaitForEventProcessorAsync(ev => ev.CallConnectionId == CallConnectionId && ev.GetType() == typeof(CallConnected)); - SendAndProcessEvent(handler, new CallConnected(null, CallConnectionId, ServerCallId, CorelationId)); + SendAndProcessEvent(handler, new CallConnected(CallConnectionId, ServerCallId, CorelationId, null, null)); // assert CallAutomationEventBase returnedBaseEvent = await task; @@ -133,7 +133,7 @@ public async Task WaitForMultipleEventsSentAllAtOnce() // Create and send multiple events to event processor AT ONCE for (int i = 0; i < eventsSent; i++) { - SendAndProcessEvent(handler, new CallConnected(null, CallConnectionId, ServerCallId, CorelationId)); + SendAndProcessEvent(handler, new CallConnected(CallConnectionId, ServerCallId, CorelationId, null, null)); } // Wait for event in sequence diff --git a/sdk/communication/Azure.Communication.CallAutomation/tests/EventProcessors/ResultWithEventProcessorAsyncTests.cs b/sdk/communication/Azure.Communication.CallAutomation/tests/EventProcessors/ResultWithEventProcessorAsyncTests.cs index 396bc43ab288..88150a36a328 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/tests/EventProcessors/ResultWithEventProcessorAsyncTests.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/tests/EventProcessors/ResultWithEventProcessorAsyncTests.cs @@ -31,7 +31,7 @@ public async Task CreateCallEventResultSuccessTest() Assert.AreEqual(successCode, response.GetRawResponse().Status); // Create and send event to event processor - SendAndProcessEvent(handler, new CallConnected(null, CallConnectionId, ServerCallId, CorelationId)); + SendAndProcessEvent(handler, new CallConnected(CallConnectionId, ServerCallId, CorelationId, null, null)); CreateCallEventResult returnedResult = await response.Value.WaitForEventProcessorAsync(); @@ -48,20 +48,16 @@ public async Task CreateCallEventResultFailedTest() { // Failed with operation mismatch int successCode = (int)HttpStatusCode.Created; - CallAutomationClient callAutomationClient = CreateMockCallAutomationClient( responseCode: successCode, responseContent: CreateOrAnswerCallOrGetCallConnectionPayload, options: new CallAutomationClientOptions() { Source = new CommunicationUserIdentifier("12345") }); CallAutomationEventProcessor handler = callAutomationClient.GetEventProcessor(); - var response = callAutomationClient.CreateCall(new CreateCallOptions(CreateMockInvite(), new Uri(CallBackUri))); Assert.AreEqual(successCode, response.GetRawResponse().Status); - - SendAndProcessEvent(handler, new CreateCallFailed(new CreateCallFailedInternal("mismatchedOperationId", null, CallConnectionId, ServerCallId, CorelationId))); - + var createCallFailedInternalEvent = new CreateCallFailedInternal(CallConnectionId, ServerCallId, CorelationId, "mismatchedOperationId", null); + SendAndProcessEvent(handler, new CreateCallFailed(createCallFailedInternalEvent)); CreateCallEventResult returnedResult = await response.Value.WaitForEventProcessorAsync(); - // Assert Assert.NotNull(returnedResult); Assert.AreEqual(false, returnedResult.IsSuccess); @@ -86,7 +82,7 @@ public async Task AnswerCallEventResultSuccessTest() Assert.AreEqual(successCode, response.GetRawResponse().Status); // Create and send event to event processor - SendAndProcessEvent(handler, new CallConnected(null, CallConnectionId, ServerCallId, CorelationId)); + SendAndProcessEvent(handler, new CallConnected(CallConnectionId, ServerCallId, CorelationId, null, null)); AnswerCallEventResult returnedResult = await response.Value.WaitForEventProcessorAsync(); @@ -98,35 +94,6 @@ public async Task AnswerCallEventResultSuccessTest() Assert.AreEqual(CallConnectionId, returnedResult.SuccessResult.CallConnectionId); } - [Test] - public async Task AnswerCallEventResultFailedTest() - { - int successCode = (int)HttpStatusCode.OK; - - // Failed with operation mismatch - CallAutomationClient callAutomationClient = CreateMockCallAutomationClient( - responseCode: successCode, - responseContent: CreateOrAnswerCallOrGetCallConnectionPayload, - options: new CallAutomationClientOptions() { Source = new CommunicationUserIdentifier("12345") }); - CallAutomationEventProcessor handler = callAutomationClient.GetEventProcessor(); - - var response = callAutomationClient.AnswerCall("incomingCallContext", new Uri(CallBackUri)); - Assert.AreEqual(successCode, response.GetRawResponse().Status); - - // Create and send event to event processor - SendAndProcessEvent(handler, new AnswerFailed(new AnswerFailedInternal("mismatchedOperationId", null, CallConnectionId, ServerCallId, CorelationId))); - - AnswerCallEventResult returnedResult = await response.Value.WaitForEventProcessorAsync(); - - // Assert - Assert.NotNull(returnedResult); - Assert.AreEqual(false, returnedResult.IsSuccess); - Assert.NotNull(returnedResult.FailureResult); - Assert.IsNull(returnedResult.SuccessResult); - Assert.AreEqual(typeof(AnswerFailed), returnedResult.FailureResult.GetType()); - Assert.AreEqual(CallConnectionId, returnedResult.FailureResult.CallConnectionId); - } - [Test] public async Task TransferCallEventResultSuccessTest() { @@ -145,7 +112,7 @@ public async Task TransferCallEventResultSuccessTest() var transferTarget = new CommunicationIdentifierModel(); transferTarget.CommunicationUser = new CommunicationUserIdentifierModel(TargetUser); transferTarget.RawId = TargetUser; - var internalEvent = new CallTransferAcceptedInternal(response.Value.OperationContext, null, transferTarget, transferee, CallConnectionId, ServerCallId, CorelationId); + var internalEvent = new CallTransferAcceptedInternal(CallConnectionId, ServerCallId, CorelationId, response.Value.OperationContext, null, transferTarget, transferee); // Create and send event to event processor SendAndProcessEvent(handler, new CallTransferAccepted(internalEvent)); @@ -177,7 +144,7 @@ public async Task TransferCallEventResultFailedTest() Assert.AreEqual(successCode, response.GetRawResponse().Status); // Create and send event to event processor - SendAndProcessEvent(handler, new CallTransferFailed(response.Value.OperationContext, null, CallConnectionId, ServerCallId, CorelationId)); + SendAndProcessEvent(handler, new CallTransferFailed(CallConnectionId, ServerCallId, CorelationId, response.Value.OperationContext, null)); TransferCallToParticipantEventResult returnedResult = await response.Value.WaitForEventProcessorAsync(); @@ -256,8 +223,10 @@ public async Task PlayEventResultSuccessTest() var response = callConnection.GetCallMedia().PlayToAll(new PlayToAllOptions(new FileSource(new Uri(CallBackUri))) { OperationContext = OperationContext }); Assert.AreEqual(successCode, response.GetRawResponse().Status); + var internalEvent = new PlayCompletedInternal(CallConnectionId, ServerCallId, CorelationId, OperationContext, new ResultInformation() { }); + // Create and send event to event processor - SendAndProcessEvent(handler, new PlayCompleted(new ResultInformation() { }, OperationContext, CallConnectionId, ServerCallId, CorelationId)); + SendAndProcessEvent(handler, new PlayCompleted(internalEvent)); PlayEventResult returnedResult = await response.Value.WaitForEventProcessorAsync(); @@ -282,8 +251,10 @@ public async Task PlayEventResultFailedTest() var response = callConnection.GetCallMedia().PlayToAll(new PlayToAllOptions(new FileSource(new Uri(CallBackUri))) { OperationContext = OperationContext }); Assert.AreEqual(successCode, response.GetRawResponse().Status); + var internalEvent = new PlayFailedInternal(CallConnectionId, ServerCallId, CorelationId, OperationContext, new ResultInformation() { }, null); + // Create and send event to event processor - SendAndProcessEvent(handler, new PlayFailed(OperationContext, new ResultInformation() { }, CallConnectionId, ServerCallId, CorelationId)); + SendAndProcessEvent(handler, new PlayFailed(internalEvent)); PlayEventResult returnedResult = await response.Value.WaitForEventProcessorAsync(); @@ -309,7 +280,7 @@ public async Task CancelMediaEventResultPlayCancelTest() Assert.AreEqual(successCode, response.GetRawResponse().Status); // Create and send event to event processor - SendAndProcessEvent(handler, new PlayCanceled(null, CallConnectionId, ServerCallId, CorelationId)); + SendAndProcessEvent(handler, new PlayCanceled(CallConnectionId, ServerCallId, CorelationId, null, null)); CancelAllMediaOperationsEventResult returnedResult = await response.Value.WaitForEventProcessorAsync(); @@ -334,7 +305,7 @@ public async Task CancelMediaEventResultRecognizeCancelTest() Assert.AreEqual(successCode, response.GetRawResponse().Status); // Create and send event to event processor - SendAndProcessEvent(handler, new RecognizeCanceled(null, CallConnectionId, ServerCallId, CorelationId)); + SendAndProcessEvent(handler, new RecognizeCanceled(CallConnectionId, ServerCallId, CorelationId, null, null)); CancelAllMediaOperationsEventResult returnedResult = await response.Value.WaitForEventProcessorAsync(); @@ -384,8 +355,10 @@ public async Task RecognizeEventResultFailedTest() var response = callConnection.GetCallMedia().StartRecognizing(new CallMediaRecognizeDtmfOptions(new CommunicationUserIdentifier(TargetId), 1) { OperationContext = OperationContext }); Assert.AreEqual(successCode, response.GetRawResponse().Status); + var internalEvent = new RecognizeFailedInternal(CallConnectionId, ServerCallId, CorelationId, OperationContext, new ResultInformation() { }, null); + // Create and send event to event processor - SendAndProcessEvent(handler, new RecognizeFailed(OperationContext, new ResultInformation(), CallConnectionId, ServerCallId, CorelationId)); + SendAndProcessEvent(handler, new RecognizeFailed(internalEvent)); StartRecognizingEventResult returnedResult = await response.Value.WaitForEventProcessorAsync(); @@ -511,82 +484,6 @@ public async Task SendDtmfEventResultFailedTest() Assert.AreEqual(OperationContext, returnedResult.FailureResult.OperationContext); } - [Test] - public async Task StartDialogEventResultSuccessTest() - { - int successCode = (int)HttpStatusCode.Created; - - var callConnection = CreateMockCallConnection(successCode, DialogPayload); - CallAutomationEventProcessor handler = callConnection.EventProcessor; - - var dialogContext = new Dictionary(); - var startDialogOptions = new StartDialogOptions(new PowerVirtualAgentsDialog("botAppId", dialogContext)) - { - OperationContext = OperationContext - }; - - var response = callConnection.GetCallDialog().StartDialog(startDialogOptions); - Assert.AreEqual(successCode, response.GetRawResponse().Status); - - // Create and send event to event processor - SendAndProcessEvent(handler, new DialogStarted(CallConnectionId, ServerCallId, CorelationId, OperationContext, new ResultInformation(), "dialogId", DialogInputType.PowerVirtualAgents)); - - DialogEventResult returnedResult = await response.Value.WaitForEventProcessorAsync(); - - // Assert - Assert.NotNull(returnedResult); - Assert.AreEqual(true, returnedResult.IsSuccess); - Assert.NotNull(returnedResult.DialogStartedSuccessEvent); - Assert.IsNull(returnedResult.DialogCompletedSuccessResult); - Assert.IsNull(returnedResult.DialogConsentSuccessEvent); - Assert.IsNull(returnedResult.DialogHangupSuccessEvent); - Assert.IsNull(returnedResult.DialogLanguageChangeEvent); - Assert.IsNull(returnedResult.DialogSensitivityUpdateEvent); - Assert.IsNull(returnedResult.DialogTransferSuccessEvent); - Assert.IsNull(returnedResult.FailureResult); - Assert.AreEqual(typeof(DialogStarted), returnedResult.DialogStartedSuccessEvent.GetType()); - Assert.AreEqual(CallConnectionId, returnedResult.DialogStartedSuccessEvent.CallConnectionId); - Assert.AreEqual(OperationContext, returnedResult.DialogStartedSuccessEvent.OperationContext); - } - - [Test] - public async Task StartDialogEventResultFailedTest() - { - int successCode = (int)HttpStatusCode.Created; - - var callConnection = CreateMockCallConnection(successCode, DialogPayload); - CallAutomationEventProcessor handler = callConnection.EventProcessor; - - var dialogContext = new Dictionary(); - var startDialogOptions = new StartDialogOptions(new PowerVirtualAgentsDialog("botAppId", dialogContext)) - { - OperationContext = OperationContext - }; - - var response = callConnection.GetCallDialog().StartDialog(startDialogOptions); - Assert.AreEqual(successCode, response.GetRawResponse().Status); - - // Create and send event to event processor - SendAndProcessEvent(handler, new DialogFailed(CallConnectionId, ServerCallId, CorelationId, OperationContext, new ResultInformation(), "dialogId", DialogInputType.PowerVirtualAgents)); - - DialogEventResult returnedResult = await response.Value.WaitForEventProcessorAsync(); - - // Assert - Assert.NotNull(returnedResult); - Assert.AreEqual(false, returnedResult.IsSuccess); - Assert.IsNull(returnedResult.DialogStartedSuccessEvent); - Assert.IsNull(returnedResult.DialogCompletedSuccessResult); - Assert.IsNull(returnedResult.DialogConsentSuccessEvent); - Assert.IsNull(returnedResult.DialogHangupSuccessEvent); - Assert.IsNull(returnedResult.DialogLanguageChangeEvent); - Assert.IsNull(returnedResult.DialogSensitivityUpdateEvent); - Assert.IsNull(returnedResult.DialogTransferSuccessEvent); - Assert.NotNull(returnedResult.FailureResult); - Assert.AreEqual(typeof(DialogFailed), returnedResult.FailureResult.GetType()); - Assert.AreEqual(CallConnectionId, returnedResult.FailureResult.CallConnectionId); - Assert.AreEqual(OperationContext, returnedResult.FailureResult.OperationContext); - } - [Test] public async Task CancelAddParticipantSucceededEventResultFailedTest() { @@ -636,7 +533,6 @@ public async Task CancelAddParticipantSucceededEventResultSuccessTest() ServerCallId, CorelationId, invitationId, - callInvite.Target, OperationContext)); CancelAddParticipantEventResult returnedResult = await response.Value.WaitForEventProcessorAsync(); diff --git a/sdk/communication/Azure.Communication.CallAutomation/tests/Events/CallAutomationEventParserTests.cs b/sdk/communication/Azure.Communication.CallAutomation/tests/Events/CallAutomationEventParserTests.cs index 846753527958..a8b8e6c6f3f5 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/tests/Events/CallAutomationEventParserTests.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/tests/Events/CallAutomationEventParserTests.cs @@ -268,6 +268,35 @@ public void CallConnectedEventParsed_Test() } } + //[Test] + //public void ConnectFailedEventParsed_Test() + //{ + // // arrange + // var callConnectionId = "callConnectionId"; + // var serverCallId = "serverCallId"; + // var correlationId = "correlationId"; + // var @event = CallAutomationModelFactory.ConnectFailed(callConnectionId, serverCallId, correlationId); + // JsonSerializerOptions jsonOptions = new() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }; + // string jsonEvent = JsonSerializer.Serialize(@event, jsonOptions); + + // // act + // var parsedEvent = CallAutomationEventParser.Parse(jsonEvent, "Microsoft.Communication.ConnectFailed"); + + // // assert + // if (parsedEvent is ConnectFailed connectFailed) + // { + // Assert.AreEqual(callConnectionId, connectFailed.CallConnectionId); + // Assert.AreEqual(serverCallId, connectFailed.ServerCallId); + // Assert.AreEqual(correlationId, connectFailed.CorrelationId); + // Assert.IsNull(connectFailed.OperationContext); + // Assert.IsNull(connectFailed.ResultInformation); + // } + // else + // { + // Assert.Fail("Event parsed wrongfully"); + // } + //} + [Test] public void CallDisconnectedEventParsed_Test() { @@ -472,6 +501,30 @@ public void PlayFailedEventParsed_Test() } } + //[Test] + //public void PlayStartedEventParsed_Test() + //{ + // PlayStarted @event = CallAutomationModelFactory.PlayStarted( + // callConnectionId: "callConnectionId", + // serverCallId: "serverCallId", + // correlationId: "correlationId", + // operationContext: "operationContext", + // resultInformation: new ResultInformation(code: 200, subCode: 0, message: "Action completed successfully")); + // JsonSerializerOptions jsonOptions = new() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }; + // string jsonEvent = JsonSerializer.Serialize(@event, jsonOptions); + // var parsedEvent = CallAutomationEventParser.Parse(jsonEvent, "Microsoft.Communication.PlayStarted"); + // if (parsedEvent is PlayStarted playStarted) + // { + // Assert.AreEqual("correlationId", playStarted.CorrelationId); + // Assert.AreEqual("serverCallId", playStarted.ServerCallId); + // Assert.AreEqual(200, playStarted.ResultInformation?.Code); + // } + // else + // { + // Assert.Fail("Event parsed wrongfully"); + // } + //} + [Test] public void PlayCanceledEventParsed_Test() { @@ -635,7 +688,7 @@ public void GetRecognizeResultFromRecognizeCompletedWithChoice_Test() Assert.AreEqual("correlationId", recognizeCompleted.CorrelationId); Assert.AreEqual("correlationId", recognizeCompleted.CorrelationId); Assert.AreEqual("serverCallId", recognizeCompleted.ServerCallId); - // Assert.AreEqual(200, recognizeCompleted.ResultInformation?.Code); + // Assert.AreEqual(200, recognizeCompleted.ResultInformation?.Code); if (recognizeResult is ChoiceResult choiceRecongizedResult) { Assert.AreEqual("testLabel", choiceRecongizedResult.Label); @@ -895,7 +948,6 @@ public void CancelAddParticipantSucceededEventParsed_Test() serverCallId: "serverCallId", correlationId: "correlationId", invitationId: "invitationId", - participant: new CommunicationUserIdentifier("8:acs:12345"), operationContext: "operationContext"); JsonSerializerOptions jsonOptions = new() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }; string jsonEvent = JsonSerializer.Serialize(@event, jsonOptions); @@ -956,7 +1008,6 @@ public void CreateCallFailedEventParsed_Test() JsonSerializerOptions jsonOptions = new() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }; string jsonEvent = JsonSerializer.Serialize(@event, jsonOptions); var parsedEvent = CallAutomationEventParser.Parse(jsonEvent, "Microsoft.Communication.CreateCallFailed"); - if (parsedEvent is CreateCallFailed createCallFailed) { Assert.AreEqual("operationContext", createCallFailed.OperationContext); @@ -971,33 +1022,6 @@ public void CreateCallFailedEventParsed_Test() } } - [Test] - public void AnswerFailedEventParsed_Test() - { - AnswerFailed @event = CallAutomationModelFactory.AnswerFailed( - callConnectionId: "callConnectionId", - serverCallId: "serverCallId", - correlationId: "correlationId", - resultInformation: new ResultInformation(code: 400, subCode: 8510, message: "Action failed, some error."), - operationContext: "operationContext"); - JsonSerializerOptions jsonOptions = new() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }; - string jsonEvent = JsonSerializer.Serialize(@event, jsonOptions); - var parsedEvent = CallAutomationEventParser.Parse(jsonEvent, "Microsoft.Communication.AnswerFailed"); - - if (parsedEvent is AnswerFailed answerFailed) - { - Assert.AreEqual("operationContext", answerFailed.OperationContext); - Assert.AreEqual("callConnectionId", answerFailed.CallConnectionId); - Assert.AreEqual("correlationId", answerFailed.CorrelationId); - Assert.AreEqual("serverCallId", answerFailed.ServerCallId); - Assert.AreEqual(400, answerFailed.ResultInformation?.Code); - } - else - { - Assert.Fail("Event parsed wrongfully"); - } - } - [Test] public void TranscriptionStartedEventParsed_Test() { diff --git a/sdk/communication/Azure.Communication.CallAutomation/tests/Infrastructure/CallAutomationClientAutomatedLiveTestsBase.cs b/sdk/communication/Azure.Communication.CallAutomation/tests/Infrastructure/CallAutomationClientAutomatedLiveTestsBase.cs index 96d3c5f7ddea..cb9dbc0dd187 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/tests/Infrastructure/CallAutomationClientAutomatedLiveTestsBase.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/tests/Infrastructure/CallAutomationClientAutomatedLiveTestsBase.cs @@ -32,6 +32,7 @@ internal class CallAutomationClientAutomatedLiveTestsBase : RecordedTestBase> _eventstore; private ConcurrentDictionary _incomingcontextstore; @@ -52,12 +53,19 @@ public CallAutomationClientAutomatedLiveTestsBase(bool isAsync, RecordedTestMode JsonPathSanitizers.Add("$..botAppId"); JsonPathSanitizers.Add("$..ivrContext"); JsonPathSanitizers.Add("$..dialog.botAppId"); - BodyKeySanitizers.Add(new BodyKeySanitizer("..callbackUri") { Value = @"https://sanitized.skype.com/api/servicebuscallback/events?q=SanitizedSanitized"}); + BodyKeySanitizers.Add(new BodyKeySanitizer("..callbackUri") { Value = @"https://sanitized.skype.com/api/servicebuscallback/events?q=SanitizedSanitized" }); + BodyKeySanitizers.Add(new BodyKeySanitizer("..transportUrl") { Value = @"wss://sanitized.skype.com" }); + BodyKeySanitizers.Add(new BodyKeySanitizer("..cognitiveServicesEndpoint") { Value = @"https://sanitized.skype.com" }); + BodyKeySanitizers.Add(new BodyKeySanitizer("$..file.uri") { Value = @"https://sanitized.skype.com/prompt.wav" }); BodyRegexSanitizers.Add(new BodyRegexSanitizer(TestDispatcherRegEx) { Value = "https://sanitized.skype.com" }); UriRegexSanitizers.Add(new UriRegexSanitizer(URIDomainRegEx) { Value = "https://sanitized.skype.com" }); - UriRegexSanitizers.Add(new UriRegexSanitizer(TestDispatcherQNameRegEx)); + UriRegexSanitizers.Add(new UriRegexSanitizer(TestDispatcherQNameRegEx) { Value = SanitizeValue }); + UriRegexSanitizers.Add(new UriRegexSanitizer(ACSUserIdInUrlRegex) { Value = SanitizeValue }); } + public bool SkipCallAutomationInteractionLiveTests + => TestEnvironment.Mode != RecordedTestMode.Playback && Environment.GetEnvironmentVariable("SKIP_CALLAUTOMATION_INTERACTION_LIVE_TESTS") == "TRUE"; + [SetUp] public void TestSetup() { @@ -92,7 +100,7 @@ public async Task CleanUp() } public bool SkipCallingServerInteractionLiveTests - => TestEnvironment.Mode != RecordedTestMode.Playback && Environment.GetEnvironmentVariable("SKIP_CALLINGSERVER_INTERACTION_LIVE_TESTS")== "TRUE"; + => TestEnvironment.Mode != RecordedTestMode.Playback && Environment.GetEnvironmentVariable("SKIP_CALLINGSERVER_INTERACTION_LIVE_TESTS") == "TRUE"; /// /// Creates a @@ -102,15 +110,7 @@ protected CallAutomationClient CreateInstrumentedCallAutomationClientWithConnect { var connectionString = TestEnvironment.LiveTestStaticConnectionString; - CallAutomationClient callAutomationClient; - if (TestEnvironment.PMAEndpoint == null || TestEnvironment.PMAEndpoint.Length == 0) - { - callAutomationClient = new CallAutomationClient(connectionString, CreateServerCallingClientOptionsWithCorrelationVectorLogs(source)); - } - else - { - callAutomationClient = new CallAutomationClient(new Uri(TestEnvironment.PMAEndpoint), connectionString, CreateServerCallingClientOptionsWithCorrelationVectorLogs(source)); - } + CallAutomationClient callAutomationClient = new CallAutomationClient(connectionString, CreateServerCallingClientOptionsWithCorrelationVectorLogs(source)); return InstrumentClient(callAutomationClient); } @@ -310,7 +310,7 @@ private static string RemoveAllNonChar(string inputId) private HttpPipeline BuildHttpPipeline() { var clientOptions = CreateServerCallingClientOptionsWithCorrelationVectorLogs(); - return clientOptions.CustomBuildHttpPipeline( + return clientOptions.BuildHttpPipeline( ConnectionString.Parse(TestEnvironment.LiveTestStaticConnectionString)); } diff --git a/sdk/communication/Azure.Communication.CallAutomation/tests/Infrastructure/CallAutomationClientLiveTestsBase.cs b/sdk/communication/Azure.Communication.CallAutomation/tests/Infrastructure/CallAutomationClientLiveTestsBase.cs index 483a7a8df157..b18de3f088d0 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/tests/Infrastructure/CallAutomationClientLiveTestsBase.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/tests/Infrastructure/CallAutomationClientLiveTestsBase.cs @@ -23,10 +23,10 @@ public CallAutomationClientLiveTestsBase(bool isAsync) : base(isAsync) JsonPathSanitizers.Add("$..rawId"); JsonPathSanitizers.Add("$..value"); UriRegexSanitizers.Add(new UriRegexSanitizer(URIDomainRegEx) { Value = "https://sanitized.skype.com" }); - } + } public bool SkipCallAutomationInteractionLiveTests - => TestEnvironment.Mode != RecordedTestMode.Playback && Environment.GetEnvironmentVariable("SKIP_CALLAUTOMATION_INTERACTION_LIVE_TESTS")== "TRUE"; + => TestEnvironment.Mode != RecordedTestMode.Playback && Environment.GetEnvironmentVariable("SKIP_CALLAUTOMATION_INTERACTION_LIVE_TESTS") == "TRUE"; /// /// Creates a @@ -82,7 +82,8 @@ protected CommunicationIdentityClient CreateInstrumentedCommunicationIdentityCli TestEnvironment.LiveTestStaticConnectionString, InstrumentClientOptions(new CommunicationIdentityClientOptions(CommunicationIdentityClientOptions.ServiceVersion.V2023_10_01)))); - protected async Task CreateIdentityUserAsync() { + protected async Task CreateIdentityUserAsync() + { CommunicationIdentityClient communicationIdentityClient = CreateInstrumentedCommunicationIdentityClient(); return await communicationIdentityClient.CreateUserAsync().ConfigureAwait(false); } diff --git a/sdk/communication/Azure.Communication.CallAutomation/tests/Infrastructure/CallAutomationClientTestEnvironment.cs b/sdk/communication/Azure.Communication.CallAutomation/tests/Infrastructure/CallAutomationClientTestEnvironment.cs index f0108637f123..92fd1f2b28f3 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/tests/Infrastructure/CallAutomationClientTestEnvironment.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/tests/Infrastructure/CallAutomationClientTestEnvironment.cs @@ -31,6 +31,12 @@ internal class CallAutomationClientTestEnvironment : CommunicationTestEnvironmen private string botAppId = "BOT_APP_ID"; + private string transportUrl = "TRANSPORT_URL"; + + private string fileSourceUrl = "FILE_SOURCE_URL"; + + private string cognitiveServiceEndpoint = "COGNITIVE_SERVICE_ENDPOINT"; + /// /// The resource identifier associated with the Azure Communication Service. /// @@ -76,6 +82,21 @@ internal class CallAutomationClientTestEnvironment : CommunicationTestEnvironmen public string ServiceBusConnectionString => GetRecordedOptionalVariable(servicebusString, options => options.HasSecretConnectionStringParameter("SharedAccessKey", SanitizedValue.Base64).HasSecretConnectionStringParameter("SharedAccessKeyName")); + /// + /// websocket url for automated testing + /// + public string TransportUrl => GetRecordedOptionalVariable(transportUrl, options => options.IsSecret("https://sanitized.skype.com")); + + /// + /// file source for automated testing + /// + public string FileSourceUrl => GetRecordedOptionalVariable(fileSourceUrl, options => options.IsSecret("https://sanitized.skype.com/prompt.wav")); + + /// + /// Cognitive service endpoint for automated testing + /// + public string CognitiveServiceEndpoint => GetRecordedOptionalVariable(cognitiveServiceEndpoint, options => options.IsSecret("https://sanitized.skype.com")); + /// /// The callback url of the application where notification would be received. /// diff --git a/sdk/communication/Azure.Communication.CallAutomation/tests/Infrastructure/CallAutomationEventProcessorTestBase.cs b/sdk/communication/Azure.Communication.CallAutomation/tests/Infrastructure/CallAutomationEventProcessorTestBase.cs index 43f2a3b52ed3..4bd706f2d05f 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/tests/Infrastructure/CallAutomationEventProcessorTestBase.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/tests/Infrastructure/CallAutomationEventProcessorTestBase.cs @@ -25,12 +25,15 @@ public abstract class CallAutomationEventProcessorTestBase protected const string TargetUser = "TARGET_USER_ID"; protected const string TransfereeUser = "TRANSFEREE_USER_ID"; protected const int defaultTestTimeout = 3; - private const string NoneMediaSubscriptionId = "null"; - private const string MediaSubscriptionId = "\"mediaSubscriptionId\""; - protected string CreateOrAnswerCallOrGetCallConnectionPayload = string.Format(DummyPayload, NoneMediaSubscriptionId); - protected string CreateOrAnswerCallOrGetCallConnectionWithMediaSubscriptionPayload = string.Format(DummyPayload, MediaSubscriptionId); + private const string NoneMediaSubscription = "null"; + private const string MediaStreamingSubscription = "{" + + " \"id\": \"22c3a25a-aed5-47df-9ef9-5ba5c7b6d08e\"," + + "\"state\": \"disabled\",\"subscribedContentTypes\": [" + + "\"audio\"] }"; + protected string CreateOrAnswerCallOrGetCallConnectionPayload = string.Format(DummyPayload, NoneMediaSubscription); + protected string CreateOrAnswerCallOrGetCallConnectionWithMediaSubscriptionPayload = string.Format(DummyPayload, MediaStreamingSubscription); - protected const string DummyPayload = "{{\"callConnectionId\": \"someCallConnectionId\",\"serverCallId\": \"someServerCallId\",\"targets\": [{{\"rawId\":\"targetId\",\"kind\":\"communicationUser\",\"communicationUser\":{{\"id\":\"targetId\"}}}}],\"source\":{{\"rawId\":\"sourceId\",\"kind\":\"communicationUser\",\"communicationUser\":{{\"id\":\"sourceId\"}}}},\"callConnectionState\": \"connecting\",\"subject\": \"dummySubject\",\"callbackUri\": \"https://bot.contoso.com/callback\",\"mediaSubscriptionId\": {0}}}"; + protected const string DummyPayload = "{{\"callConnectionId\": \"someCallConnectionId\",\"serverCallId\": \"someServerCallId\",\"targets\": [{{\"rawId\":\"targetId\",\"kind\":\"communicationUser\",\"communicationUser\":{{\"id\":\"targetId\"}}}}],\"source\":{{\"rawId\":\"sourceId\",\"kind\":\"communicationUser\",\"communicationUser\":{{\"id\":\"sourceId\"}}}},\"callConnectionState\": \"connecting\",\"subject\": \"dummySubject\",\"callbackUri\": \"https://bot.contoso.com/callback\",\"mediaStreamingSubscription\": {0}}}"; protected const string TransferCallOrRemoveParticipantsPayload = "{\"operationContext\": \"someOperationContext\"}"; @@ -49,7 +52,7 @@ public abstract class CallAutomationEventProcessorTestBase "\"invitationId\": \"invitationId\"" + "}"; - internal CallAutomationClient CreateMockCallAutomationClient(int responseCode, object? responseContent = null, HttpHeader[]? httpHeaders = null, CallAutomationClientOptions ? options = default) + internal CallAutomationClient CreateMockCallAutomationClient(int responseCode, object? responseContent = null, HttpHeader[]? httpHeaders = null, CallAutomationClientOptions? options = default) { var mockResponse = new MockResponse(responseCode); @@ -98,7 +101,7 @@ protected IEnumerable CreateMoakTargets(IEnumerable words = transcription.Words.ToList(); Assert.AreEqual(2, words.Count); Assert.AreEqual("Hello", words[0].Text); - Assert.AreEqual(1, words[0].Offset); - Assert.AreEqual(1, words[0].Duration); + Assert.AreEqual(1, words[0].Offset.Ticks); + Assert.AreEqual(1, words[0].Duration.Ticks); Assert.AreEqual("World", words[1].Text); - Assert.AreEqual(6, words[1].Offset); - Assert.AreEqual(1, words[1].Duration); + Assert.AreEqual(6, words[1].Offset.Ticks); + Assert.AreEqual(1, words[1].Duration.Ticks); Assert.IsTrue(transcription.Participant is CommunicationIdentifier); Assert.AreEqual("abc12345", transcription.Participant.RawId); - Console.WriteLine(transcription.ResultStatus.ToString()); - Assert.AreEqual(ResultStatus.Final, transcription.ResultStatus); + Console.WriteLine(transcription.ResultState.ToString()); + Assert.AreEqual(TranscriptionResultState.Final, transcription.ResultState); } #endregion }