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 44b0841ec02d..dadcb7255a2d 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 @@ -45,8 +45,8 @@ internal AnswerCallEventResult() { } public partial class AnswerCallOptions { public AnswerCallOptions(string incomingCallContext, System.Uri callbackUri) { } - public Azure.Communication.CommunicationUserIdentifier AnsweredByIdentifier { get { throw null; } set { } } - public System.Uri AzureCognitiveServicesEndpointUrl { get { throw null; } set { } } + public Azure.Communication.CommunicationUserIdentifier AnsweredBy { get { throw null; } set { } } + public System.Uri AzureCognitiveServicesEndpointUri { get { throw null; } set { } } public System.Uri CallbackUri { get { throw null; } } public string IncomingCallContext { get { throw null; } } public Azure.Communication.CallAutomation.MediaStreamingOptions MediaStreamingOptions { get { throw null; } set { } } @@ -73,6 +73,7 @@ public CallAutomationClient(string connectionString, Azure.Communication.CallAut public CallAutomationClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Communication.CallAutomation.CallAutomationClientOptions options = null) { } public CallAutomationClient(System.Uri pmaEndpoint, string connectionString, Azure.Communication.CallAutomation.CallAutomationClientOptions options = null) { } public CallAutomationClient(System.Uri pmaEndpoint, System.Uri acsEndpoint, Azure.Core.TokenCredential credential, Azure.Communication.CallAutomation.CallAutomationClientOptions options = null) { } + public Azure.Communication.CommunicationUserIdentifier Source { get { throw null; } } public virtual Azure.Response AnswerCall(Azure.Communication.CallAutomation.AnswerCallOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } 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; } @@ -86,7 +87,6 @@ public CallAutomationClient(System.Uri pmaEndpoint, System.Uri acsEndpoint, Azur public virtual Azure.Communication.CallAutomation.CallConnection GetCallConnection(string callConnectionId) { throw null; } public virtual Azure.Communication.CallAutomation.CallRecording GetCallRecording() { throw null; } public virtual Azure.Communication.CallAutomation.CallAutomationEventProcessor GetEventProcessor() { throw null; } - public virtual Azure.Communication.CommunicationUserIdentifier GetSourceIdentity() { throw null; } public virtual Azure.Response RedirectCall(Azure.Communication.CallAutomation.RedirectCallOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response RedirectCall(string incomingCallContext, Azure.Communication.CallAutomation.CallInvite callInvite, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task RedirectCallAsync(Azure.Communication.CallAutomation.RedirectCallOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -105,15 +105,6 @@ public enum ServiceVersion V2023_01_15_Preview = 1, } } - public static partial class CallAutomationErrorMessages - { - public const string InvalidCognitiveServiceHttpsUriMessage = "Cognitive Service Uri has to be in well-formed, valid https format."; - public const string InvalidHttpsUriMessage = "Callback Uri has to be in well-formed, valid https format."; - public const string InvalidInvitationTimeoutInSeconds = "InvitationTimeoutInSeconds has to be between 1 and 180 seconds."; - public const string InvalidRepeatabilityHeadersMessage = "Invalid RepeatabilityHeaders. RepeatabilityHeaders is only valid when RepeatabilityRequestId and RepeatabilityFirstSent are set to non-default value."; - public const string OperationContextExceedsMaxLength = "OperationContext exceeds maximum string length of 5000."; - public const string UserToUserInformationExceedsMaxLength = "UserToUserInformation exceeds maximum string length of 5000."; - } public abstract partial class CallAutomationEventBase { protected CallAutomationEventBase() { } @@ -166,10 +157,10 @@ protected CallConnection() { } public virtual System.Threading.Tasks.Task>> GetParticipantsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response HangUp(bool forEveryone, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task HangUpAsync(bool forEveryone, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response MuteParticipants(Azure.Communication.CallAutomation.MuteParticipantsOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response MuteParticipants(Azure.Communication.CommunicationIdentifier targetParticipant, string operationContext = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> MuteParticipantsAsync(Azure.Communication.CallAutomation.MuteParticipantsOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> MuteParticipantsAsync(Azure.Communication.CommunicationIdentifier targetParticipant, string operationContext = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response MuteParticipants(Azure.Communication.CallAutomation.MuteParticipantsOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response MuteParticipants(Azure.Communication.CommunicationIdentifier targetParticipant, string operationContext = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> MuteParticipantsAsync(Azure.Communication.CallAutomation.MuteParticipantsOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> MuteParticipantsAsync(Azure.Communication.CommunicationIdentifier targetParticipant, string operationContext = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response RemoveParticipant(Azure.Communication.CallAutomation.RemoveParticipantOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response RemoveParticipant(Azure.Communication.CommunicationIdentifier participantToRemove, string operationContext = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> RemoveParticipantAsync(Azure.Communication.CallAutomation.RemoveParticipantOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -178,24 +169,24 @@ protected CallConnection() { } public virtual Azure.Response TransferCallToParticipant(Azure.Communication.CommunicationIdentifier targetParticipant, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> TransferCallToParticipantAsync(Azure.Communication.CallAutomation.TransferToParticipantOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> TransferCallToParticipantAsync(Azure.Communication.CommunicationIdentifier targetParticipant, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response UnmuteParticipants(Azure.Communication.CallAutomation.UnmuteParticipantsOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response UnmuteParticipants(Azure.Communication.CommunicationIdentifier targetParticipant, string operationContext = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> UnmuteParticipantsAsync(Azure.Communication.CallAutomation.UnmuteParticipantsOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> UnmuteParticipantsAsync(Azure.Communication.CommunicationIdentifier targetParticipant, string operationContext = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response UnmuteParticipants(Azure.Communication.CallAutomation.UnmuteParticipantsOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response UnmuteParticipants(Azure.Communication.CommunicationIdentifier targetParticipant, string operationContext = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UnmuteParticipantsAsync(Azure.Communication.CallAutomation.UnmuteParticipantsOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UnmuteParticipantsAsync(Azure.Communication.CommunicationIdentifier targetParticipant, string operationContext = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class CallConnectionProperties { internal CallConnectionProperties() { } - public Azure.Communication.CommunicationUserIdentifier AnsweredByIdentifier { get { throw null; } } + public Azure.Communication.CommunicationUserIdentifier AnsweredBy { 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 MediaSubscriptionId { 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 Azure.Communication.CommunicationIdentifier SourceIdentity { get { throw null; } } public System.Collections.Generic.IReadOnlyList Targets { get { throw null; } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] @@ -297,8 +288,8 @@ protected CallMedia() { } } public partial class CallMediaRecognizeChoiceOptions : Azure.Communication.CallAutomation.CallMediaRecognizeOptions { - public CallMediaRecognizeChoiceOptions(Azure.Communication.CommunicationIdentifier targetParticipant, System.Collections.Generic.List recognizeChoices) : base (default(Azure.Communication.CallAutomation.RecognizeInputType), default(Azure.Communication.CommunicationIdentifier)) { } - public System.Collections.Generic.IList RecognizeChoices { get { throw null; } } + public CallMediaRecognizeChoiceOptions(Azure.Communication.CommunicationIdentifier targetParticipant, System.Collections.Generic.IEnumerable recognizeChoices) : base (default(Azure.Communication.CallAutomation.RecognizeInputType), default(Azure.Communication.CommunicationIdentifier)) { } + public System.Collections.Generic.IReadOnlyList RecognizeChoices { get { throw null; } } } public partial class CallMediaRecognizeDtmfOptions : Azure.Communication.CallAutomation.CallMediaRecognizeOptions { @@ -323,15 +314,15 @@ protected CallMediaRecognizeOptions(Azure.Communication.CallAutomation.Recognize public partial class CallMediaRecognizeSpeechOptions : Azure.Communication.CallAutomation.CallMediaRecognizeOptions { public CallMediaRecognizeSpeechOptions(Azure.Communication.CommunicationIdentifier targetParticipant) : base (default(Azure.Communication.CallAutomation.RecognizeInputType), default(Azure.Communication.CommunicationIdentifier)) { } - public System.TimeSpan EndSilenceTimeoutInMs { get { throw null; } set { } } + public System.TimeSpan EndSilenceTimeout { get { throw null; } set { } } } public partial class CallMediaRecognizeSpeechOrDtmfOptions : Azure.Communication.CallAutomation.CallMediaRecognizeOptions { public CallMediaRecognizeSpeechOrDtmfOptions(Azure.Communication.CommunicationIdentifier targetParticipant, int maxTonesToCollect) : base (default(Azure.Communication.CallAutomation.RecognizeInputType), default(Azure.Communication.CommunicationIdentifier)) { } - public System.TimeSpan EndSilenceTimeoutInMs { get { throw null; } set { } } + public System.TimeSpan EndSilenceTimeout { get { throw null; } set { } } public System.TimeSpan InterToneTimeout { get { throw null; } set { } } public int MaxTonesToCollect { get { throw null; } } - public System.Collections.Generic.IReadOnlyList StopTones { get { throw null; } set { } } + public System.Collections.Generic.IList StopTones { get { throw null; } set { } } } public partial class CallParticipant { @@ -409,7 +400,7 @@ public partial class ChannelAffinity { public ChannelAffinity(Azure.Communication.CommunicationIdentifier participant) { } public int? Channel { get { throw null; } set { } } - public Azure.Communication.CommunicationIdentifier Participant { get { throw null; } set { } } + public Azure.Communication.CommunicationIdentifier Participant { get { throw null; } } } public partial class ChoiceResult : Azure.Communication.CallAutomation.RecognizeResult { @@ -444,7 +435,7 @@ public static partial class CommunicationCallAutomationModelFactory public static Azure.Communication.CallAutomation.ContinuousDtmfRecognitionToneReceived ContinuousDtmfRecognitionToneReceived(Azure.Communication.CallAutomation.ToneInfo toneInfo = null, 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.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.MuteParticipantsResponse MuteParticipantsResponse(string operationContext = null) { throw null; } + public static Azure.Communication.CallAutomation.MuteParticipantsResult MuteParticipantsResult(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.PlayCompleted PlayCompleted(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null) { throw null; } @@ -463,7 +454,7 @@ public static partial class CommunicationCallAutomationModelFactory public static Azure.Communication.CallAutomation.SpeechResult SpeechResult(string speech = null) { throw null; } public static Azure.Communication.CallAutomation.ToneInfo ToneInfo(int sequenceId = 0, Azure.Communication.CallAutomation.DtmfTone tone = default(Azure.Communication.CallAutomation.DtmfTone)) { throw null; } public static Azure.Communication.CallAutomation.TransferCallToParticipantResult TransferCallToParticipantResult(string operationContext = null) { throw null; } - public static Azure.Communication.CallAutomation.UnmuteParticipantsResponse UnmuteParticipantsResponse(string operationContext = null) { throw null; } + public static Azure.Communication.CallAutomation.UnmuteParticipantsResult UnmuteParticipantsResult(string operationContext = null) { throw null; } public static Azure.Communication.CallAutomation.UserConsent UserConsent(int? recording = default(int?)) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] @@ -508,7 +499,7 @@ internal CreateCallEventResult() { } public partial class CreateCallOptions { public CreateCallOptions(Azure.Communication.CallAutomation.CallInvite callInvite, System.Uri callbackUri) { } - public System.Uri AzureCognitiveServicesEndpointUrl { get { throw null; } set { } } + public System.Uri AzureCognitiveServicesEndpointUri { get { throw null; } set { } } public System.Uri CallbackUri { get { throw null; } } public Azure.Communication.CallAutomation.CallInvite CallInvite { get { throw null; } } public Azure.Communication.CallAutomation.MediaStreamingOptions MediaStreamingOptions { get { throw null; } set { } } @@ -525,7 +516,7 @@ internal CreateCallResult() { } public partial class CreateGroupCallOptions { public CreateGroupCallOptions(System.Collections.Generic.IEnumerable targets, System.Uri callbackUri) { } - public System.Uri AzureCognitiveServicesEndpointUrl { get { throw null; } set { } } + public System.Uri AzureCognitiveServicesEndpointUri { get { throw null; } set { } } public System.Uri CallbackUri { get { throw null; } } public Azure.Communication.CallAutomation.CustomContext CustomContext { get { throw null; } } public Azure.Communication.CallAutomation.MediaStreamingOptions MediaStreamingOptions { get { throw null; } set { } } @@ -861,9 +852,9 @@ public MuteParticipantsOptions(System.Collections.Generic.IEnumerable TargetParticipants { get { throw null; } } } - public partial class MuteParticipantsResponse + public partial class MuteParticipantsResult { - internal MuteParticipantsResponse() { } + internal MuteParticipantsResult() { } public string OperationContext { get { throw null; } } } public partial class ParticipantsUpdated : Azure.Communication.CallAutomation.CallAutomationEventBase @@ -914,7 +905,7 @@ internal PlayResult() { } public abstract partial class PlaySource { protected PlaySource() { } - public string PlaySourceId { get { throw null; } set { } } + public string PlaySourceCacheId { get { throw null; } set { } } } public partial class PlayToAllOptions { @@ -1284,9 +1275,9 @@ public UnmuteParticipantsOptions(System.Collections.Generic.IEnumerable TargetParticipants { get { throw null; } } } - public partial class UnmuteParticipantsResponse + public partial class UnmuteParticipantsResult { - internal UnmuteParticipantsResponse() { } + internal UnmuteParticipantsResult() { } public string OperationContext { get { throw null; } } } public partial class UserConsent diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/CallAutomationClient.cs b/sdk/communication/Azure.Communication.CallAutomation/src/CallAutomationClient.cs index dea466eb51bf..462fcb686462 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/CallAutomationClient.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/CallAutomationClient.cs @@ -28,7 +28,13 @@ public class CallAutomationClient internal CallRecordingRestClient CallRecordingRestClient { get; } internal CallDialogRestClient CallDialogRestClient { get; } internal CallAutomationEventProcessor EventProcessor { get; } - internal CommunicationUserIdentifier Source { get; } + + /// + /// CommunicationUserIdentifier that makes the outbound call. + /// This can be provided by providing CallAutomationClientOption during construction of CallAutomationClient. + /// If left blank, service will create one each request. + /// + public CommunicationUserIdentifier Source { get; } #region public constructors /// Initializes a new instance of . @@ -233,21 +239,11 @@ public virtual Response AnswerCall(AnswerCallOptions options, private AnswerCallRequestInternal CreateAnswerCallRequest(AnswerCallOptions options) { - // validate callbackUri - if (!IsValidHttpsUri(options.CallbackUri)) - { - throw new ArgumentException(CallAutomationErrorMessages.InvalidHttpsUriMessage); - } - AnswerCallRequestInternal request = new AnswerCallRequestInternal(options.IncomingCallContext, options.CallbackUri.AbsoluteUri); // Add custom cognitive service domain name - if (options.AzureCognitiveServicesEndpointUrl != null) + if (options.AzureCognitiveServicesEndpointUri != null) { - if (!IsValidHttpsUri(options.AzureCognitiveServicesEndpointUrl)) - { - throw new ArgumentException(CallAutomationErrorMessages.InvalidCognitiveServiceHttpsUriMessage); - } - request.AzureCognitiveServicesEndpointUrl = options.AzureCognitiveServicesEndpointUrl.AbsoluteUri; + request.AzureCognitiveServicesEndpointUrl = options.AzureCognitiveServicesEndpointUri.AbsoluteUri; } request.MediaStreamingConfiguration = CreateMediaStreamingOptionsInternal(options.MediaStreamingOptions); request.AnsweredByIdentifier = Source == null ? null : new CommunicationUserIdentifierModel(Source.Id); @@ -622,13 +618,9 @@ private CreateCallRequestInternal CreateCallRequest(CreateCallOptions options) options.CallInvite.CustomContext.VoipHeaders == null ? new ChangeTrackingDictionary() : options.CallInvite.CustomContext.VoipHeaders); // Add custom cognitive service domain name - if (options.AzureCognitiveServicesEndpointUrl != null) + if (options.AzureCognitiveServicesEndpointUri != null) { - if (!IsValidHttpsUri(options.AzureCognitiveServicesEndpointUrl)) - { - throw new ArgumentException(CallAutomationErrorMessages.InvalidCognitiveServiceHttpsUriMessage); - } - request.AzureCognitiveServicesEndpointUrl = options.AzureCognitiveServicesEndpointUrl.AbsoluteUri; + request.AzureCognitiveServicesEndpointUrl = options.AzureCognitiveServicesEndpointUri.AbsoluteUri; } request.OperationContext = options.OperationContext; request.MediaStreamingConfiguration = CreateMediaStreamingOptionsInternal(options.MediaStreamingOptions); @@ -654,13 +646,9 @@ private CreateCallRequestInternal CreateCallRequest(CreateGroupCallOptions optio options.CustomContext.VoipHeaders == null ? new ChangeTrackingDictionary() : options.CustomContext.VoipHeaders); // Add custom cognitive service domain name - if (options.AzureCognitiveServicesEndpointUrl != null) + if (options.AzureCognitiveServicesEndpointUri != null) { - if (!IsValidHttpsUri(options.AzureCognitiveServicesEndpointUrl)) - { - throw new ArgumentException(CallAutomationErrorMessages.InvalidCognitiveServiceHttpsUriMessage); - } - request.AzureCognitiveServicesEndpointUrl = options.AzureCognitiveServicesEndpointUrl.AbsoluteUri; + request.AzureCognitiveServicesEndpointUrl = options.AzureCognitiveServicesEndpointUri.AbsoluteUri; } request.OperationContext = options.OperationContext; request.MediaStreamingConfiguration = CreateMediaStreamingOptionsInternal(options.MediaStreamingOptions); @@ -736,24 +724,5 @@ public virtual CallAutomationEventProcessor GetEventProcessor() throw; } } - - /// - /// Get source identity used by Call Automation client. - /// - /// - public virtual CommunicationUserIdentifier GetSourceIdentity() - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallAutomationClient)}.{nameof(GetSourceIdentity)}"); - scope.Start(); - try - { - return Source; - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/CallConnection.cs b/sdk/communication/Azure.Communication.CallAutomation/src/CallConnection.cs index 4f2fb9366fce..cbc2e5e28caf 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/CallConnection.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/CallConnection.cs @@ -282,14 +282,7 @@ private static TransferToParticipantRequestInternal CreateTransferToParticipantR options.CustomContext.SipHeaders == null ? new ChangeTrackingDictionary() : options.CustomContext.SipHeaders, options.CustomContext.VoipHeaders == null ? new ChangeTrackingDictionary() : options.CustomContext.VoipHeaders); - if (options.OperationContext != null && options.OperationContext.Length > CallAutomationConstants.InputValidation.StringMaxLength) - { - throw new ArgumentException(CallAutomationErrorMessages.OperationContextExceedsMaxLength); - } - else - { - request.OperationContext = options.OperationContext == default ? Guid.NewGuid().ToString() : options.OperationContext; - } + request.OperationContext = options.OperationContext == default ? Guid.NewGuid().ToString() : options.OperationContext; if (options.Transferee != null) { @@ -398,17 +391,9 @@ private static AddParticipantRequestInternal CreateAddParticipantRequest(AddPart OperationContext = options.OperationContext == default ? Guid.NewGuid().ToString() : options.OperationContext }; - if (options.InvitationTimeoutInSeconds != null && - (options.InvitationTimeoutInSeconds < CallAutomationConstants.InputValidation.MinInvitationTimeoutInSeconds || - options.InvitationTimeoutInSeconds > CallAutomationConstants.InputValidation.MaxInvitationTimeoutInSeconds)) - { - throw new ArgumentException(CallAutomationErrorMessages.InvalidInvitationTimeoutInSeconds); - } - else - { - request.InvitationTimeoutInSeconds = options.InvitationTimeoutInSeconds; - } + request.InvitationTimeoutInSeconds = options.InvitationTimeoutInSeconds; request.CallbackUriOverride = options.CallbackUriOverride; + request.CustomContext = new CustomContextInternal( options.ParticipantToAdd.CustomContext.SipHeaders == null ? new ChangeTrackingDictionary() : options.ParticipantToAdd.CustomContext.SipHeaders, options.ParticipantToAdd.CustomContext.VoipHeaders == null ? new ChangeTrackingDictionary() : options.ParticipantToAdd.CustomContext.VoipHeaders); @@ -556,14 +541,9 @@ public virtual async Task> RemoveParticipantAs Argument.AssertNotNull(options.ParticipantToRemove, nameof(options.ParticipantToRemove)); RemoveParticipantRequestInternal request = new(CommunicationIdentifierSerializer.Serialize(options.ParticipantToRemove)); - if (options.OperationContext != null && options.OperationContext.Length > CallAutomationConstants.InputValidation.StringMaxLength) - { - throw new ArgumentException(CallAutomationErrorMessages.OperationContextExceedsMaxLength); - } - else - { - request.OperationContext = options.OperationContext == default ? Guid.NewGuid().ToString() : options.OperationContext; - } + + request.OperationContext = options.OperationContext == default ? Guid.NewGuid().ToString() : options.OperationContext; + request.CallbackUriOverride = options.CallbackUriOverride; var response = await RestClient.RemoveParticipantAsync(CallConnectionId, request, cancellationToken).ConfigureAwait(false); @@ -611,14 +591,8 @@ public virtual Response RemoveParticipant(RemovePartici RemoveParticipantRequestInternal request = new(CommunicationIdentifierSerializer.Serialize(options.ParticipantToRemove)); - if (options.OperationContext != null && options.OperationContext.Length > CallAutomationConstants.InputValidation.StringMaxLength) - { - throw new ArgumentException(CallAutomationErrorMessages.OperationContextExceedsMaxLength); - } - else - { - options.OperationContext = options.OperationContext == default ? Guid.NewGuid().ToString() : options.OperationContext; - } + options.OperationContext = options.OperationContext == default ? Guid.NewGuid().ToString() : options.OperationContext; + request.CallbackUriOverride = options.CallbackUriOverride; var response = RestClient.RemoveParticipant(CallConnectionId, request, cancellationToken); @@ -675,8 +649,8 @@ public virtual CallDialog GetCallDialog() /// The cancellation token. /// The server returned an error. See for details returned from the server. /// is null. - /// A Response containing MuteParticipantsResponse. - public virtual Response MuteParticipants(CommunicationIdentifier targetParticipant, string operationContext = default, CancellationToken cancellationToken = default) + /// A Response containing MuteParticipantsResult. + public virtual Response MuteParticipants(CommunicationIdentifier targetParticipant, string operationContext = default, CancellationToken cancellationToken = default) { var options = new MuteParticipantsOptions(new List { targetParticipant }) { @@ -694,8 +668,8 @@ public virtual Response MuteParticipants(Communication /// The cancellation token. /// The server returned an error. See for details returned from the server. /// is null. - /// A Response containing MuteParticipantsResponse. - public virtual Response MuteParticipants(MuteParticipantsOptions options, CancellationToken cancellationToken = default) + /// A Response containing MuteParticipantsResult. + public virtual Response MuteParticipants(MuteParticipantsOptions options, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallConnection)}.{nameof(MuteParticipants)}"); scope.Start(); @@ -707,14 +681,7 @@ public virtual Response MuteParticipants(MuteParticipa MuteParticipantsRequestInternal request = new MuteParticipantsRequestInternal( options.TargetParticipants.Select(participant => CommunicationIdentifierSerializer.Serialize(participant))); - if (options.OperationContext != null && options.OperationContext.Length > CallAutomationConstants.InputValidation.StringMaxLength) - { - throw new ArgumentException(CallAutomationErrorMessages.OperationContextExceedsMaxLength); - } - else - { - request.OperationContext = options.OperationContext; - } + request.OperationContext = options.OperationContext; return RestClient.Mute(CallConnectionId, request, cancellationToken); } @@ -735,7 +702,7 @@ public virtual Response MuteParticipants(MuteParticipa /// is null. /// The server returned an error. See for details returned from the server. /// - public virtual Response UnmuteParticipants(CommunicationIdentifier targetParticipant, string operationContext = default, CancellationToken cancellationToken = default) + public virtual Response UnmuteParticipants(CommunicationIdentifier targetParticipant, string operationContext = default, CancellationToken cancellationToken = default) { var options = new UnmuteParticipantsOptions(new List { targetParticipant }) { @@ -754,7 +721,7 @@ public virtual Response UnmuteParticipants(Communica /// OperationContext is too long. /// The server returned an error. See for details returned from the server. /// - public virtual Response UnmuteParticipants(UnmuteParticipantsOptions options, CancellationToken cancellationToken = default) + public virtual Response UnmuteParticipants(UnmuteParticipantsOptions options, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallConnection)}.{nameof(UnmuteParticipants)}"); scope.Start(); @@ -762,14 +729,8 @@ public virtual Response UnmuteParticipants(UnmutePar { UnmuteParticipantsRequestInternal request = new UnmuteParticipantsRequestInternal( options.TargetParticipants.Select(participant => CommunicationIdentifierSerializer.Serialize(participant)).ToList()); - if (options.OperationContext != null && options.OperationContext.Length > CallAutomationConstants.InputValidation.StringMaxLength) - { - throw new ArgumentException(CallAutomationErrorMessages.OperationContextExceedsMaxLength); - } - else - { - request.OperationContext = options.OperationContext; - } + + request.OperationContext = options.OperationContext; return RestClient.Unmute(CallConnectionId, request, cancellationToken); } @@ -790,7 +751,7 @@ public virtual Response UnmuteParticipants(UnmutePar /// is null. /// The server returned an error. See for details returned from the server. /// - public async virtual Task> MuteParticipantsAsync(CommunicationIdentifier targetParticipant, string operationContext = default, CancellationToken cancellationToken = default) + public async virtual Task> MuteParticipantsAsync(CommunicationIdentifier targetParticipant, string operationContext = default, CancellationToken cancellationToken = default) { var options = new MuteParticipantsOptions(new List { targetParticipant }) { @@ -808,7 +769,7 @@ public async virtual Task> MuteParticipantsAs /// OperationContext is too long. /// The server returned an error. See for details returned from the server. /// - public async virtual Task> MuteParticipantsAsync(MuteParticipantsOptions options, CancellationToken cancellationToken = default) + public async virtual Task> MuteParticipantsAsync(MuteParticipantsOptions options, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallConnection)}.{nameof(MuteParticipants)}"); scope.Start(); @@ -820,14 +781,7 @@ public async virtual Task> MuteParticipantsAs MuteParticipantsRequestInternal request = new MuteParticipantsRequestInternal( options.TargetParticipants.Select(participant => CommunicationIdentifierSerializer.Serialize(participant))); - if (options.OperationContext != null && options.OperationContext.Length > CallAutomationConstants.InputValidation.StringMaxLength) - { - throw new ArgumentException(CallAutomationErrorMessages.OperationContextExceedsMaxLength); - } - else - { - request.OperationContext = options.OperationContext; - } + request.OperationContext = options.OperationContext; return await RestClient.MuteAsync(CallConnectionId, request, cancellationToken).ConfigureAwait(false); } @@ -847,7 +801,7 @@ public async virtual Task> MuteParticipantsAs /// The cancellation token. /// The server returned an error. See for details returned from the server. /// - public async virtual Task> UnmuteParticipantsAsync(CommunicationIdentifier targetParticipant, string operationContext = default, CancellationToken cancellationToken = default) + public async virtual Task> UnmuteParticipantsAsync(CommunicationIdentifier targetParticipant, string operationContext = default, CancellationToken cancellationToken = default) { var options = new UnmuteParticipantsOptions(new List { targetParticipant }) { @@ -867,7 +821,7 @@ public async virtual Task> UnmuteParticipan /// OperationContext is too long. /// The server returned an error. See for details returned from the server. /// - public async virtual Task> UnmuteParticipantsAsync(UnmuteParticipantsOptions options, CancellationToken cancellationToken = default) + public async virtual Task> UnmuteParticipantsAsync(UnmuteParticipantsOptions options, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallConnection)}.{nameof(UnmuteParticipants)}"); scope.Start(); @@ -875,14 +829,8 @@ public async virtual Task> UnmuteParticipan { UnmuteParticipantsRequestInternal request = new UnmuteParticipantsRequestInternal( options.TargetParticipants.Select(participant => CommunicationIdentifierSerializer.Serialize(participant)).ToList()); - if (options.OperationContext != null && options.OperationContext.Length > CallAutomationConstants.InputValidation.StringMaxLength) - { - throw new ArgumentException(CallAutomationErrorMessages.OperationContextExceedsMaxLength); - } - else - { - request.OperationContext = options.OperationContext; - } + + request.OperationContext = options.OperationContext; return await RestClient.UnmuteAsync(CallConnectionId, request, cancellationToken).ConfigureAwait(false); } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/CallMedia.cs b/sdk/communication/Azure.Communication.CallAutomation/src/CallMedia.cs index bfb0fedccfef..fcd7836cc362 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/CallMedia.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/CallMedia.cs @@ -450,7 +450,7 @@ private static RecognizeRequestInternal CreateRecognizeRequest(CallMediaRecogniz { SpeechOptionsInternal speechConfigurations = new SpeechOptionsInternal() { - EndSilenceTimeoutInMs = (long)recognizeSpeechOptions.EndSilenceTimeoutInMs.TotalMilliseconds + EndSilenceTimeoutInMs = (long)recognizeSpeechOptions.EndSilenceTimeout.TotalMilliseconds }; RecognizeOptionsInternal recognizeConfigurationsInternal = new RecognizeOptionsInternal(CommunicationIdentifierSerializer.Serialize(recognizeSpeechOptions.TargetParticipant)) @@ -482,14 +482,14 @@ private static RecognizeRequestInternal CreateRecognizeRequest(CallMediaRecogniz { SpeechOptionsInternal speechConfigurations = new SpeechOptionsInternal() { - EndSilenceTimeoutInMs = (long)recognizeSpeechOrDtmfOptions.EndSilenceTimeoutInMs.TotalMilliseconds + EndSilenceTimeoutInMs = (long)recognizeSpeechOrDtmfOptions.EndSilenceTimeout.TotalMilliseconds }; DtmfOptionsInternal dtmfConfigurations = new DtmfOptionsInternal() { InterToneTimeoutInSeconds = (int)recognizeSpeechOrDtmfOptions.InterToneTimeout.TotalSeconds, MaxTonesToCollect = recognizeSpeechOrDtmfOptions.MaxTonesToCollect, - StopTones = recognizeSpeechOrDtmfOptions.StopTones + StopTones = recognizeSpeechOrDtmfOptions.StopTones.ToList() }; RecognizeOptionsInternal recognizeConfigurationsInternal = new RecognizeOptionsInternal(CommunicationIdentifierSerializer.Serialize(recognizeSpeechOrDtmfOptions.TargetParticipant)) @@ -532,7 +532,7 @@ private static PlaySourceInternal TranslatePlaySourceToInternal(PlaySource playS { sourceInternal = new PlaySourceInternal(PlaySourceTypeInternal.File); sourceInternal.FileSource = new FileSourceInternal(fileSource.FileUri.AbsoluteUri); - sourceInternal.PlaySourceId = fileSource.PlaySourceId; + sourceInternal.PlaySourceId = fileSource.PlaySourceCacheId; return sourceInternal; } else if (playSource != null && playSource is TextSource textSource) @@ -543,7 +543,7 @@ private static PlaySourceInternal TranslatePlaySourceToInternal(PlaySource playS sourceInternal.TextSource.VoiceGender = textSource.VoiceGender ?? GenderType.Male; sourceInternal.TextSource.VoiceName = textSource.VoiceName ?? null; sourceInternal.TextSource.CustomVoiceEndpointId = textSource.CustomVoiceEndpointId ?? null; - sourceInternal.PlaySourceId = textSource.PlaySourceId; + sourceInternal.PlaySourceId = textSource.PlaySourceCacheId; return sourceInternal; } else if (playSource != null && playSource is SsmlSource ssmlSource) @@ -551,7 +551,7 @@ private static PlaySourceInternal TranslatePlaySourceToInternal(PlaySource playS sourceInternal = new PlaySourceInternal(PlaySourceTypeInternal.Ssml); sourceInternal.SsmlSource = new SsmlSourceInternal(ssmlSource.SsmlText); sourceInternal.SsmlSource.CustomVoiceEndpointId = ssmlSource.CustomVoiceEndpointId ?? null; - sourceInternal.PlaySourceId = ssmlSource.PlaySourceId; + sourceInternal.PlaySourceId = ssmlSource.PlaySourceCacheId; return sourceInternal; } else diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallConnectionRestClient.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallConnectionRestClient.cs index d6ada15ed0c3..e6a809669073 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallConnectionRestClient.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallConnectionRestClient.cs @@ -583,7 +583,7 @@ internal HttpMessage CreateMuteRequest(string callConnectionId, MuteParticipants /// The participants to be muted from the call. /// The cancellation token to use. /// or is null. - public async Task> MuteAsync(string callConnectionId, MuteParticipantsRequestInternal muteParticipantsRequest, CancellationToken cancellationToken = default) + public async Task> MuteAsync(string callConnectionId, MuteParticipantsRequestInternal muteParticipantsRequest, CancellationToken cancellationToken = default) { if (callConnectionId == null) { @@ -600,9 +600,9 @@ public async Task> MuteAsync(string callConne { case 202: { - MuteParticipantsResponse value = default; + MuteParticipantsResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = MuteParticipantsResponse.DeserializeMuteParticipantsResponse(document.RootElement); + value = MuteParticipantsResult.DeserializeMuteParticipantsResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -615,7 +615,7 @@ public async Task> MuteAsync(string callConne /// The participants to be muted from the call. /// The cancellation token to use. /// or is null. - public Response Mute(string callConnectionId, MuteParticipantsRequestInternal muteParticipantsRequest, CancellationToken cancellationToken = default) + public Response Mute(string callConnectionId, MuteParticipantsRequestInternal muteParticipantsRequest, CancellationToken cancellationToken = default) { if (callConnectionId == null) { @@ -632,9 +632,9 @@ public Response Mute(string callConnectionId, MutePart { case 202: { - MuteParticipantsResponse value = default; + MuteParticipantsResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = MuteParticipantsResponse.DeserializeMuteParticipantsResponse(document.RootElement); + value = MuteParticipantsResult.DeserializeMuteParticipantsResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -669,7 +669,7 @@ internal HttpMessage CreateUnmuteRequest(string callConnectionId, UnmuteParticip /// The participants to be unmuted from the call. /// The cancellation token to use. /// or is null. - public async Task> UnmuteAsync(string callConnectionId, UnmuteParticipantsRequestInternal unmuteParticipantsRequest, CancellationToken cancellationToken = default) + public async Task> UnmuteAsync(string callConnectionId, UnmuteParticipantsRequestInternal unmuteParticipantsRequest, CancellationToken cancellationToken = default) { if (callConnectionId == null) { @@ -686,9 +686,9 @@ public async Task> UnmuteAsync(string callC { case 202: { - UnmuteParticipantsResponse value = default; + UnmuteParticipantsResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = UnmuteParticipantsResponse.DeserializeUnmuteParticipantsResponse(document.RootElement); + value = UnmuteParticipantsResult.DeserializeUnmuteParticipantsResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -701,7 +701,7 @@ public async Task> UnmuteAsync(string callC /// The participants to be unmuted from the call. /// The cancellation token to use. /// or is null. - public Response Unmute(string callConnectionId, UnmuteParticipantsRequestInternal unmuteParticipantsRequest, CancellationToken cancellationToken = default) + public Response Unmute(string callConnectionId, UnmuteParticipantsRequestInternal unmuteParticipantsRequest, CancellationToken cancellationToken = default) { if (callConnectionId == null) { @@ -718,9 +718,9 @@ public Response Unmute(string callConnectionId, Unmu { case 202: { - UnmuteParticipantsResponse value = default; + UnmuteParticipantsResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = UnmuteParticipantsResponse.DeserializeUnmuteParticipantsResponse(document.RootElement); + value = UnmuteParticipantsResult.DeserializeUnmuteParticipantsResult(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CommunicationCallAutomationModelFactory.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CommunicationCallAutomationModelFactory.cs index 505d4b3daa48..8fb755f5d335 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CommunicationCallAutomationModelFactory.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CommunicationCallAutomationModelFactory.cs @@ -22,20 +22,20 @@ public static TransferCallToParticipantResult TransferCallToParticipantResult(st return new TransferCallToParticipantResult(operationContext); } - /// Initializes a new instance of MuteParticipantsResponse. + /// Initializes a new instance of MuteParticipantsResult. /// The operation context provided by client. - /// A new instance for mocking. - public static MuteParticipantsResponse MuteParticipantsResponse(string operationContext = null) + /// A new instance for mocking. + public static MuteParticipantsResult MuteParticipantsResult(string operationContext = null) { - return new MuteParticipantsResponse(operationContext); + return new MuteParticipantsResult(operationContext); } - /// Initializes a new instance of UnmuteParticipantsResponse. + /// Initializes a new instance of UnmuteParticipantsResult. /// The operation context provided by client. - /// A new instance for mocking. - public static UnmuteParticipantsResponse UnmuteParticipantsResponse(string operationContext = null) + /// A new instance for mocking. + public static UnmuteParticipantsResult UnmuteParticipantsResult(string operationContext = null) { - return new UnmuteParticipantsResponse(operationContext); + return new UnmuteParticipantsResult(operationContext); } /// Initializes a new instance of RecordingStateResult. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UnmuteParticipantsResponse.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MuteParticipantsResult.Serialization.cs similarity index 75% rename from sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UnmuteParticipantsResponse.Serialization.cs rename to sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MuteParticipantsResult.Serialization.cs index 7bea3b7ea9a3..617bafaa5485 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UnmuteParticipantsResponse.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MuteParticipantsResult.Serialization.cs @@ -10,9 +10,9 @@ namespace Azure.Communication.CallAutomation { - public partial class UnmuteParticipantsResponse + public partial class MuteParticipantsResult { - internal static UnmuteParticipantsResponse DeserializeUnmuteParticipantsResponse(JsonElement element) + internal static MuteParticipantsResult DeserializeMuteParticipantsResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { @@ -27,7 +27,7 @@ internal static UnmuteParticipantsResponse DeserializeUnmuteParticipantsResponse continue; } } - return new UnmuteParticipantsResponse(operationContext.Value); + return new MuteParticipantsResult(operationContext.Value); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MuteParticipantsResponse.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MuteParticipantsResult.cs similarity index 77% rename from sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MuteParticipantsResponse.cs rename to sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MuteParticipantsResult.cs index 95cc4442be96..aca681bb6414 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MuteParticipantsResponse.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MuteParticipantsResult.cs @@ -8,16 +8,16 @@ namespace Azure.Communication.CallAutomation { /// The response payload for muting participants from the call. - public partial class MuteParticipantsResponse + public partial class MuteParticipantsResult { - /// Initializes a new instance of MuteParticipantsResponse. - internal MuteParticipantsResponse() + /// Initializes a new instance of MuteParticipantsResult. + internal MuteParticipantsResult() { } - /// Initializes a new instance of MuteParticipantsResponse. + /// Initializes a new instance of MuteParticipantsResult. /// The operation context provided by client. - internal MuteParticipantsResponse(string operationContext) + internal MuteParticipantsResult(string operationContext) { OperationContext = operationContext; } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MuteParticipantsResponse.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UnmuteParticipantsResult.Serialization.cs similarity index 76% rename from sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MuteParticipantsResponse.Serialization.cs rename to sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UnmuteParticipantsResult.Serialization.cs index b53fd6feac1e..a23c2a91a993 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/MuteParticipantsResponse.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UnmuteParticipantsResult.Serialization.cs @@ -10,9 +10,9 @@ namespace Azure.Communication.CallAutomation { - public partial class MuteParticipantsResponse + public partial class UnmuteParticipantsResult { - internal static MuteParticipantsResponse DeserializeMuteParticipantsResponse(JsonElement element) + internal static UnmuteParticipantsResult DeserializeUnmuteParticipantsResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { @@ -27,7 +27,7 @@ internal static MuteParticipantsResponse DeserializeMuteParticipantsResponse(Jso continue; } } - return new MuteParticipantsResponse(operationContext.Value); + return new UnmuteParticipantsResult(operationContext.Value); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UnmuteParticipantsResponse.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UnmuteParticipantsResult.cs similarity index 76% rename from sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UnmuteParticipantsResponse.cs rename to sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UnmuteParticipantsResult.cs index eabe487866e4..80dc112b86e3 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UnmuteParticipantsResponse.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/UnmuteParticipantsResult.cs @@ -8,16 +8,16 @@ namespace Azure.Communication.CallAutomation { /// The response payload for unmuting participants from the call. - public partial class UnmuteParticipantsResponse + public partial class UnmuteParticipantsResult { - /// Initializes a new instance of UnmuteParticipantsResponse. - internal UnmuteParticipantsResponse() + /// Initializes a new instance of UnmuteParticipantsResult. + internal UnmuteParticipantsResult() { } - /// Initializes a new instance of UnmuteParticipantsResponse. + /// Initializes a new instance of UnmuteParticipantsResult. /// The operation context provided by client. - internal UnmuteParticipantsResponse(string operationContext) + internal UnmuteParticipantsResult(string operationContext) { OperationContext = operationContext; } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/AddParticipantOptions.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/AddParticipantOptions.cs index aec519b0fe7e..2454be79bb75 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/AddParticipantOptions.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/AddParticipantOptions.cs @@ -20,7 +20,6 @@ public AddParticipantOptions(CallInvite participantToAdd) /// /// Participant to add to the call. /// - /// public CallInvite ParticipantToAdd { get; } /// diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/AnswerCallOptions.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/AnswerCallOptions.cs index 22c18737a799..9b52e394413a 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/AnswerCallOptions.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/AnswerCallOptions.cs @@ -37,14 +37,14 @@ public AnswerCallOptions(string incomingCallContext, Uri callbackUri) public MediaStreamingOptions MediaStreamingOptions { get; set; } /// - /// The endpoint URL of the Azure Cognitive Services resource attached + /// The endpoint uri of the Azure Cognitive Services resource attached /// - public Uri AzureCognitiveServicesEndpointUrl { get; set; } + public Uri AzureCognitiveServicesEndpointUri { get; set; } /// /// The identifier of the call automation entity which answers the call. /// - public CommunicationUserIdentifier AnsweredByIdentifier { get; set; } + public CommunicationUserIdentifier AnsweredBy { get; set; } /// /// The operation context. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallConnectionProperties.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallConnectionProperties.cs index 547b29952c51..1c125a42848c 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallConnectionProperties.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallConnectionProperties.cs @@ -27,7 +27,7 @@ string mediaSubscriptionId Targets = targets == null ? new List() : targets.ToList(); CallConnectionState = callConnectionState == default ? CallConnectionState.Unknown : callConnectionState; CallbackUri = callbackUri; - SourceIdentity = sourceIdentity; + Source = sourceIdentity; SourceCallerIdNumber = sourceCallerIdNumber; SourceDisplayName = sourceDisplayName; MediaSubscriptionId = mediaSubscriptionId; @@ -50,10 +50,10 @@ internal CallConnectionProperties(CallConnectionPropertiesInternal callConnectio CallbackUri = new Uri(callConnectionPropertiesDtoInternal.CallbackUri); MediaSubscriptionId = callConnectionPropertiesDtoInternal.MediaSubscriptionId; - SourceIdentity = callConnectionPropertiesDtoInternal.SourceIdentity == null? null : CommunicationIdentifierSerializer.Deserialize(callConnectionPropertiesDtoInternal.SourceIdentity); + Source = callConnectionPropertiesDtoInternal.SourceIdentity == null? null : CommunicationIdentifierSerializer.Deserialize(callConnectionPropertiesDtoInternal.SourceIdentity); SourceDisplayName = callConnectionPropertiesDtoInternal.SourceDisplayName; CorrelationId = callConnectionPropertiesDtoInternal.CorrelationId; - AnsweredByIdentifier = callConnectionPropertiesDtoInternal.AnsweredByIdentifier == null? null : new CommunicationUserIdentifier(callConnectionPropertiesDtoInternal.AnsweredByIdentifier.Id); + AnsweredBy = callConnectionPropertiesDtoInternal.AnsweredByIdentifier == null? null : new CommunicationUserIdentifier(callConnectionPropertiesDtoInternal.AnsweredByIdentifier.Id); if (callConnectionPropertiesDtoInternal.SourceCallerIdNumber != null) { @@ -84,7 +84,7 @@ internal CallConnectionProperties(CallConnectionPropertiesInternal callConnectio /// /// Source identity. /// - public CommunicationIdentifier SourceIdentity { get; } + public CommunicationIdentifier Source { get; } /// /// The correlation ID. @@ -94,6 +94,6 @@ internal CallConnectionProperties(CallConnectionPropertiesInternal callConnectio /// /// Identity of the answering entity. Only populated when identity is provided in the request. /// - public CommunicationUserIdentifier AnsweredByIdentifier { get; } + public CommunicationUserIdentifier AnsweredBy { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallMediaRecognizeChoiceOptions.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallMediaRecognizeChoiceOptions.cs index 6334facc2014..253f019f0b26 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallMediaRecognizeChoiceOptions.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallMediaRecognizeChoiceOptions.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.Communication.CallAutomation { @@ -12,14 +13,14 @@ namespace Azure.Communication.CallAutomation public class CallMediaRecognizeChoiceOptions : CallMediaRecognizeOptions { /// Initializes a new instance of CallMediaRecognizeChoiceOptions. - public CallMediaRecognizeChoiceOptions(CommunicationIdentifier targetParticipant, List recognizeChoices) : base(RecognizeInputType.Choices, targetParticipant) + public CallMediaRecognizeChoiceOptions(CommunicationIdentifier targetParticipant, IEnumerable recognizeChoices) : base(RecognizeInputType.Choices, targetParticipant) { - RecognizeChoices = recognizeChoices; + RecognizeChoices = recognizeChoices.ToList(); } /// /// The IvR choices for recognize /// - public IList RecognizeChoices { get; } + public IReadOnlyList RecognizeChoices { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallMediaRecognizeSpeechOptions.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallMediaRecognizeSpeechOptions.cs index f2d9909bb1be..4a995ae08379 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallMediaRecognizeSpeechOptions.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallMediaRecognizeSpeechOptions.cs @@ -16,10 +16,10 @@ public class CallMediaRecognizeSpeechOptions : CallMediaRecognizeOptions /// Initializes a new instance of CallMediaRecognizeSpeechOptions. public CallMediaRecognizeSpeechOptions(CommunicationIdentifier targetParticipant) : base(RecognizeInputType.Speech, targetParticipant) { - EndSilenceTimeoutInMs = _defaultEndSilenceTimeoutInMs; + EndSilenceTimeout = _defaultEndSilenceTimeoutInMs; } /// The length of end silence when user stops speaking and cogservice send response. - public TimeSpan EndSilenceTimeoutInMs { get; set; } + public TimeSpan EndSilenceTimeout { get; set; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallMediaRecognizeSpeechOrDtmfOptions.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallMediaRecognizeSpeechOrDtmfOptions.cs index a2eeffd4b4d5..00291c0c82ff 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallMediaRecognizeSpeechOrDtmfOptions.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallMediaRecognizeSpeechOrDtmfOptions.cs @@ -17,13 +17,13 @@ public class CallMediaRecognizeSpeechOrDtmfOptions : CallMediaRecognizeOptions /// Initializes a new instance of CallMediaRecognizeSpeechOrDtmfOptions. public CallMediaRecognizeSpeechOrDtmfOptions(CommunicationIdentifier targetParticipant, int maxTonesToCollect) : base(RecognizeInputType.SpeechOrDtmf, targetParticipant) { - EndSilenceTimeoutInMs = _defaultInterToneTimeout; + EndSilenceTimeout = _defaultInterToneTimeout; MaxTonesToCollect = maxTonesToCollect; StopTones = Array.Empty(); } /// The length of end silence when user stops speaking and cogservice send response. - public TimeSpan EndSilenceTimeoutInMs { get; set; } + public TimeSpan EndSilenceTimeout { get; set; } /// /// Time to wait between DTMF inputs to stop recognizing. @@ -39,6 +39,6 @@ public CallMediaRecognizeSpeechOrDtmfOptions(CommunicationIdentifier targetParti /// /// List of tones that will stop recognizing. /// - public IReadOnlyList StopTones { get; set; } + public IList StopTones { get; set; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/ChannelAffinity.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/ChannelAffinity.cs index 83812c757d6e..bb8e1182e7d8 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/ChannelAffinity.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/ChannelAffinity.cs @@ -26,7 +26,7 @@ public ChannelAffinity(CommunicationIdentifier participant) /// The identifier for the participant whose bitstream will be written to the channel. /// represented by the channel number. /// - public CommunicationIdentifier Participant { get; set; } + public CommunicationIdentifier Participant { get;} /// Channel number to which bitstream from a particular participant will be written. public int? Channel { get; set; } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/CreateCallOptions.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/CreateCallOptions.cs index 1903b7fa737a..228b4545aaaa 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/CreateCallOptions.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/CreateCallOptions.cs @@ -43,6 +43,6 @@ public CreateCallOptions(CallInvite callInvite, Uri callbackUri) /// /// The endpoint URL of the Azure Cognitive Services resource attached /// - public Uri AzureCognitiveServicesEndpointUrl { get; set; } + public Uri AzureCognitiveServicesEndpointUri { get; set; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/CreateGroupCallOptions.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/CreateGroupCallOptions.cs index 4b4ce4d13b0d..e392efff8f49 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/CreateGroupCallOptions.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/CreateGroupCallOptions.cs @@ -55,7 +55,7 @@ public CreateGroupCallOptions(IEnumerable targets, Uri /// /// The endpoint URL of the Azure Cognitive Services resource attached /// - public Uri AzureCognitiveServicesEndpointUrl { get; set; } + public Uri AzureCognitiveServicesEndpointUri { get; set; } /// /// The Custom Context which contains SIP and voip headers. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Misc/CallAutomationConstants.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Misc/CallAutomationConstants.cs deleted file mode 100644 index 45c85f90b329..000000000000 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Misc/CallAutomationConstants.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace Azure.Communication.CallAutomation -{ - internal class CallAutomationConstants - { - public struct InputValidation - { - public const int StringMaxLength = 5000; - public const int MaxInvitationTimeoutInSeconds = 180; - public const int MinInvitationTimeoutInSeconds = 1; - } - } -} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Misc/CallAutomationErrorMessages.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Misc/CallAutomationErrorMessages.cs deleted file mode 100644 index 600fdd6c1b15..000000000000 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Misc/CallAutomationErrorMessages.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace Azure.Communication.CallAutomation -{ - /// - /// Error messages for Call Automation. - /// - public static class CallAutomationErrorMessages - { - /// - /// Invalid RepeatabilityHeaders message. - /// - public const string InvalidRepeatabilityHeadersMessage = "Invalid RepeatabilityHeaders. RepeatabilityHeaders is only valid when RepeatabilityRequestId and RepeatabilityFirstSent are set to non-default value."; - - /// - /// Invalid Callback Https Uri message. - /// - public const string InvalidHttpsUriMessage = "Callback Uri has to be in well-formed, valid https format."; - - /// - /// Invalid Custom Cognitive service Https Uri message. - /// - public const string InvalidCognitiveServiceHttpsUriMessage = "Cognitive Service Uri has to be in well-formed, valid https format."; - - /// - /// Invalid InvitationTimeoutInSeconds message. - /// - public const string InvalidInvitationTimeoutInSeconds = "InvitationTimeoutInSeconds has to be between 1 and 180 seconds."; - - /// - /// UserToUserInformation exceeds max length message. - /// - public const string UserToUserInformationExceedsMaxLength = "UserToUserInformation exceeds maximum string length of 5000."; - - /// - /// OperationContext exceeds max length message. - /// - public const string OperationContextExceedsMaxLength = "OperationContext exceeds maximum string length of 5000."; - } -} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/MuteParticipantsResult.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/MuteParticipantsResult.cs new file mode 100644 index 000000000000..1375c18d924e --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/MuteParticipantsResult.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("MuteParticipantsResponse")] + public partial class MuteParticipantsResult + { + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/PlaySource.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/PlaySource.cs index 7f5674c8b7c3..347561cff3fe 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/PlaySource.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/PlaySource.cs @@ -11,6 +11,6 @@ namespace Azure.Communication.CallAutomation public abstract class PlaySource { /// Defines the identifier to be used for caching related media. - public string PlaySourceId { get; set; } + public string PlaySourceCacheId { get; set; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/UnmuteParticipantsResult.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/UnmuteParticipantsResult.cs new file mode 100644 index 000000000000..95b9159f541b --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/UnmuteParticipantsResult.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("UnmuteParticipantsResponse")] + public partial class UnmuteParticipantsResult + { + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/tests/CallAutomationClients/CallAutomationClientTests.cs b/sdk/communication/Azure.Communication.CallAutomation/tests/CallAutomationClients/CallAutomationClientTests.cs index c31cfb446380..79eecb444b28 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/tests/CallAutomationClients/CallAutomationClientTests.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/tests/CallAutomationClients/CallAutomationClientTests.cs @@ -79,34 +79,6 @@ public void AnswerCallWithOptions_200OK(string incomingCallContext, Uri callback Assert.AreEqual("mediaSubscriptionId", response.Value.CallConnectionProperties.MediaSubscriptionId); } - [TestCaseSource(nameof(TestData_AnswerCall_NoCallbackUri))] - public void AnswerCallWithOptions_NullCallbackUri(string incomingCallContext) - { - CallAutomationClient callAutomationClient = CreateMockCallAutomationClient(200, CreateOrAnswerCallOrGetCallConnectionWithMediaSubscriptionPayload); - AnswerCallOptions options = new AnswerCallOptions(incomingCallContext: incomingCallContext, callbackUri: null) - { - MediaStreamingOptions = _mediaStreamingConfiguration - }; - - ArgumentException? ex = Assert.ThrowsAsync(async () => await callAutomationClient.AnswerCallAsync(options).ConfigureAwait(false)); - Assert.NotNull(ex); - Assert.True(ex?.Message.Contains(CallAutomationErrorMessages.InvalidHttpsUriMessage)); - } - - [TestCaseSource(nameof(TestData_AnswerCall_NoCallbackUri))] - public void AnswerCallWithOptions_HttpCallbackUri(string incomingCallContext) - { - CallAutomationClient callAutomationClient = CreateMockCallAutomationClient(200, CreateOrAnswerCallOrGetCallConnectionWithMediaSubscriptionPayload); - AnswerCallOptions options = new AnswerCallOptions(incomingCallContext: incomingCallContext, callbackUri: new Uri("http://example.com")) - { - MediaStreamingOptions = _mediaStreamingConfiguration - }; - - ArgumentException? ex = Assert.ThrowsAsync(async () => await callAutomationClient.AnswerCallAsync(options).ConfigureAwait(false)); - Assert.NotNull(ex); - Assert.True(ex?.Message.Contains(CallAutomationErrorMessages.InvalidHttpsUriMessage)); - } - [TestCaseSource(nameof(TestData_AnswerCall))] public void AnswerCallAsync_401AuthFailed(string incomingCallContext, Uri callbackUri) { @@ -367,7 +339,7 @@ private static void ValidateCallConnectionProperties(CallConnectionProperties pr Assert.NotNull(properties); Assert.AreEqual("callConnectionId", properties.CallConnectionId); Assert.AreEqual(CallConnectionState.Connecting, properties.CallConnectionState); - Assert.AreEqual("dummySourceUser", properties.SourceIdentity.RawId); + Assert.AreEqual("dummySourceUser", properties.Source.RawId); Assert.AreEqual("serverCallId", properties.ServerCallId); Assert.AreEqual(1, properties.Targets.Count); } diff --git a/sdk/communication/Azure.Communication.CallAutomation/tests/CallConnections/CallConnectionTests.cs b/sdk/communication/Azure.Communication.CallAutomation/tests/CallConnections/CallConnectionTests.cs index 82a7833b0c47..dffb57eb2f11 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/tests/CallConnections/CallConnectionTests.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/tests/CallConnections/CallConnectionTests.cs @@ -202,19 +202,6 @@ public void TransferCallToParticipant_404NotFound(CallInvite callInvite) Assert.AreEqual(ex?.Status, 404); } - [TestCaseSource(nameof(TestData_TransferCallToParticipant))] - public void TransferCallToParticipant_ExceedsMaxOperationContextLength(CallInvite callInvite) - { - var callConnection = CreateMockCallConnection(202); - - var options = new TransferToParticipantOptions(callInvite.Target as CommunicationUserIdentifier) { - OperationContext = new string('a', 1 + CallAutomationConstants.InputValidation.StringMaxLength) - }; - ArgumentException? ex = Assert.Throws(() => callConnection.TransferCallToParticipant(options)); - Assert.NotNull(ex); - Assert.True(ex?.Message.Contains(CallAutomationErrorMessages.OperationContextExceedsMaxLength)); - } - [TestCaseSource(nameof(TestData_AddOrRemoveParticipant))] public async Task AddParticipantsAsync_202Accepted(CommunicationIdentifier participantToAdd) { @@ -247,35 +234,6 @@ public void AddParticipantsAsync_NullParticipantToAdd() Assert.True(ex?.Message.Contains("Value cannot be null.")); } - [TestCaseSource(nameof(TestData_AddOrRemoveParticipant))] - public void AddParticipantsAsync_ExceedsInvitationTimeOut(CommunicationIdentifier participantToAdd) - { - var callConnection = CreateMockCallConnection(202, AddParticipantPayload); - var callInvite = new CallInvite((CommunicationUserIdentifier)participantToAdd); - - var options = new AddParticipantOptions(callInvite) { - InvitationTimeoutInSeconds = CallAutomationConstants.InputValidation.MaxInvitationTimeoutInSeconds + 1 - }; - ArgumentException? ex = Assert.ThrowsAsync(async () => await callConnection.AddParticipantAsync(options).ConfigureAwait(false)); - Assert.NotNull(ex); - Assert.True(ex?.Message.Contains(CallAutomationErrorMessages.InvalidInvitationTimeoutInSeconds)); - } - - [TestCaseSource(nameof(TestData_AddOrRemoveParticipant))] - public void AddParticipantsAsync_NegativeInvitationTimeOut(CommunicationIdentifier participantToAdd) - { - var callConnection = CreateMockCallConnection(202, AddParticipantPayload); - var callInvite = new CallInvite((CommunicationUserIdentifier)participantToAdd); - - var options = new AddParticipantOptions(callInvite) - { - InvitationTimeoutInSeconds = 0 - }; - ArgumentException? ex = Assert.ThrowsAsync(async () => await callConnection.AddParticipantAsync(options).ConfigureAwait(false)); - Assert.NotNull(ex); - Assert.True(ex?.Message.Contains(CallAutomationErrorMessages.InvalidInvitationTimeoutInSeconds)); - } - [TestCaseSource(nameof(TestData_AddOrRemoveParticipant))] public void AddParticipantsAsync_404NotFound(CommunicationIdentifier participantToAdd) { @@ -402,17 +360,6 @@ public void RemoveParticipants_202Accepted(CommunicationIdentifier participantTo Assert.AreEqual(OperationContext, response.Value.OperationContext); } - [TestCaseSource(nameof(TestData_AddOrRemoveParticipant))] - public void RemoveParticipants_ExceedsMaxOperationContextLength(CommunicationIdentifier participantToRemove) - { - var callConnection = CreateMockCallConnection(202, OperationContextPayload); - - var operationContext = new string('a', 1 + CallAutomationConstants.InputValidation.StringMaxLength); - ArgumentException? ex = Assert.ThrowsAsync(async () => await callConnection.RemoveParticipantAsync(participantToRemove, operationContext).ConfigureAwait(false)); - Assert.NotNull(ex); - Assert.True(ex?.Message.Contains(CallAutomationErrorMessages.OperationContextExceedsMaxLength)); - } - [TestCaseSource(nameof(TestData_AddOrRemoveParticipant))] public void RemoveParticipantsAsync_404NotFound(CommunicationIdentifier participantToRemove) { diff --git a/sdk/communication/Azure.Communication.CallAutomation/tests/CallMedias/CallMediaTests.cs b/sdk/communication/Azure.Communication.CallAutomation/tests/CallMedias/CallMediaTests.cs index 8d8b9d5255b8..ede7e47b1346 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/tests/CallMedias/CallMediaTests.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/tests/CallMedias/CallMediaTests.cs @@ -109,7 +109,7 @@ public class CallMediaTests : CallAutomationTestBase { InterruptCallMediaOperation = true, InitialSilenceTimeout = TimeSpan.FromSeconds(5), - EndSilenceTimeoutInMs = TimeSpan.FromMilliseconds(500), + EndSilenceTimeout = TimeSpan.FromMilliseconds(500), InterruptPrompt = true, OperationContext = "operationContext", Prompt = new TextSource("PlayTTS test text.") @@ -126,7 +126,7 @@ public class CallMediaTests : CallAutomationTestBase { InterruptCallMediaOperation = true, InitialSilenceTimeout = TimeSpan.FromSeconds(5), - EndSilenceTimeoutInMs = TimeSpan.FromMilliseconds(500), + EndSilenceTimeout = TimeSpan.FromMilliseconds(500), InterruptPrompt = true, OperationContext = "operationContext", Prompt = new TextSource("PlayTTS test text.") @@ -146,7 +146,7 @@ public class CallMediaTests : CallAutomationTestBase [SetUp] public void Setup() { - _fileSource.PlaySourceId = "playSourceId"; + _fileSource.PlaySourceCacheId = "playSourceId"; } private CallMedia GetCallMedia(int responseCode) diff --git a/sdk/communication/Azure.Communication.CallAutomation/tests/Infrastructure/CallAutomationTestBase.cs b/sdk/communication/Azure.Communication.CallAutomation/tests/Infrastructure/CallAutomationTestBase.cs index 16f9fe3c0fb5..68b642e140dd 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/tests/Infrastructure/CallAutomationTestBase.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/tests/Infrastructure/CallAutomationTestBase.cs @@ -93,7 +93,7 @@ protected void verifyCallConnectionProperties(CallConnectionProperties callConne { Assert.AreEqual(CallConnectionId, callConnectionProperties.CallConnectionId); Assert.AreEqual(ServerCallId, callConnectionProperties.ServerCallId); - var sourceUser = (CommunicationUserIdentifier)callConnectionProperties.SourceIdentity; + var sourceUser = (CommunicationUserIdentifier)callConnectionProperties.Source; Assert.AreEqual(SourceId, sourceUser.Id); Assert.AreEqual(callConnectionProperties.Targets.Count, 1); var targetUser = (CommunicationUserIdentifier)callConnectionProperties.Targets[0];