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 77e7314723e2..d27a190420b9 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 @@ -134,7 +134,7 @@ public static partial class CallAutomationModelFactory public static Azure.Communication.CallAutomation.AddParticipantsSucceeded AddParticipantsSucceeded(string callConnectionId = null, string serverCallId = null, string correlationId = null, string operationContext = null, Azure.Communication.CallAutomation.ResultInformation resultInformation = null, System.Collections.Generic.IEnumerable participants = 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.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, Azure.Communication.CallAutomation.CallSource callSource = null, System.Collections.Generic.IEnumerable targets = null, Azure.Communication.CallAutomation.CallConnectionState callConnectionState = default(Azure.Communication.CallAutomation.CallConnectionState), System.Uri callbackEndpoint = null, string mediaSubscriptionId = 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 callbackEndpoint = null, Azure.Communication.CommunicationIdentifier sourceIdentity = null, Azure.Communication.PhoneNumberIdentifier sourceCallerIdNumber = null, string sourceDisplayName = null, string mediaSubscriptionId = 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.CallParticipant CallParticipant(Azure.Communication.CommunicationIdentifier identifier = null, bool isMuted = 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) { throw null; } @@ -187,7 +187,9 @@ protected CallConnection() { } public virtual Azure.Response RemoveParticipants(System.Collections.Generic.IEnumerable participantsToRemove, string operationContext = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> RemoveParticipantsAsync(Azure.Communication.CallAutomation.RemoveParticipantsOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> RemoveParticipantsAsync(System.Collections.Generic.IEnumerable participantsToRemove, string operationContext = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response TransferCallToParticipant(Azure.Communication.CallAutomation.CallInvite callInvite, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response TransferCallToParticipant(Azure.Communication.CallAutomation.TransferToParticipantOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> TransferCallToParticipantAsync(Azure.Communication.CallAutomation.CallInvite callInvite, 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 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; } @@ -200,9 +202,11 @@ internal CallConnectionProperties() { } public System.Uri CallbackEndpoint { get { throw null; } } public string CallConnectionId { get { throw null; } } public Azure.Communication.CallAutomation.CallConnectionState CallConnectionState { get { throw null; } } - public Azure.Communication.CallAutomation.CallSource CallSource { get { throw null; } } public string MediaSubscriptionId { get { throw null; } } public string ServerCallId { 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)] @@ -351,13 +355,6 @@ protected CallRecording() { } public static bool operator !=(Azure.Communication.CallAutomation.CallRejectReason left, Azure.Communication.CallAutomation.CallRejectReason right) { throw null; } public override string ToString() { throw null; } } - public partial class CallSource - { - public CallSource(Azure.Communication.CommunicationIdentifier identifier) { } - public Azure.Communication.PhoneNumberIdentifier CallerId { get { throw null; } set { } } - public string DisplayName { get { throw null; } set { } } - public Azure.Communication.CommunicationIdentifier Identifier { get { throw null; } } - } public partial class CallTransferAccepted : Azure.Communication.CallAutomation.CallAutomationEventBase { internal CallTransferAccepted() { } @@ -439,6 +436,12 @@ public CreateGroupCallOptions(System.Collections.Generic.IEnumerable Targets { get { throw null; } } } + public partial class CustomContext + { + public CustomContext() { } + public System.Collections.Generic.IDictionary SipHeaders { get { throw null; } } + public System.Collections.Generic.IDictionary VoipHeaders { get { throw null; } } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct DtmfTone : System.IEquatable { @@ -948,10 +951,9 @@ internal TransferCallToParticipantResult() { } } public partial class TransferToParticipantOptions { - public TransferToParticipantOptions(Azure.Communication.CommunicationIdentifier targetParticipant) { } + public TransferToParticipantOptions(Azure.Communication.CallAutomation.CallInvite callInvite) { } + public Azure.Communication.CallAutomation.CallInvite CallInvite { get { throw null; } } public string OperationContext { get { throw null; } set { } } - public Azure.Communication.PhoneNumberIdentifier SourceCallerId { get { throw null; } set { } } - public Azure.Communication.CommunicationIdentifier TargetParticipant { get { throw null; } } public string UserToUserInformation { get { throw null; } set { } } } public partial class UnmuteParticipantsOptions diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/CallAutomationClient.cs b/sdk/communication/Azure.Communication.CallAutomation/src/CallAutomationClient.cs index 23c0d174d425..4f0a39f5e015 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/CallAutomationClient.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/CallAutomationClient.cs @@ -83,10 +83,10 @@ private CallAutomationClient(Uri endpoint, HttpPipeline httpPipeline, CallAutoma _pipeline = httpPipeline; _resourceEndpoint = endpoint.AbsoluteUri; _clientDiagnostics = new ClientDiagnostics(options); - AzureCommunicationServicesRestClient = new AzureCommunicationServicesRestClient(_clientDiagnostics, httpPipeline, endpoint, options.ApiVersion); - CallConnectionRestClient = new CallConnectionRestClient(_clientDiagnostics, httpPipeline, endpoint, options.ApiVersion); - CallMediaRestClient = new CallMediaRestClient(_clientDiagnostics, httpPipeline, endpoint, options.ApiVersion); - CallRecordingRestClient = new CallRecordingRestClient(_clientDiagnostics, httpPipeline, endpoint, options.ApiVersion); + AzureCommunicationServicesRestClient = new AzureCommunicationServicesRestClient(_clientDiagnostics, httpPipeline, endpoint.AbsolutePath, options.ApiVersion); + CallConnectionRestClient = new CallConnectionRestClient(_clientDiagnostics, httpPipeline, endpoint.AbsolutePath, options.ApiVersion); + CallMediaRestClient = new CallMediaRestClient(_clientDiagnostics, httpPipeline, endpoint.AbsolutePath, options.ApiVersion); + CallRecordingRestClient = new CallRecordingRestClient(_clientDiagnostics, httpPipeline, endpoint.AbsolutePath, options.ApiVersion); EventProcessor = new EventProcessor(options.EventProcessorOptions); Source = options.Source; } @@ -288,7 +288,7 @@ public virtual async Task RedirectCallAsync(RedirectCallOptions option /// Redirect an incoming call to the target identities. /// The incoming call context - /// The target where the call is redirected to. + /// The target where the call is redirected to. /// The cancellation token. /// The server returned an error. See for details returned from the server. /// is null. @@ -624,18 +624,16 @@ public virtual Response CreateGroupCall(CreateGroupCallOptions private CreateCallRequestInternal CreateCallRequest(CreateCallOptions options) { - CallSourceInternal sourceDto = new(CommunicationIdentifierSerializer.Serialize(Source)) + CreateCallRequestInternal request = new( + targets: new List() { { CommunicationIdentifierSerializer.Serialize(options.CallInvite.Target) } }, + callbackUri: options.CallbackUri.AbsoluteUri) { - CallerId = options?.CallInvite?.SourceCallerIdNumber == null + SourceCallerIdNumber = options?.CallInvite?.SourceCallerIdNumber == null ? null : new PhoneNumberIdentifierModel(options?.CallInvite?.SourceCallerIdNumber?.PhoneNumber), - DisplayName = options.CallInvite.SourceDisplayName, + SourceDisplayName = options?.CallInvite?.SourceDisplayName, + CallSourceIdentifier = CommunicationIdentifierSerializer.Serialize(Source), }; - - CreateCallRequestInternal request = new( - new List() { { CommunicationIdentifierSerializer.Serialize(options.CallInvite.Target) } }, - sourceDto, - options.CallbackUri.AbsoluteUri); // Add custom cognitive service domain name if (options.AzureCognitiveServicesEndpointUrl != null) { @@ -653,16 +651,16 @@ private CreateCallRequestInternal CreateCallRequest(CreateCallOptions options) private CreateCallRequestInternal CreateCallRequest(CreateGroupCallOptions options) { - CallSourceInternal sourceDto = new(CommunicationIdentifierSerializer.Serialize(Source)) + CreateCallRequestInternal request = new( + targets: options.Targets.Select(t => CommunicationIdentifierSerializer.Serialize(t)), + callbackUri: options.CallbackUri.AbsoluteUri) { - CallerId = options?.SourceCallerIdNumber == null ? null : new PhoneNumberIdentifierModel(options?.SourceCallerIdNumber?.PhoneNumber), - DisplayName = options.SourceDisplayName, + SourceCallerIdNumber = options?.SourceCallerIdNumber == null + ? null + : new PhoneNumberIdentifierModel(options?.SourceCallerIdNumber?.PhoneNumber), + SourceDisplayName = options?.SourceDisplayName, + CallSourceIdentifier = CommunicationIdentifierSerializer.Serialize(Source), }; - - CreateCallRequestInternal request = new( - options.Targets.Select(t => CommunicationIdentifierSerializer.Serialize(t)), - sourceDto, - options.CallbackUri.AbsoluteUri); // Add custom cognitive service domain name if (options.AzureCognitiveServicesEndpointUrl != null) { diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/CallConnection.cs b/sdk/communication/Azure.Communication.CallAutomation/src/CallConnection.cs index c52743f4d6dc..effd2cb45d86 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/CallConnection.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/CallConnection.cs @@ -188,6 +188,18 @@ public virtual Response HangUp(HangUpOptions options, CancellationToken cancella } } + /// Transfer this call to a participant. + /// The target to transfer the call to. + /// The cancellation token. + /// The server returned an error. See for details returned from the server. + /// is null. + public virtual async Task> TransferCallToParticipantAsync(CallInvite callInvite, CancellationToken cancellationToken = default) + { + TransferToParticipantOptions options = new TransferToParticipantOptions(callInvite); + + return await TransferCallToParticipantAsync(options, cancellationToken).ConfigureAwait(false); + } + /// Transfer this call to a participant. /// Options for the Transfer Call To Participant operation. /// The cancellation token. @@ -227,6 +239,18 @@ public virtual async Task> TransferCal } } + /// Transfer this call to a participant. + /// The target to transfer the call to. + /// The cancellation token. + /// The server returned an error. See for details returned from the server. + /// is null. + public virtual Response TransferCallToParticipant(CallInvite callInvite, CancellationToken cancellationToken = default) + { + TransferToParticipantOptions options = new TransferToParticipantOptions(callInvite); + + return TransferCallToParticipant(options, cancellationToken); + } + /// Transfer the call. /// Options for the Transfer Call To Participant operation. /// The cancellation token. @@ -268,23 +292,18 @@ public virtual Response TransferCallToParticipa private static TransferToParticipantRequestInternal CreateTransferToParticipantRequest(TransferToParticipantOptions options) { - // when transfer to a PSTN participant, the SourceCallerId must be provided. - if (options.TargetParticipant is PhoneNumberIdentifier) - { - Argument.AssertNotNull(options.SourceCallerId, nameof(options.SourceCallerId)); - } - - TransferToParticipantRequestInternal request = new TransferToParticipantRequestInternal(CommunicationIdentifierSerializer.Serialize(options.TargetParticipant)); + TransferToParticipantRequestInternal request = new TransferToParticipantRequestInternal(CommunicationIdentifierSerializer.Serialize(options.CallInvite.Target)); - request.TransfereeCallerId = options.SourceCallerId == null ? null : new PhoneNumberIdentifierModel(options.SourceCallerId.PhoneNumber); + request.TransfereeCallerId = options.CallInvite.SourceCallerIdNumber == null ? null : new PhoneNumberIdentifierModel(options.CallInvite.SourceCallerIdNumber.PhoneNumber); if (options.UserToUserInformation != null && options.UserToUserInformation.Length > CallAutomationConstants.InputValidation.StringMaxLength) { throw new ArgumentException(CallAutomationErrorMessages.UserToUserInformationExceedsMaxLength); } - else - { - request.UserToUserInformation = options.UserToUserInformation; - } + // TODO: update logic + // else + // { + // request.UserToUserInformation = options.UserToUserInformation; + // } if (options.OperationContext != null && options.OperationContext.Length > CallAutomationConstants.InputValidation.StringMaxLength) { throw new ArgumentException(CallAutomationErrorMessages.OperationContextExceedsMaxLength); @@ -313,7 +332,7 @@ public virtual async Task> AddParticipantsAsync( if (options == null) throw new ArgumentNullException(nameof(options)); - AddParticipantsRequestInternal request = CreateAddParticipantRequest(options); + AddParticipantRequestInternal request = CreateAddParticipantRequest(options); var repeatabilityHeaders = new RepeatabilityHeaders(); var response = await RestClient.AddParticipantAsync( @@ -352,7 +371,7 @@ public virtual Response AddParticipants(AddParticipantsOp if (options == null) throw new ArgumentNullException(nameof(options)); - AddParticipantsRequestInternal request = CreateAddParticipantRequest(options); + AddParticipantRequestInternal request = CreateAddParticipantRequest(options); var repeatabilityHeaders = new RepeatabilityHeaders(); var response = RestClient.AddParticipant( @@ -375,7 +394,7 @@ public virtual Response AddParticipants(AddParticipantsOp } } - private static AddParticipantsRequestInternal CreateAddParticipantRequest(AddParticipantsOptions options) + private static AddParticipantRequestInternal CreateAddParticipantRequest(AddParticipantsOptions options) { // when add PSTN participants, the SourceCallerId must be provided. if (options.ParticipantsToAdd.Any(participant => participant is PhoneNumberIdentifier)) @@ -386,7 +405,8 @@ private static AddParticipantsRequestInternal CreateAddParticipantRequest(AddPar // validate ParticipantsToAdd is not null or empty Argument.AssertNotNullOrEmpty(options.ParticipantsToAdd, nameof(options.ParticipantsToAdd)); - AddParticipantsRequestInternal request = new AddParticipantsRequestInternal(options.ParticipantsToAdd.Select(t => CommunicationIdentifierSerializer.Serialize(t)).ToList()); + // TODO: update logic + AddParticipantRequestInternal request = new(CommunicationIdentifierSerializer.Serialize(options.ParticipantsToAdd.FirstOrDefault())); request.SourceCallerId = options.SourceCallerId == null ? null : new PhoneNumberIdentifierModel(options.SourceCallerId.PhoneNumber); request.SourceDisplayName = options.SourceDisplayName; @@ -552,7 +572,8 @@ public virtual async Task> RemoveParticipants // validate RequestInitiator is not null or empty Argument.AssertNotNullOrEmpty(options.ParticipantsToRemove, nameof(options.ParticipantsToRemove)); - RemoveParticipantsRequestInternal request = new RemoveParticipantsRequestInternal(options.ParticipantsToRemove.Select(t => CommunicationIdentifierSerializer.Serialize(t)).ToList()); + // TODO: update logic + RemoveParticipantRequestInternal request = new(CommunicationIdentifierSerializer.Serialize(options.ParticipantsToRemove[0])); var repeatabilityHeaders = new RepeatabilityHeaders(); if (options.OperationContext != null && options.OperationContext.Length > CallAutomationConstants.InputValidation.StringMaxLength) { @@ -609,7 +630,8 @@ public virtual Response RemoveParticipants(RemoveParti if (options == null) throw new ArgumentNullException(nameof(options)); - RemoveParticipantsRequestInternal request = new RemoveParticipantsRequestInternal(options.ParticipantsToRemove.Select(t => CommunicationIdentifierSerializer.Serialize(t)).ToList()); + // TODO: update logic + RemoveParticipantRequestInternal request = new(CommunicationIdentifierSerializer.Serialize(options.ParticipantsToRemove[0])); var repeatabilityHeaders = new RepeatabilityHeaders(); if (options.OperationContext != null && options.OperationContext.Length > CallAutomationConstants.InputValidation.StringMaxLength) diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/AzureCommunicationServicesRestClient.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/AzureCommunicationServicesRestClient.cs index da7d097d7701..9c148f917496 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/AzureCommunicationServicesRestClient.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/AzureCommunicationServicesRestClient.cs @@ -18,7 +18,7 @@ namespace Azure.Communication.CallAutomation internal partial class AzureCommunicationServicesRestClient { private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; + private readonly string _endpoint; private readonly string _apiVersion; /// The ClientDiagnostics is used to provide tracing support for the client library. @@ -30,7 +30,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-01-15-preview") + public AzureCommunicationServicesRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, string apiVersion = "2023-01-15-preview") { ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics)); _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); @@ -44,7 +44,7 @@ internal HttpMessage CreateCreateCallRequest(CreateCallRequestInternal createCal var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); + uri.AppendRaw(_endpoint, false); uri.AppendPath("/calling/callConnections", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; @@ -128,7 +128,7 @@ internal HttpMessage CreateAnswerCallRequest(AnswerCallRequestInternal answerCal var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); + uri.AppendRaw(_endpoint, false); uri.AppendPath("/calling/callConnections:answer", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; @@ -214,7 +214,7 @@ internal HttpMessage CreateRedirectCallRequest(RedirectCallRequestInternal redir var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); + uri.AppendRaw(_endpoint, false); uri.AppendPath("/calling/callConnections:redirect", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; @@ -288,7 +288,7 @@ internal HttpMessage CreateRejectCallRequest(RejectCallRequestInternal rejectCal var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); + uri.AppendRaw(_endpoint, false); uri.AppendPath("/calling/callConnections:reject", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallConnectionRestClient.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallConnectionRestClient.cs index 7ef5d76f5813..e4a4667667ee 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallConnectionRestClient.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallConnectionRestClient.cs @@ -18,7 +18,7 @@ namespace Azure.Communication.CallAutomation internal partial class CallConnectionRestClient { private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; + private readonly string _endpoint; private readonly string _apiVersion; /// The ClientDiagnostics is used to provide tracing support for the client library. @@ -30,7 +30,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-01-15-preview") + public CallConnectionRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, string apiVersion = "2023-01-15-preview") { ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics)); _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); @@ -44,7 +44,7 @@ internal HttpMessage CreateGetCallRequest(string callConnectionId) var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); + uri.AppendRaw(_endpoint, false); uri.AppendPath("/calling/callConnections/", false); uri.AppendPath(callConnectionId, true); uri.AppendQuery("api-version", _apiVersion, true); @@ -113,7 +113,7 @@ internal HttpMessage CreateHangupCallRequest(string callConnectionId) var request = message.Request; request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); + uri.AppendRaw(_endpoint, false); uri.AppendPath("/calling/callConnections/", false); uri.AppendPath(callConnectionId, true); uri.AppendQuery("api-version", _apiVersion, true); @@ -172,7 +172,7 @@ internal HttpMessage CreateTerminateCallRequest(string callConnectionId, Guid? r var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); + uri.AppendRaw(_endpoint, false); uri.AppendPath("/calling/callConnections/", false); uri.AppendPath(callConnectionId, true); uri.AppendPath(":terminate", false); @@ -244,7 +244,7 @@ internal HttpMessage CreateTransferToParticipantRequest(string callConnectionId, var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); + uri.AppendRaw(_endpoint, false); uri.AppendPath("/calling/callConnections/", false); uri.AppendPath(callConnectionId, true); uri.AppendPath(":transferToParticipant", false); @@ -340,7 +340,7 @@ internal HttpMessage CreateGetParticipantsRequest(string callConnectionId) var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); + uri.AppendRaw(_endpoint, false); uri.AppendPath("/calling/callConnections/", false); uri.AppendPath(callConnectionId, true); uri.AppendPath("/participants", false); @@ -404,13 +404,13 @@ public Response GetParticipants(string callConn } } - internal HttpMessage CreateAddParticipantRequest(string callConnectionId, AddParticipantsRequestInternal addParticipantsRequest, Guid? repeatabilityRequestID, string repeatabilityFirstSent) + internal HttpMessage CreateAddParticipantRequest(string callConnectionId, AddParticipantRequestInternal addParticipantRequest, Guid? repeatabilityRequestID, string repeatabilityFirstSent) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); + uri.AppendRaw(_endpoint, false); uri.AppendPath("/calling/callConnections/", false); uri.AppendPath(callConnectionId, true); uri.AppendPath("/participants:add", false); @@ -427,30 +427,30 @@ internal HttpMessage CreateAddParticipantRequest(string callConnectionId, AddPar request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(addParticipantsRequest); + content.JsonWriter.WriteObjectValue(addParticipantRequest); request.Content = content; return message; } /// Add participants to the call. /// The call connection Id. - /// The add participants request. + /// The AddParticipantRequest to use. /// If specified, the client directs that the request is repeatable; that is, that the client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate response without the server executing the request multiple times. The value of the Repeatability-Request-Id is an opaque string representing a client-generated unique identifier for the request. It is a version 4 (random) UUID. /// If Repeatability-Request-ID header is specified, then Repeatability-First-Sent header must also be specified. The value should be the date and time at which the request was first created, expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT. /// The cancellation token to use. - /// or is null. - public async Task> AddParticipantAsync(string callConnectionId, AddParticipantsRequestInternal addParticipantsRequest, Guid? repeatabilityRequestID = null, string repeatabilityFirstSent = null, CancellationToken cancellationToken = default) + /// or is null. + public async Task> AddParticipantAsync(string callConnectionId, AddParticipantRequestInternal addParticipantRequest, Guid? repeatabilityRequestID = null, string repeatabilityFirstSent = null, CancellationToken cancellationToken = default) { if (callConnectionId == null) { throw new ArgumentNullException(nameof(callConnectionId)); } - if (addParticipantsRequest == null) + if (addParticipantRequest == null) { - throw new ArgumentNullException(nameof(addParticipantsRequest)); + throw new ArgumentNullException(nameof(addParticipantRequest)); } - using var message = CreateAddParticipantRequest(callConnectionId, addParticipantsRequest, repeatabilityRequestID, repeatabilityFirstSent); + using var message = CreateAddParticipantRequest(callConnectionId, addParticipantRequest, repeatabilityRequestID, repeatabilityFirstSent); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -468,23 +468,23 @@ public async Task> AddParticipantAsync /// Add participants to the call. /// The call connection Id. - /// The add participants request. + /// The AddParticipantRequest to use. /// If specified, the client directs that the request is repeatable; that is, that the client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate response without the server executing the request multiple times. The value of the Repeatability-Request-Id is an opaque string representing a client-generated unique identifier for the request. It is a version 4 (random) UUID. /// If Repeatability-Request-ID header is specified, then Repeatability-First-Sent header must also be specified. The value should be the date and time at which the request was first created, expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT. /// The cancellation token to use. - /// or is null. - public Response AddParticipant(string callConnectionId, AddParticipantsRequestInternal addParticipantsRequest, Guid? repeatabilityRequestID = null, string repeatabilityFirstSent = null, CancellationToken cancellationToken = default) + /// or is null. + public Response AddParticipant(string callConnectionId, AddParticipantRequestInternal addParticipantRequest, Guid? repeatabilityRequestID = null, string repeatabilityFirstSent = null, CancellationToken cancellationToken = default) { if (callConnectionId == null) { throw new ArgumentNullException(nameof(callConnectionId)); } - if (addParticipantsRequest == null) + if (addParticipantRequest == null) { - throw new ArgumentNullException(nameof(addParticipantsRequest)); + throw new ArgumentNullException(nameof(addParticipantRequest)); } - using var message = CreateAddParticipantRequest(callConnectionId, addParticipantsRequest, repeatabilityRequestID, repeatabilityFirstSent); + using var message = CreateAddParticipantRequest(callConnectionId, addParticipantRequest, repeatabilityRequestID, repeatabilityFirstSent); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -500,13 +500,13 @@ public Response AddParticipant(string callConne } } - internal HttpMessage CreateRemoveParticipantsRequest(string callConnectionId, RemoveParticipantsRequestInternal removeParticipantsRequest, Guid? repeatabilityRequestID, string repeatabilityFirstSent) + internal HttpMessage CreateRemoveParticipantsRequest(string callConnectionId, RemoveParticipantRequestInternal removeParticipantRequest, Guid? repeatabilityRequestID, string repeatabilityFirstSent) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); + uri.AppendRaw(_endpoint, false); uri.AppendPath("/calling/callConnections/", false); uri.AppendPath(callConnectionId, true); uri.AppendPath("/participants:remove", false); @@ -523,30 +523,30 @@ internal HttpMessage CreateRemoveParticipantsRequest(string callConnectionId, Re request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(removeParticipantsRequest); + content.JsonWriter.WriteObjectValue(removeParticipantRequest); request.Content = content; return message; } /// Remove participant from the call using identifier. /// The call connection id. - /// The participants to be removed from the call. + /// The RemoveParticipantRequest to use. /// If specified, the client directs that the request is repeatable; that is, that the client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate response without the server executing the request multiple times. The value of the Repeatability-Request-Id is an opaque string representing a client-generated unique identifier for the request. It is a version 4 (random) UUID. /// If Repeatability-Request-ID header is specified, then Repeatability-First-Sent header must also be specified. The value should be the date and time at which the request was first created, expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT. /// The cancellation token to use. - /// or is null. - public async Task> RemoveParticipantsAsync(string callConnectionId, RemoveParticipantsRequestInternal removeParticipantsRequest, Guid? repeatabilityRequestID = null, string repeatabilityFirstSent = null, CancellationToken cancellationToken = default) + /// or is null. + public async Task> RemoveParticipantsAsync(string callConnectionId, RemoveParticipantRequestInternal removeParticipantRequest, Guid? repeatabilityRequestID = null, string repeatabilityFirstSent = null, CancellationToken cancellationToken = default) { if (callConnectionId == null) { throw new ArgumentNullException(nameof(callConnectionId)); } - if (removeParticipantsRequest == null) + if (removeParticipantRequest == null) { - throw new ArgumentNullException(nameof(removeParticipantsRequest)); + throw new ArgumentNullException(nameof(removeParticipantRequest)); } - using var message = CreateRemoveParticipantsRequest(callConnectionId, removeParticipantsRequest, repeatabilityRequestID, repeatabilityFirstSent); + using var message = CreateRemoveParticipantsRequest(callConnectionId, removeParticipantRequest, repeatabilityRequestID, repeatabilityFirstSent); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -564,23 +564,23 @@ public async Task> RemoveParticipantsAsync(st /// Remove participant from the call using identifier. /// The call connection id. - /// The participants to be removed from the call. + /// The RemoveParticipantRequest to use. /// If specified, the client directs that the request is repeatable; that is, that the client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate response without the server executing the request multiple times. The value of the Repeatability-Request-Id is an opaque string representing a client-generated unique identifier for the request. It is a version 4 (random) UUID. /// If Repeatability-Request-ID header is specified, then Repeatability-First-Sent header must also be specified. The value should be the date and time at which the request was first created, expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT. /// The cancellation token to use. - /// or is null. - public Response RemoveParticipants(string callConnectionId, RemoveParticipantsRequestInternal removeParticipantsRequest, Guid? repeatabilityRequestID = null, string repeatabilityFirstSent = null, CancellationToken cancellationToken = default) + /// or is null. + public Response RemoveParticipants(string callConnectionId, RemoveParticipantRequestInternal removeParticipantRequest, Guid? repeatabilityRequestID = null, string repeatabilityFirstSent = null, CancellationToken cancellationToken = default) { if (callConnectionId == null) { throw new ArgumentNullException(nameof(callConnectionId)); } - if (removeParticipantsRequest == null) + if (removeParticipantRequest == null) { - throw new ArgumentNullException(nameof(removeParticipantsRequest)); + throw new ArgumentNullException(nameof(removeParticipantRequest)); } - using var message = CreateRemoveParticipantsRequest(callConnectionId, removeParticipantsRequest, repeatabilityRequestID, repeatabilityFirstSent); + using var message = CreateRemoveParticipantsRequest(callConnectionId, removeParticipantRequest, repeatabilityRequestID, repeatabilityFirstSent); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -602,7 +602,7 @@ internal HttpMessage CreateMuteRequest(string callConnectionId, MuteParticipants var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); + uri.AppendRaw(_endpoint, false); uri.AppendPath("/calling/callConnections/", false); uri.AppendPath(callConnectionId, true); uri.AppendPath("/participants:mute", false); @@ -698,7 +698,7 @@ internal HttpMessage CreateUnmuteRequest(string callConnectionId, UnmuteParticip var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); + uri.AppendRaw(_endpoint, false); uri.AppendPath("/calling/callConnections/", false); uri.AppendPath(callConnectionId, true); uri.AppendPath("/participants:unmute", false); @@ -794,7 +794,7 @@ internal HttpMessage CreateGetParticipantRequest(string callConnectionId, string var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); + uri.AppendRaw(_endpoint, false); uri.AppendPath("/calling/callConnections/", false); uri.AppendPath(callConnectionId, true); uri.AppendPath("/participants/", false); diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallMediaRestClient.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallMediaRestClient.cs index f59eb63d186e..dd6206a1c48e 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallMediaRestClient.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallMediaRestClient.cs @@ -17,7 +17,7 @@ namespace Azure.Communication.CallAutomation internal partial class CallMediaRestClient { private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; + private readonly string _endpoint; private readonly string _apiVersion; /// The ClientDiagnostics is used to provide tracing support for the client library. @@ -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-01-15-preview") + public CallMediaRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, string apiVersion = "2023-01-15-preview") { ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics)); _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); @@ -43,7 +43,7 @@ internal HttpMessage CreatePlayRequest(string callConnectionId, PlayRequestInter var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); + uri.AppendRaw(_endpoint, false); uri.AppendPath("/calling/callConnections/", false); uri.AppendPath(callConnectionId, true); uri.AppendPath(":play", false); @@ -117,7 +117,7 @@ internal HttpMessage CreateCancelAllMediaOperationsRequest(string callConnection var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); + uri.AppendRaw(_endpoint, false); uri.AppendPath("/calling/callConnections/", false); uri.AppendPath(callConnectionId, true); uri.AppendPath(":cancelAllMediaOperations", false); @@ -177,7 +177,7 @@ internal HttpMessage CreateRecognizeRequest(string callConnectionId, RecognizeRe var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); + uri.AppendRaw(_endpoint, false); uri.AppendPath("/calling/callConnections/", false); uri.AppendPath(callConnectionId, true); uri.AppendPath(":recognize", false); diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallRecordingRestClient.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallRecordingRestClient.cs index b612d0dbe35a..f00d585abbc5 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallRecordingRestClient.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/CallRecordingRestClient.cs @@ -18,7 +18,7 @@ namespace Azure.Communication.CallAutomation internal partial class CallRecordingRestClient { private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; + private readonly string _endpoint; private readonly string _apiVersion; /// The ClientDiagnostics is used to provide tracing support for the client library. @@ -30,7 +30,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-01-15-preview") + public CallRecordingRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, string apiVersion = "2023-01-15-preview") { ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics)); _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); @@ -44,7 +44,7 @@ internal HttpMessage CreateStartRecordingRequest(StartCallRecordingRequestIntern var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); + uri.AppendRaw(_endpoint, false); uri.AppendPath("/calling/recordings", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; @@ -128,7 +128,7 @@ internal HttpMessage CreateGetRecordingPropertiesRequest(string recordingId) var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); + uri.AppendRaw(_endpoint, false); uri.AppendPath("/calling/recordings/", false); uri.AppendPath(recordingId, true); uri.AppendQuery("api-version", _apiVersion, true); @@ -197,7 +197,7 @@ internal HttpMessage CreateStopRecordingRequest(string recordingId) var request = message.Request; request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); + uri.AppendRaw(_endpoint, false); uri.AppendPath("/calling/recordings/", false); uri.AppendPath(recordingId, true); uri.AppendQuery("api-version", _apiVersion, true); @@ -256,7 +256,7 @@ internal HttpMessage CreatePauseRecordingRequest(string recordingId) var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); + uri.AppendRaw(_endpoint, false); uri.AppendPath("/calling/recordings/", false); uri.AppendPath(recordingId, true); uri.AppendPath(":pause", false); @@ -316,7 +316,7 @@ internal HttpMessage CreateResumeRecordingRequest(string recordingId) var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); + uri.AppendRaw(_endpoint, false); uri.AppendPath("/calling/recordings/", false); uri.AppendPath(recordingId, true); uri.AppendPath(":resume", false); diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantsRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantRequestInternal.Serialization.cs similarity index 80% rename from sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantsRequestInternal.Serialization.cs rename to sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantRequestInternal.Serialization.cs index 29e8013efb4a..f6fd588d8dc9 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantsRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantRequestInternal.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.Communication.CallAutomation { - internal partial class AddParticipantsRequestInternal : IUtf8JsonSerializable + internal partial class AddParticipantRequestInternal : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -30,13 +30,8 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("sourceIdentifier"); writer.WriteObjectValue(SourceIdentifier); } - writer.WritePropertyName("participantsToAdd"); - writer.WriteStartArray(); - foreach (var item in ParticipantsToAdd) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); + writer.WritePropertyName("participantToAdd"); + writer.WriteObjectValue(ParticipantToAdd); if (Optional.IsDefined(InvitationTimeoutInSeconds)) { writer.WritePropertyName("invitationTimeoutInSeconds"); @@ -47,6 +42,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("operationContext"); writer.WriteStringValue(OperationContext); } + if (Optional.IsDefined(CustomContext)) + { + writer.WritePropertyName("customContext"); + writer.WriteObjectValue(CustomContext); + } writer.WriteEndObject(); } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantsRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantRequestInternal.cs similarity index 69% rename from sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantsRequestInternal.cs rename to sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantRequestInternal.cs index cde1229904f1..6e0bb69ed538 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantsRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AddParticipantRequestInternal.cs @@ -6,24 +6,22 @@ #nullable disable using System; -using System.Collections.Generic; -using System.Linq; using Azure.Communication; using Azure.Core; namespace Azure.Communication.CallAutomation { - /// The request payload for adding participants to the call. - internal partial class AddParticipantsRequestInternal + /// The request payload for adding participant to the call. + internal partial class AddParticipantRequestInternal { - /// Initializes a new instance of AddParticipantsRequestInternal. - /// The participants to invite. - /// is null. - public AddParticipantsRequestInternal(IEnumerable participantsToAdd) + /// Initializes a new instance of AddParticipantRequestInternal. + /// The participant to invite. + /// is null. + public AddParticipantRequestInternal(CommunicationIdentifierModel participantToAdd) { - Argument.AssertNotNull(participantsToAdd, nameof(participantsToAdd)); + Argument.AssertNotNull(participantToAdd, nameof(participantToAdd)); - ParticipantsToAdd = participantsToAdd.ToList(); + ParticipantToAdd = participantToAdd; } /// @@ -41,8 +39,8 @@ public AddParticipantsRequestInternal(IEnumerable /// is not set, the display name of the source will be used by default when adding a PSTN participant or teams user. /// public CommunicationIdentifierModel SourceIdentifier { get; set; } - /// The participants to invite. - public IList ParticipantsToAdd { get; } + /// The participant to invite. + public CommunicationIdentifierModel ParticipantToAdd { get; } /// /// Gets or sets the timeout to wait for the invited participant to pickup. /// The maximum value of this is 180 seconds @@ -50,5 +48,7 @@ public AddParticipantsRequestInternal(IEnumerable 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 context to targets. + public CustomContext CustomContext { get; set; } } } 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 3881649ca5ed..ce6ec232d4d9 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,6 +29,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("azureCognitiveServicesEndpointUrl"); writer.WriteStringValue(AzureCognitiveServicesEndpointUrl); } + if (Optional.IsDefined(AnsweredByIdentifier)) + { + writer.WritePropertyName("answeredByIdentifier"); + writer.WriteObjectValue(AnsweredByIdentifier); + } 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 11d4f601c347..a3048067b6d3 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AnswerCallRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/AnswerCallRequestInternal.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using Azure.Communication; using Azure.Core; namespace Azure.Communication.CallAutomation @@ -34,5 +35,7 @@ public AnswerCallRequestInternal(string incomingCallContext, string callbackUri) public MediaStreamingOptionsInternal MediaStreamingConfiguration { get; set; } /// The endpoint URL of the Azure Cognitive Services resource attached. public string AzureCognitiveServicesEndpointUrl { get; set; } + /// The identifier of the contoso app which answers the call. + public CommunicationIdentifierModel AnsweredByIdentifier { get; set; } } } 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 7013867f4515..8d72677f573e 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 @@ -18,11 +18,13 @@ internal static CallConnectionPropertiesInternal DeserializeCallConnectionProper { Optional callConnectionId = default; Optional serverCallId = default; - Optional source = default; Optional> targets = default; Optional callConnectionState = default; Optional callbackUri = default; Optional mediaSubscriptionId = default; + Optional sourceCallerIdNumber = default; + Optional sourceDisplayName = default; + Optional sourceIdentity = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("callConnectionId")) @@ -35,16 +37,6 @@ internal static CallConnectionPropertiesInternal DeserializeCallConnectionProper serverCallId = property.Value.GetString(); continue; } - if (property.NameEquals("source")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - source = CallSourceInternal.DeserializeCallSourceInternal(property.Value); - continue; - } if (property.NameEquals("targets")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -80,8 +72,33 @@ internal static CallConnectionPropertiesInternal DeserializeCallConnectionProper mediaSubscriptionId = property.Value.GetString(); continue; } + if (property.NameEquals("sourceCallerIdNumber")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + sourceCallerIdNumber = PhoneNumberIdentifierModel.DeserializePhoneNumberIdentifierModel(property.Value); + continue; + } + if (property.NameEquals("sourceDisplayName")) + { + sourceDisplayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("sourceIdentity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + sourceIdentity = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); + continue; + } } - return new CallConnectionPropertiesInternal(callConnectionId.Value, serverCallId.Value, source.Value, Optional.ToList(targets), Optional.ToNullable(callConnectionState), callbackUri.Value, mediaSubscriptionId.Value); + return new CallConnectionPropertiesInternal(callConnectionId.Value, serverCallId.Value, Optional.ToList(targets), Optional.ToNullable(callConnectionState), callbackUri.Value, mediaSubscriptionId.Value, sourceCallerIdNumber.Value, sourceDisplayName.Value, sourceIdentity.Value); } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnectionPropertiesInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnectionPropertiesInternal.cs index 2643ae745028..ff711e8e4cab 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnectionPropertiesInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallConnectionPropertiesInternal.cs @@ -23,28 +23,33 @@ internal CallConnectionPropertiesInternal() /// Initializes a new instance of CallConnectionPropertiesInternal. /// The call connection id. /// The server call id. - /// The source of the call, which is the caller. /// The targets of the call. /// The state of the call connection. /// The callback URI. /// SubscriptionId for media streaming. - internal CallConnectionPropertiesInternal(string callConnectionId, string serverCallId, CallSourceInternal source, IReadOnlyList targets, CallConnectionState? callConnectionState, string callbackUri, string mediaSubscriptionId) + /// + /// The source caller Id, a phone number, that's shown to the PSTN participant being invited. + /// Required only when calling a PSTN callee. + /// + /// Display name of the call if dialing out to a pstn number. + /// Source identity. + internal CallConnectionPropertiesInternal(string callConnectionId, string serverCallId, IReadOnlyList targets, CallConnectionState? callConnectionState, string callbackUri, string mediaSubscriptionId, PhoneNumberIdentifierModel sourceCallerIdNumber, string sourceDisplayName, CommunicationIdentifierModel sourceIdentity) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; - Source = source; Targets = targets; CallConnectionState = callConnectionState; CallbackUri = callbackUri; MediaSubscriptionId = mediaSubscriptionId; + SourceCallerIdNumber = sourceCallerIdNumber; + SourceDisplayName = sourceDisplayName; + SourceIdentity = sourceIdentity; } /// The call connection id. public string CallConnectionId { get; } /// The server call id. public string ServerCallId { get; } - /// The source of the call, which is the caller. - public CallSourceInternal Source { get; } /// The targets of the call. public IReadOnlyList Targets { get; } /// The state of the call connection. @@ -53,5 +58,14 @@ internal CallConnectionPropertiesInternal(string callConnectionId, string server public string CallbackUri { get; } /// SubscriptionId for media streaming. public string MediaSubscriptionId { get; } + /// + /// The source caller Id, a phone number, that's shown to the PSTN participant being invited. + /// Required only when calling a PSTN callee. + /// + public PhoneNumberIdentifierModel SourceCallerIdNumber { get; } + /// Display name of the call if dialing out to a pstn number. + public string SourceDisplayName { get; } + /// Source identity. + public CommunicationIdentifierModel SourceIdentity { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallSourceInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallSourceInternal.Serialization.cs deleted file mode 100644 index d396039c9276..000000000000 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallSourceInternal.Serialization.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Communication; -using Azure.Core; - -namespace Azure.Communication.CallAutomation -{ - internal partial class CallSourceInternal : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(CallerId)) - { - writer.WritePropertyName("callerId"); - writer.WriteObjectValue(CallerId); - } - if (Optional.IsDefined(DisplayName)) - { - writer.WritePropertyName("displayName"); - writer.WriteStringValue(DisplayName); - } - writer.WritePropertyName("identifier"); - writer.WriteObjectValue(Identifier); - writer.WriteEndObject(); - } - - internal static CallSourceInternal DeserializeCallSourceInternal(JsonElement element) - { - Optional callerId = default; - Optional displayName = default; - CommunicationIdentifierModel identifier = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("callerId")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - callerId = PhoneNumberIdentifierModel.DeserializePhoneNumberIdentifierModel(property.Value); - continue; - } - if (property.NameEquals("displayName")) - { - displayName = property.Value.GetString(); - continue; - } - if (property.NameEquals("identifier")) - { - identifier = CommunicationIdentifierModel.DeserializeCommunicationIdentifierModel(property.Value); - continue; - } - } - return new CallSourceInternal(callerId.Value, displayName.Value, identifier); - } - } -} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallSourceInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallSourceInternal.cs deleted file mode 100644 index 50eaa4b27d76..000000000000 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CallSourceInternal.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Communication; -using Azure.Core; - -namespace Azure.Communication.CallAutomation -{ - /// The caller. - internal partial class CallSourceInternal - { - /// Initializes a new instance of CallSourceInternal. - /// The identifier of the source of the call. - /// is null. - public CallSourceInternal(CommunicationIdentifierModel identifier) - { - Argument.AssertNotNull(identifier, nameof(identifier)); - - Identifier = identifier; - } - - /// Initializes a new instance of CallSourceInternal. - /// - /// The source caller Id, a phone number, that's shown to the PSTN participant being invited. - /// Required only when calling a PSTN callee. - /// - /// Display name of the call if dialing out to a pstn number. - /// The identifier of the source of the call. - internal CallSourceInternal(PhoneNumberIdentifierModel callerId, string displayName, CommunicationIdentifierModel identifier) - { - CallerId = callerId; - DisplayName = displayName; - Identifier = identifier; - } - - /// - /// The source caller Id, a phone number, that's shown to the PSTN participant being invited. - /// Required only when calling a PSTN callee. - /// - public PhoneNumberIdentifierModel CallerId { get; set; } - /// Display name of the call if dialing out to a pstn number. - public string DisplayName { get; set; } - /// The identifier of the source of the call. - public CommunicationIdentifierModel Identifier { get; set; } - } -} 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 4c5907c48e62..847168415cbe 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 @@ -22,8 +22,21 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteObjectValue(item); } writer.WriteEndArray(); - writer.WritePropertyName("source"); - writer.WriteObjectValue(Source); + if (Optional.IsDefined(SourceCallerIdNumber)) + { + writer.WritePropertyName("sourceCallerIdNumber"); + writer.WriteObjectValue(SourceCallerIdNumber); + } + if (Optional.IsDefined(SourceDisplayName)) + { + writer.WritePropertyName("sourceDisplayName"); + writer.WriteStringValue(SourceDisplayName); + } + if (Optional.IsDefined(CallSourceIdentifier)) + { + writer.WritePropertyName("callSourceIdentifier"); + writer.WriteObjectValue(CallSourceIdentifier); + } if (Optional.IsDefined(OperationContext)) { writer.WritePropertyName("operationContext"); 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 f55c3829145a..8b8990a32665 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CreateCallRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CreateCallRequestInternal.cs @@ -18,24 +18,28 @@ internal partial class CreateCallRequestInternal { /// Initializes a new instance of CreateCallRequestInternal. /// The targets of the call. - /// The source of the call. /// The callback URI. - /// , or is null. - public CreateCallRequestInternal(IEnumerable targets, CallSourceInternal source, string callbackUri) + /// or is null. + public CreateCallRequestInternal(IEnumerable targets, string callbackUri) { Argument.AssertNotNull(targets, nameof(targets)); - Argument.AssertNotNull(source, nameof(source)); Argument.AssertNotNull(callbackUri, nameof(callbackUri)); Targets = targets.ToList(); - Source = source; CallbackUri = callbackUri; } /// The targets of the call. public IList Targets { get; } - /// The source of the call. - public CallSourceInternal Source { get; } + /// + /// The source caller Id, a phone number, that's shown to the PSTN participant being invited. + /// Required only when calling a PSTN callee. + /// + public PhoneNumberIdentifierModel SourceCallerIdNumber { get; set; } + /// Display name of the call if dialing out to a pstn number. + public string SourceDisplayName { get; set; } + /// The identifier of the source of the call. + public CommunicationIdentifierModel CallSourceIdentifier { get; set; } /// A customer set value used to track the answering of a call. public string OperationContext { get; set; } /// The callback URI. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CustomContext.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CustomContext.Serialization.cs new file mode 100644 index 000000000000..b541ede48d8e --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CustomContext.Serialization.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.CallAutomation +{ + public partial class CustomContext : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(VoipHeaders)) + { + writer.WritePropertyName("voipHeaders"); + writer.WriteStartObject(); + foreach (var item in VoipHeaders) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(SipHeaders)) + { + writer.WritePropertyName("sipHeaders"); + writer.WriteStartObject(); + foreach (var item in SipHeaders) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CustomContext.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CustomContext.cs new file mode 100644 index 000000000000..fe1f87e3be8a --- /dev/null +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/CustomContext.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Communication.CallAutomation +{ + /// The CustomContext. + public partial class CustomContext + { + /// Initializes a new instance of CustomContext. + public CustomContext() + { + VoipHeaders = new ChangeTrackingDictionary(); + SipHeaders = new ChangeTrackingDictionary(); + } + + /// Dictionary of <string>. + public IDictionary VoipHeaders { get; } + /// Dictionary of <string>. + public IDictionary SipHeaders { get; } + } +} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantsRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantRequestInternal.Serialization.cs similarity index 63% rename from sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantsRequestInternal.Serialization.cs rename to sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantRequestInternal.Serialization.cs index d96dceb5370d..2262796ea08c 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantsRequestInternal.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantRequestInternal.Serialization.cs @@ -10,18 +10,13 @@ namespace Azure.Communication.CallAutomation { - internal partial class RemoveParticipantsRequestInternal : IUtf8JsonSerializable + internal partial class RemoveParticipantRequestInternal : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - writer.WritePropertyName("participantsToRemove"); - writer.WriteStartArray(); - foreach (var item in ParticipantsToRemove) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); + writer.WritePropertyName("participantToRemove"); + writer.WriteObjectValue(ParticipantToRemove); if (Optional.IsDefined(OperationContext)) { writer.WritePropertyName("operationContext"); diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantsRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantRequestInternal.cs similarity index 53% rename from sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantsRequestInternal.cs rename to sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantRequestInternal.cs index d7cfe6df3435..d9ed55c1c915 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantsRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/RemoveParticipantRequestInternal.cs @@ -6,28 +6,26 @@ #nullable disable using System; -using System.Collections.Generic; -using System.Linq; using Azure.Communication; using Azure.Core; namespace Azure.Communication.CallAutomation { /// The remove participant by identifier request. - internal partial class RemoveParticipantsRequestInternal + internal partial class RemoveParticipantRequestInternal { - /// Initializes a new instance of RemoveParticipantsRequestInternal. - /// The participants to be removed from the call. - /// is null. - public RemoveParticipantsRequestInternal(IEnumerable participantsToRemove) + /// Initializes a new instance of RemoveParticipantRequestInternal. + /// The participants to be removed from the call. + /// is null. + public RemoveParticipantRequestInternal(CommunicationIdentifierModel participantToRemove) { - Argument.AssertNotNull(participantsToRemove, nameof(participantsToRemove)); + Argument.AssertNotNull(participantToRemove, nameof(participantToRemove)); - ParticipantsToRemove = participantsToRemove.ToList(); + ParticipantToRemove = participantToRemove; } /// The participants to be removed from the call. - public IList ParticipantsToRemove { get; } + public CommunicationIdentifierModel ParticipantToRemove { 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/TransferToParticipantRequestInternal.Serialization.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TransferToParticipantRequestInternal.Serialization.cs index ba897c5c60d5..50eb7bcc2bee 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 @@ -22,10 +22,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("transfereeCallerId"); writer.WriteObjectValue(TransfereeCallerId); } - if (Optional.IsDefined(UserToUserInformation)) + if (Optional.IsDefined(CustomContext)) { - writer.WritePropertyName("userToUserInformation"); - writer.WriteStringValue(UserToUserInformation); + writer.WritePropertyName("customContext"); + writer.WriteObjectValue(CustomContext); } if (Optional.IsDefined(OperationContext)) { 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 81729282b214..45e4f7ddd241 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TransferToParticipantRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Generated/Models/TransferToParticipantRequestInternal.cs @@ -28,8 +28,8 @@ public TransferToParticipantRequestInternal(CommunicationIdentifierModel targetP public CommunicationIdentifierModel TargetParticipant { get; } /// The caller ID of the transferee when transferring to PSTN. public PhoneNumberIdentifierModel TransfereeCallerId { get; set; } - /// The user to user information. - public string UserToUserInformation { get; set; } + /// Used by customer to send custom context to targets. + public CustomContext CustomContext { get; set; } /// Used by customers when calling mid-call actions to correlate the request to the response event. public string OperationContext { get; set; } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallSourceInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/AddParticipantRequestInternal.cs similarity index 64% rename from sdk/communication/Azure.Communication.CallAutomation/src/Models/CallSourceInternal.cs rename to sdk/communication/Azure.Communication.CallAutomation/src/Models/AddParticipantRequestInternal.cs index 542f10d6066a..611012eca82f 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallSourceInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/AddParticipantRequestInternal.cs @@ -5,8 +5,8 @@ namespace Azure.Communication.CallAutomation { - [CodeGenModel("CallSource")] - internal partial class CallSourceInternal + [CodeGenModel("AddParticipantRequest")] + internal partial class AddParticipantRequestInternal { } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallAutomationModelFactory.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallAutomationModelFactory.cs index 1299faef0d54..6ab94072f6f7 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallAutomationModelFactory.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallAutomationModelFactory.cs @@ -34,15 +34,26 @@ public static AnswerCallResult AnswerCallResult(CallConnection callConnection = /// Initializes a new instance of CallConnectionProperties. /// The call connection id. /// The server call id. - /// The source of the call. /// The targets of the call. /// The state of the call connection. /// The callback URI. + /// Source identity. + /// Caller ID phone number to appear on the invitee. + /// Display name to appear on the invitee. /// The subscriptionId for Media Streaming. /// A new instance for mocking. - public static CallConnectionProperties CallConnectionProperties(string callConnectionId = default, string serverCallId = default, CallSource callSource = default, IEnumerable targets = default, CallConnectionState callConnectionState = default, Uri callbackEndpoint = default, string mediaSubscriptionId = default) + public static CallConnectionProperties CallConnectionProperties( + string callConnectionId = default, + string serverCallId = default, + IEnumerable targets = default, + CallConnectionState callConnectionState = default, + Uri callbackEndpoint = default, + CommunicationIdentifier sourceIdentity = default, + PhoneNumberIdentifier sourceCallerIdNumber = default, + string sourceDisplayName = default, + string mediaSubscriptionId = default) { - return new CallConnectionProperties(callConnectionId, serverCallId, callSource, targets, callConnectionState, callbackEndpoint, mediaSubscriptionId); + return new CallConnectionProperties(callConnectionId, serverCallId, targets, callConnectionState, callbackEndpoint, sourceIdentity, sourceCallerIdNumber, sourceDisplayName, mediaSubscriptionId); } /// Initializes a new instance of CallParticipant. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallConnectionProperties.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallConnectionProperties.cs index 13342d93a152..48a3c36ddf39 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallConnectionProperties.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallConnectionProperties.cs @@ -10,14 +10,26 @@ namespace Azure.Communication.CallAutomation /// The call connection properties. public class CallConnectionProperties { - internal CallConnectionProperties(string callConnectionId, string serverCallId, CallSource callSource, IEnumerable targets, CallConnectionState callConnectionState, Uri callbackEndpoint, string mediaSubscriptionId) + internal CallConnectionProperties( + string callConnectionId, + string serverCallId, + IEnumerable targets, + CallConnectionState callConnectionState, + Uri callbackEndpoint, + CommunicationIdentifier sourceIdentity, + PhoneNumberIdentifier sourceCallerIdNumber, + string sourceDisplayName, + string mediaSubscriptionId + ) { CallConnectionId = callConnectionId; ServerCallId = serverCallId; - CallSource = callSource; Targets = targets == null ? new List() : targets.ToList(); - CallConnectionState = callConnectionState == default(CallConnectionState) ? CallConnectionState.Unknown : callConnectionState; + CallConnectionState = callConnectionState == default ? CallConnectionState.Unknown : callConnectionState; CallbackEndpoint = callbackEndpoint; + SourceIdentity = sourceIdentity; + SourceCallerIdNumber = sourceCallerIdNumber; + SourceDisplayName = sourceDisplayName; MediaSubscriptionId = mediaSubscriptionId; } @@ -25,11 +37,6 @@ internal CallConnectionProperties(CallConnectionPropertiesInternal callConnectio { CallConnectionId = callConnectionPropertiesDtoInternal.CallConnectionId; ServerCallId = callConnectionPropertiesDtoInternal.ServerCallId; - CallSource = new CallSource(CommunicationIdentifierSerializer.Deserialize(callConnectionPropertiesDtoInternal.Source.Identifier)) - { - CallerId = callConnectionPropertiesDtoInternal.Source.CallerId == null ? null : new PhoneNumberIdentifier(callConnectionPropertiesDtoInternal.Source.CallerId.Value), - DisplayName = callConnectionPropertiesDtoInternal.Source.DisplayName, - }; Targets = callConnectionPropertiesDtoInternal.Targets.Select(t => CommunicationIdentifierSerializer.Deserialize(t)).ToList(); if (callConnectionPropertiesDtoInternal.CallConnectionState == null || callConnectionPropertiesDtoInternal.CallConnectionState == default(CallConnectionState)) @@ -43,14 +50,23 @@ internal CallConnectionProperties(CallConnectionPropertiesInternal callConnectio CallbackEndpoint = new Uri(callConnectionPropertiesDtoInternal.CallbackUri); MediaSubscriptionId = callConnectionPropertiesDtoInternal.MediaSubscriptionId; + SourceIdentity = CommunicationIdentifierSerializer.Deserialize(callConnectionPropertiesDtoInternal.SourceIdentity); + SourceDisplayName = callConnectionPropertiesDtoInternal.SourceDisplayName; + + if (callConnectionPropertiesDtoInternal.SourceCallerIdNumber != null) + { + var communicationIdentifierModel = new CommunicationIdentifierModel + { + PhoneNumber = callConnectionPropertiesDtoInternal.SourceCallerIdNumber, + }; + SourceCallerIdNumber = (PhoneNumberIdentifier)CommunicationIdentifierSerializer.Deserialize(communicationIdentifierModel); + } } /// The call connection id. public string CallConnectionId { get; } /// The server call id. public string ServerCallId { get; } - /// The source of the call. - public CallSource CallSource { get; } /// The targets of the call. public IReadOnlyList Targets { get; } /// The state of the call connection. @@ -59,5 +75,17 @@ internal CallConnectionProperties(CallConnectionPropertiesInternal callConnectio public Uri CallbackEndpoint { get; } /// SubscriptionId for media streaming. public string MediaSubscriptionId { get; } + /// + /// Caller ID phone number to appear on the invitee. + /// + public PhoneNumberIdentifier SourceCallerIdNumber { get; } + /// + /// Display name to appear on the invitee. + /// + public string SourceDisplayName { get; } + /// + /// Source identity. + /// + public CommunicationIdentifier SourceIdentity { get; } } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallSource.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallSource.cs deleted file mode 100644 index 7f9734849d00..000000000000 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/CallSource.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; - -namespace Azure.Communication.CallAutomation -{ - /// The CallSource. - public class CallSource - { - /// Initializes a new instance of CallSourceDto. - /// Caller's identifier. - /// is null. - public CallSource(CommunicationIdentifier identifier) - { - if (identifier == null) - { - throw new ArgumentNullException(nameof(identifier)); - } - - Identifier = identifier; - } - - /// The alternate identity of the source of the call if dialing out to a pstn number. - public PhoneNumberIdentifier CallerId { get; set; } - /// Display name of the caller - public string DisplayName { get; set; } - /// Gets the identifier. - public CommunicationIdentifier Identifier { get; } - } -} diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/AddParticipantsRequestInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/RemoveParticipantRequestInternal.cs similarity index 62% rename from sdk/communication/Azure.Communication.CallAutomation/src/Models/AddParticipantsRequestInternal.cs rename to sdk/communication/Azure.Communication.CallAutomation/src/Models/RemoveParticipantRequestInternal.cs index b5f2e2aa0f5a..03652dc64267 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/AddParticipantsRequestInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/RemoveParticipantRequestInternal.cs @@ -5,8 +5,8 @@ namespace Azure.Communication.CallAutomation { - [CodeGenModel("AddParticipantsRequest")] - internal partial class AddParticipantsRequestInternal + [CodeGenModel("RemoveParticipantRequest")] + internal partial class RemoveParticipantRequestInternal { } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/TransferToParticipantOptions.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/TransferToParticipantOptions.cs index 1932c4b32b73..93c0ee9751b1 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/TransferToParticipantOptions.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/TransferToParticipantOptions.cs @@ -13,21 +13,16 @@ public class TransferToParticipantOptions /// /// Creates a new TransferToParticipantOptions object. /// - /// - public TransferToParticipantOptions(CommunicationIdentifier targetParticipant) + /// + public TransferToParticipantOptions(CallInvite callInvite) { - TargetParticipant = targetParticipant; + CallInvite = callInvite; } /// - /// The target participant to transfer the call to. + /// Call invitee information. /// - public CommunicationIdentifier TargetParticipant { get; } - - /// - /// The caller id of the source. - /// - public PhoneNumberIdentifier SourceCallerId { get; set; } + public CallInvite CallInvite { get; } /// /// The UserToUserInformation. diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/autorest.md b/sdk/communication/Azure.Communication.CallAutomation/src/autorest.md index 0299571bf4d1..c0886c1f0d7e 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/autorest.md +++ b/sdk/communication/Azure.Communication.CallAutomation/src/autorest.md @@ -10,7 +10,7 @@ tag: package-2023-01-15-preview model-namespace: false require: - - https://raw.githubusercontent.com/williamzhao87/azure-rest-api-specs/28020b4e9a0479f5dff0026abad47bd01a74d7f9/specification/communication/data-plane/CallAutomation/readme.md + - https://github.com/williamzhao87/azure-rest-api-specs/blob/9daf57a46cf7aea13a10cbfa7f37fe2e4918129b/specification/communication/data-plane/CallAutomation/readme.md title: Azure Communication Services generation1-convenience-client: true diff --git a/sdk/communication/Azure.Communication.CallAutomation/tests/CallAutomationClients/CallAutomationClientTests.cs b/sdk/communication/Azure.Communication.CallAutomation/tests/CallAutomationClients/CallAutomationClientTests.cs index 9a95fad2d35d..909e5d0cc181 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/tests/CallAutomationClients/CallAutomationClientTests.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/tests/CallAutomationClients/CallAutomationClientTests.cs @@ -367,8 +367,7 @@ private static void ValidateCallConnectionProperties(CallConnectionProperties pr Assert.NotNull(properties); Assert.AreEqual("callConnectionId", properties.CallConnectionId); Assert.AreEqual(CallConnectionState.Connecting, properties.CallConnectionState); - Assert.NotNull(properties.CallSource); - Assert.AreEqual("dummySourceUser", properties.CallSource.Identifier.RawId); + Assert.AreEqual("dummySourceUser", properties.SourceIdentity.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 32a308f1f4aa..e6d6c1b3e56f 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/tests/CallConnections/CallConnectionTests.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/tests/CallConnections/CallConnectionTests.cs @@ -124,61 +124,71 @@ public void HangUpCall_404NotFound() } [TestCaseSource(nameof(TestData_TransferCallToParticipant))] - public async Task TransferCallToParticipantAsync_202Accepted(CommunicationIdentifier targetParticipant) + public async Task TransferCallToParticipantAsync_simpleMethod_202Accepted(CallInvite callInvite) { var callConnection = CreateMockCallConnection(202, OperationContextPayload); - var response = await callConnection.TransferCallToParticipantAsync(new TransferToParticipantOptions(targetParticipant)).ConfigureAwait(false); + var response = await callConnection.TransferCallToParticipantAsync(callInvite).ConfigureAwait(false); Assert.AreEqual((int)HttpStatusCode.Accepted, response.GetRawResponse().Status); verifyOperationContext(response); } [TestCaseSource(nameof(TestData_TransferCallToParticipant))] - public void TransferCallToParticipant_202Accepted(CommunicationIdentifier targetParticipant) + public async Task TransferCallToParticipantAsync_202Accepted(CallInvite callInvite) { var callConnection = CreateMockCallConnection(202, OperationContextPayload); - var response = callConnection.TransferCallToParticipant(new TransferToParticipantOptions(targetParticipant)); + var response = await callConnection.TransferCallToParticipantAsync(new TransferToParticipantOptions(callInvite)).ConfigureAwait(false); Assert.AreEqual((int)HttpStatusCode.Accepted, response.GetRawResponse().Status); verifyOperationContext(response); } [TestCaseSource(nameof(TestData_TransferCallToParticipant))] - public void TransferCallToParticipantAsync_404NotFound(CommunicationIdentifier targetParticipant) + public void TransferCallToParticipant_simpleMethod_202Accepted(CallInvite callInvite) { - var callConnection = CreateMockCallConnection(404); + var callConnection = CreateMockCallConnection(202, OperationContextPayload); - RequestFailedException? ex = Assert.ThrowsAsync(async () => await callConnection.TransferCallToParticipantAsync(new TransferToParticipantOptions(targetParticipant)).ConfigureAwait(false)); - Assert.NotNull(ex); - Assert.AreEqual(ex?.Status, 404); + var response = callConnection.TransferCallToParticipant(callInvite); + Assert.AreEqual((int)HttpStatusCode.Accepted, response.GetRawResponse().Status); + verifyOperationContext(response); } [TestCaseSource(nameof(TestData_TransferCallToParticipant))] - public void TransferCallToParticipant_404NotFound(CommunicationIdentifier targetParticipant) + public void TransferCallToParticipant_202Accepted(CallInvite callInvite) + { + var callConnection = CreateMockCallConnection(202, OperationContextPayload); + + var response = callConnection.TransferCallToParticipant(new TransferToParticipantOptions(callInvite)); + Assert.AreEqual((int)HttpStatusCode.Accepted, response.GetRawResponse().Status); + verifyOperationContext(response); + } + + [TestCaseSource(nameof(TestData_TransferCallToParticipant))] + public void TransferCallToParticipantAsync_404NotFound(CallInvite callInvite) { var callConnection = CreateMockCallConnection(404); - RequestFailedException? ex = Assert.Throws(() => callConnection.TransferCallToParticipant(new TransferToParticipantOptions(targetParticipant))); + RequestFailedException? ex = Assert.ThrowsAsync(async () => await callConnection.TransferCallToParticipantAsync(new TransferToParticipantOptions(callInvite)).ConfigureAwait(false)); Assert.NotNull(ex); Assert.AreEqual(ex?.Status, 404); } - [TestCaseSource(nameof(TestData_TransferCallToParticipant_NoCallerId))] - public void TransferCallToParticipant_NoCallerIdValidation(CommunicationIdentifier targetParticipant) + [TestCaseSource(nameof(TestData_TransferCallToParticipant))] + public void TransferCallToParticipant_404NotFound(CallInvite callInvite) { - var callConnection = CreateMockCallConnection(202); + var callConnection = CreateMockCallConnection(404); - ArgumentNullException? ex = Assert.Throws(() => callConnection.TransferCallToParticipant(new TransferToParticipantOptions(targetParticipant))); + RequestFailedException? ex = Assert.Throws(() => callConnection.TransferCallToParticipant(new TransferToParticipantOptions(callInvite))); Assert.NotNull(ex); - Assert.True(ex?.Message.Contains("Value cannot be null.")); + Assert.AreEqual(ex?.Status, 404); } [TestCaseSource(nameof(TestData_TransferCallToParticipant))] - public void TransferCallToParticipant_ExceedsMaxOperationContextLength(CommunicationIdentifier targetParticipant) + public void TransferCallToParticipant_ExceedsMaxOperationContextLength(CallInvite callInvite) { var callConnection = CreateMockCallConnection(202); - var options = new TransferToParticipantOptions(targetParticipant) { + var options = new TransferToParticipantOptions(callInvite) { OperationContext = new string('a', 1 + CallAutomationConstants.InputValidation.StringMaxLength) }; ArgumentException? ex = Assert.Throws(() => callConnection.TransferCallToParticipant(options)); @@ -187,11 +197,11 @@ public void TransferCallToParticipant_ExceedsMaxOperationContextLength(Communica } [TestCaseSource(nameof(TestData_TransferCallToParticipant))] - public void TransferCallToParticipant_ExceedsMaxUserToUserInformationLengthLength(CommunicationIdentifier targetParticipant) + public void TransferCallToParticipant_ExceedsMaxUserToUserInformationLengthLength(CallInvite callInvite) { var callConnection = CreateMockCallConnection(202); - var options = new TransferToParticipantOptions(targetParticipant) + var options = new TransferToParticipantOptions(callInvite) { UserToUserInformation = new string('a', 1 + CallAutomationConstants.InputValidation.StringMaxLength) }; @@ -585,18 +595,7 @@ private CallConnection CreateMockCallConnection(int responseCode, string? respon { new object?[] { - new CommunicationUserIdentifier("userId") - }, - }; - } - - private static IEnumerable TestData_TransferCallToParticipant_NoCallerId() - { - return new[] - { - new object?[] - { - new PhoneNumberIdentifier("+123456") + new CallInvite(new CommunicationUserIdentifier("userId")) }, }; } diff --git a/sdk/communication/Azure.Communication.CallAutomation/tests/EventProcessors/ResultWithEventProcessorTests.cs b/sdk/communication/Azure.Communication.CallAutomation/tests/EventProcessors/ResultWithEventProcessorTests.cs index f93ad7a5bac2..76b021ec1c99 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/tests/EventProcessors/ResultWithEventProcessorTests.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/tests/EventProcessors/ResultWithEventProcessorTests.cs @@ -134,7 +134,8 @@ public async Task TransferCallEventResultSuccessTest() var callConnection = CreateMockCallConnection(successCode, TransferCallOrRemoveParticipantsPayload); EventProcessor handler = callConnection.EventProcessor; - var response = callConnection.TransferCallToParticipant(new TransferToParticipantOptions(new CommunicationUserIdentifier(TargetUser))); + var callInvite = new CallInvite(new CommunicationUserIdentifier(TargetUser)); + var response = callConnection.TransferCallToParticipant(new TransferToParticipantOptions(callInvite)); Assert.AreEqual(successCode, response.GetRawResponse().Status); // Create and send event to event processor @@ -160,7 +161,8 @@ public async Task TransferCallEventResultFailedTest() var callConnection = CreateMockCallConnection(successCode, TransferCallOrRemoveParticipantsPayload); EventProcessor handler = callConnection.EventProcessor; - var response = callConnection.TransferCallToParticipant(new TransferToParticipantOptions(new CommunicationUserIdentifier(TargetUser))); + var callInvite = new CallInvite(new CommunicationUserIdentifier(TargetUser)); + var response = callConnection.TransferCallToParticipant(new TransferToParticipantOptions(callInvite)); Assert.AreEqual(successCode, response.GetRawResponse().Status); // Create and send event to event processor diff --git a/sdk/communication/Azure.Communication.CallAutomation/tests/Infrastructure/CallAutomationEventProcessorTestBase.cs b/sdk/communication/Azure.Communication.CallAutomation/tests/Infrastructure/CallAutomationEventProcessorTestBase.cs index cff4e2d824b0..af49930d3ffa 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/tests/Infrastructure/CallAutomationEventProcessorTestBase.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/tests/Infrastructure/CallAutomationEventProcessorTestBase.cs @@ -29,7 +29,7 @@ public abstract class CallAutomationEventProcessorTestBase protected string CreateOrAnswerCallOrGetCallConnectionPayload = string.Format(DummyPayload, NoneMediaSubscriptionId); protected string CreateOrAnswerCallOrGetCallConnectionWithMediaSubscriptionPayload = string.Format(DummyPayload, MediaSubscriptionId); - protected const string DummyPayload = "{{\"callConnectionId\": \"someCallConnectionId\",\"serverCallId\": \"someServerCallId\",\"targets\": [{{\"rawId\":\"targetId\",\"kind\":\"communicationUser\",\"communicationUser\":{{\"id\":\"targetId\"}}}}],\"source\": {{\"identifier\":{{\"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\"}}}}],\"sourceIdentity\":{{\"rawId\":\"sourceId\",\"kind\":\"communicationUser\",\"communicationUser\":{{\"id\":\"sourceId\"}}}},\"callConnectionState\": \"connecting\",\"subject\": \"dummySubject\",\"callbackUri\": \"https://bot.contoso.com/callback\",\"mediaSubscriptionId\": {0}}}"; protected const string TransferCallOrRemoveParticipantsPayload = "{\"operationContext\": \"someOperationContext\"}"; @@ -85,31 +85,6 @@ protected CallConnection CreateMoakCallConnection(string? callConnectionId = def return callconn; } - protected CallConnectionProperties CreateMoakCallConnectionProperties( - string? callConnectionId = default, - string? servercallId = default, - CallSource? source = default, - IEnumerable? targets = default, - CallConnectionState connectionState = default) - { - CallConnectionProperties callconnprops = new CallConnectionProperties( - callConnectionId == default ? CallConnectionId : callConnectionId, - servercallId == default ? ServerCallId : servercallId, - source == default ? CreateMoakCallSource() : source, - targets == default ? CreateMoakTargets() : targets, - connectionState == default ? CallConnectionState.Unknown : connectionState, - null, null); - - return callconnprops; - } - - protected CallSource CreateMoakCallSource(CommunicationIdentifier? identifier = default) - { - var callsource = new CallSource(identifier == default ? new CommunicationUserIdentifier(SourceUser) : identifier); - - return callsource; - } - protected IEnumerable CreateMoakTargets(IEnumerable? targets = default) { var targetsOutput = targets == default ? new List { new CommunicationUserIdentifier(TargetUser) } : targets; diff --git a/sdk/communication/Azure.Communication.CallAutomation/tests/Infrastructure/CallAutomationTestBase.cs b/sdk/communication/Azure.Communication.CallAutomation/tests/Infrastructure/CallAutomationTestBase.cs index 69620d529504..47c930055b84 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/tests/Infrastructure/CallAutomationTestBase.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/tests/Infrastructure/CallAutomationTestBase.cs @@ -21,14 +21,12 @@ public class CallAutomationTestBase "\"communicationUser\":{{\"id\":\"targetId\"}}" + "}}" + "]," + - "\"source\": {{" + - "\"displayName\": \"displayName\"," + - "\"identifier\":{{" + + "\"sourceDisplayName\": \"displayName\"," + + "\"sourceIdentity\":{{" + "\"rawId\":\"sourceId\"," + "\"kind\":\"communicationUser\"," + "\"communicationUser\":{{\"id\":\"sourceId\"}}" + - "}}" + - "}}," + + "}}," + "\"callConnectionState\": \"connecting\"," + "\"subject\": \"dummySubject\"," + "\"callbackUri\": \"https://bot.contoso.com/callback\"," + @@ -93,14 +91,14 @@ protected void verifyCallConnectionProperties(CallConnectionProperties callConne { Assert.AreEqual(CallConnectionId, callConnectionProperties.CallConnectionId); Assert.AreEqual(ServerCallId, callConnectionProperties.ServerCallId); - var sourceUser = (CommunicationUserIdentifier)callConnectionProperties.CallSource.Identifier; + var sourceUser = (CommunicationUserIdentifier)callConnectionProperties.SourceIdentity; Assert.AreEqual(SourceId, sourceUser.Id); Assert.AreEqual(callConnectionProperties.Targets.Count, 1); var targetUser = (CommunicationUserIdentifier)callConnectionProperties.Targets[0]; Assert.AreEqual(TargetId, targetUser.Id); Assert.AreEqual(CallConnectionState.Connecting, callConnectionProperties.CallConnectionState); Assert.AreEqual(CallBackUri, callConnectionProperties.CallbackEndpoint.ToString()); - Assert.AreEqual(DisplayName, callConnectionProperties.CallSource.DisplayName); + Assert.AreEqual(DisplayName, callConnectionProperties.SourceDisplayName); } } }