diff --git a/sdk/communication/Azure.Communication.CallingServer/samples/Sample1_CreateCallAsync.md b/sdk/communication/Azure.Communication.CallingServer/samples/Sample1_CreateCallAsync.md index b9907c42bc18..aa896a3d7e66 100644 --- a/sdk/communication/Azure.Communication.CallingServer/samples/Sample1_CreateCallAsync.md +++ b/sdk/communication/Azure.Communication.CallingServer/samples/Sample1_CreateCallAsync.md @@ -4,7 +4,7 @@ This sample demonstrates how to make a call to a recipient phone number. To get started you'll need a Communication Service Resource. See [README][README] for prerequisites and instructions. -## Creating an `ServerCallingClient` +## Creating a `ServerCallingClient` Server Calling clients can be authenticated using the connection string acquired from an Azure Communication Resource in the Azure Portal. diff --git a/sdk/communication/Azure.Communication.CallingServer/src/CallConnection.cs b/sdk/communication/Azure.Communication.CallingServer/src/CallConnection.cs index dd3b62da66b1..393f3dfe3276 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/CallConnection.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/CallConnection.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Azure.Core; @@ -84,7 +83,7 @@ public virtual Response Hangup(CancellationToken cancellationToken = default) /// The operation context. /// The cancellation token. /// The server returned an error. See for details returned from the server. - public virtual async Task> CancelAllMediaOperationsAsync(string operationContext = null, CancellationToken cancellationToken = default) + public virtual async Task> CancelAllMediaOperationsAsync(string operationContext = null, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallConnection)}.{nameof(CancelAllMediaOperations)}"); scope.Start(); @@ -107,7 +106,7 @@ public virtual async Task> CancelAllM /// The operation context. /// The cancellation token. /// The server returned an error. See for details returned from the server. - public virtual Response CancelAllMediaOperations(string operationContext = null, CancellationToken cancellationToken = default) + public virtual Response CancelAllMediaOperations(string operationContext = null, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallConnection)}.{nameof(CancelAllMediaOperations)}"); scope.Start(); @@ -134,7 +133,7 @@ public virtual Response CancelAllMediaOperatio /// The operation context. /// The cancellation token to use. /// The server returned an error. See for details returned from the server. - public virtual async Task> PlayAudioAsync(Uri audioFileUri, bool? loop, string audioFileId, Uri callbackUri, string operationContext = null, CancellationToken cancellationToken = default) + public virtual async Task> PlayAudioAsync(Uri audioFileUri, bool? loop, string audioFileId, Uri callbackUri, string operationContext = null, CancellationToken cancellationToken = default) => await PlayAudioAsync( options: new PlayAudioOptions { AudioFileUri = audioFileUri, @@ -151,7 +150,7 @@ public virtual async Task> PlayAudioAsync(Uri audioF /// The cancellation token. /// The server returned an error. See for details returned from the server. /// is null. - public virtual async Task> PlayAudioAsync(PlayAudioOptions options, CancellationToken cancellationToken = default) + public virtual async Task> PlayAudioAsync(PlayAudioOptions options, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallConnection)}.{nameof(PlayAudio)}"); scope.Start(); @@ -184,7 +183,7 @@ public virtual async Task> PlayAudioAsync(PlayAudioO /// The operation context. /// The cancellation token to use. /// The server returned an error. See for details returned from the server. - public virtual Response PlayAudio(Uri audioFileUri, bool? loop, string audioFileId, Uri callbackUri, string operationContext = null, CancellationToken cancellationToken = default) + public virtual Response PlayAudio(Uri audioFileUri, bool? loop, string audioFileId, Uri callbackUri, string operationContext = null, CancellationToken cancellationToken = default) => PlayAudio( options: new PlayAudioOptions { AudioFileUri = audioFileUri, @@ -201,7 +200,7 @@ public virtual Response PlayAudio(Uri audioFileUri, bool? loo /// The cancellation token. /// The server returned an error. See for details returned from the server. /// is null. - public virtual Response PlayAudio(PlayAudioOptions options, CancellationToken cancellationToken = default) + public virtual Response PlayAudio(PlayAudioOptions options, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallConnection)}.{nameof(PlayAudio)}"); scope.Start(); @@ -243,7 +242,7 @@ public virtual async Task AddParticipantAsync(CommunicationIdentifier return await RestClient.InviteParticipantsAsync( callConnectionId: CallConnectionId, - participants: new List() { CommunicationIdentifierSerializer.Serialize(participant) }, + participants: new[] { CommunicationIdentifierSerializer.Serialize(participant) }, alternateCallerId: alternateCallerId == null ? null : new PhoneNumberIdentifierModel(alternateCallerId), operationContext: operationContext, callbackUri: null, @@ -274,7 +273,7 @@ public virtual Response AddParticipant(CommunicationIdentifier participant, stri return RestClient.InviteParticipants( callConnectionId: CallConnectionId, - participants: new List() { CommunicationIdentifierSerializer.Serialize(participant) }, + participants: new[] { CommunicationIdentifierSerializer.Serialize(participant) }, alternateCallerId: alternateCallerId == null ? null : new PhoneNumberIdentifierModel(alternateCallerId), operationContext: operationContext, callbackUri: null, diff --git a/sdk/communication/Azure.Communication.CallingServer/src/CallingServerClient.cs b/sdk/communication/Azure.Communication.CallingServer/src/CallingServerClient.cs index 806bcceba1a6..7a0a5719b522 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/CallingServerClient.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/CallingServerClient.cs @@ -25,7 +25,7 @@ public class CallingServerClient internal CallConnectionRestClient CallConnectionRestClient { get; } internal ServerCallRestClient ServerCallRestClient { get; } - #region public constructors - all arguments need null check + #region public constructors /// Initializes a new instance of . /// Connection string acquired from the Azure Communication Services resource. @@ -36,28 +36,6 @@ public CallingServerClient(string connectionString, CallingServerClientOptions o options ?? new CallingServerClientOptions()) { } - /// Initializes a new instance of . - /// The URI of the Azure Communication Services resource. - /// The used to authenticate requests. - /// Client option exposing , , , etc. - public CallingServerClient(Uri endpoint, AzureKeyCredential keyCredential, CallingServerClientOptions options = default) - : this( - Argument.CheckNotNull(endpoint, nameof(endpoint)).AbsoluteUri, - Argument.CheckNotNull(keyCredential, nameof(keyCredential)), - options ?? new CallingServerClientOptions()) - { } - - /// Initializes a new instance of . - /// The URI of the Azure Communication Services resource. - /// The TokenCredential used to authenticate requests, such as DefaultAzureCredential. - /// Client option exposing , , , etc. - public CallingServerClient(Uri endpoint, TokenCredential tokenCredential, CallingServerClientOptions options = default) - : this( - Argument.CheckNotNull(endpoint, nameof(endpoint)).AbsoluteUri, - Argument.CheckNotNull(tokenCredential, nameof(tokenCredential)), - options ?? new CallingServerClientOptions()) - { } - #endregion #region private constructors @@ -188,9 +166,9 @@ public virtual Response CreateCallConnection(CommunicationIdenti /// is null. /// is null. /// is null. - public virtual async Task> JoinCallConnectionAsync(string serverCallId, CommunicationIdentifier source, JoinCallOptions callOptions, CancellationToken cancellationToken = default) + public virtual async Task> JoinCallAsync(string serverCallId, CommunicationIdentifier source, JoinCallOptions callOptions, CancellationToken cancellationToken = default) { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallingServerClient)}.{nameof(JoinCallConnection)}"); + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallingServerClient)}.{nameof(JoinCall)}"); scope.Start(); try { @@ -227,9 +205,9 @@ public virtual async Task> JoinCallConnectionAsync(stri /// is null. /// is null. /// is null. - public virtual Response JoinCallConnection(string serverCallId, CommunicationIdentifier source, JoinCallOptions callOptions, CancellationToken cancellationToken = default) + public virtual Response JoinCall(string serverCallId, CommunicationIdentifier source, JoinCallOptions callOptions, CancellationToken cancellationToken = default) { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallingServerClient)}.{nameof(JoinCallConnection)}"); + using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallingServerClient)}.{nameof(JoinCall)}"); scope.Start(); try { diff --git a/sdk/communication/Azure.Communication.CallingServer/src/CallingServerClientOptions.cs b/sdk/communication/Azure.Communication.CallingServer/src/CallingServerClientOptions.cs index 2d7e72349852..ad8bb959d0b8 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/CallingServerClientOptions.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/CallingServerClientOptions.cs @@ -14,7 +14,7 @@ public class CallingServerClientOptions : ClientOptions /// /// The latest version of the CallingServer service. /// - public const ServiceVersion LatestVersion = ServiceVersion.V2021_06_15_Preview; + internal const ServiceVersion LatestVersion = ServiceVersion.V2021_06_15_Preview; internal string ApiVersion { get; } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/CallConnectionRestClient.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/CallConnectionRestClient.cs index 4bd53050eadb..12ea8c19444a 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/CallConnectionRestClient.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/CallConnectionRestClient.cs @@ -96,7 +96,7 @@ internal HttpMessage CreateCreateCallRequest(IEnumerable The requested call events to subscribe to. /// The cancellation token to use. /// , , or is null. - public async Task> CreateCallAsync(IEnumerable targets, CommunicationIdentifierModel source, string callbackUri, PhoneNumberIdentifierModel alternateCallerId = null, string subject = null, IEnumerable requestedMediaTypes = null, IEnumerable requestedCallEvents = null, CancellationToken cancellationToken = default) + public async Task> CreateCallAsync(IEnumerable targets, CommunicationIdentifierModel source, string callbackUri, PhoneNumberIdentifierModel alternateCallerId = null, string subject = null, IEnumerable requestedMediaTypes = null, IEnumerable requestedCallEvents = null, CancellationToken cancellationToken = default) { if (targets == null) { @@ -117,9 +117,9 @@ public async Task> CreateCallAsync(IEnumerable> CreateCallAsync(IEnumerable The requested call events to subscribe to. /// The cancellation token to use. /// , , or is null. - public Response CreateCall(IEnumerable targets, CommunicationIdentifierModel source, string callbackUri, PhoneNumberIdentifierModel alternateCallerId = null, string subject = null, IEnumerable requestedMediaTypes = null, IEnumerable requestedCallEvents = null, CancellationToken cancellationToken = default) + public Response CreateCall(IEnumerable targets, CommunicationIdentifierModel source, string callbackUri, PhoneNumberIdentifierModel alternateCallerId = null, string subject = null, IEnumerable requestedMediaTypes = null, IEnumerable requestedCallEvents = null, CancellationToken cancellationToken = default) { if (targets == null) { @@ -158,9 +158,9 @@ public Response CreateCall(IEnumerable The callback Uri to receive PlayAudio status notifications. /// The cancellation token to use. /// is null. - public async Task> PlayAudioAsync(string callConnectionId, string audioFileUri = null, bool? loop = null, string operationContext = null, string audioFileId = null, string callbackUri = null, CancellationToken cancellationToken = default) + public async Task> PlayAudioAsync(string callConnectionId, string audioFileUri = null, bool? loop = null, string operationContext = null, string audioFileId = null, string callbackUri = null, CancellationToken cancellationToken = default) { if (callConnectionId == null) { @@ -286,9 +286,9 @@ public async Task> PlayAudioAsync(string callConnect { case 202: { - PlayAudioResponse value = default; + PlayAudioResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = PlayAudioResponse.DeserializePlayAudioResponse(document.RootElement); + value = PlayAudioResult.DeserializePlayAudioResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -313,7 +313,7 @@ public async Task> PlayAudioAsync(string callConnect /// The callback Uri to receive PlayAudio status notifications. /// The cancellation token to use. /// is null. - public Response PlayAudio(string callConnectionId, string audioFileUri = null, bool? loop = null, string operationContext = null, string audioFileId = null, string callbackUri = null, CancellationToken cancellationToken = default) + public Response PlayAudio(string callConnectionId, string audioFileUri = null, bool? loop = null, string operationContext = null, string audioFileId = null, string callbackUri = null, CancellationToken cancellationToken = default) { if (callConnectionId == null) { @@ -326,9 +326,9 @@ public Response PlayAudio(string callConnectionId, string aud { case 202: { - PlayAudioResponse value = default; + PlayAudioResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = PlayAudioResponse.DeserializePlayAudioResponse(document.RootElement); + value = PlayAudioResult.DeserializePlayAudioResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -365,7 +365,7 @@ internal HttpMessage CreateCancelAllMediaOperationsRequest(string callConnection /// The context for this operation. /// The cancellation token to use. /// is null. - public async Task> CancelAllMediaOperationsAsync(string callConnectionId, string operationContext = null, CancellationToken cancellationToken = default) + public async Task> CancelAllMediaOperationsAsync(string callConnectionId, string operationContext = null, CancellationToken cancellationToken = default) { if (callConnectionId == null) { @@ -378,9 +378,9 @@ public async Task> CancelAllMediaOper { case 200: { - CancelAllMediaOperationsResponse value = default; + CancelAllMediaOperationsResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = CancelAllMediaOperationsResponse.DeserializeCancelAllMediaOperationsResponse(document.RootElement); + value = CancelAllMediaOperationsResult.DeserializeCancelAllMediaOperationsResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -393,7 +393,7 @@ public async Task> CancelAllMediaOper /// The context for this operation. /// The cancellation token to use. /// is null. - public Response CancelAllMediaOperations(string callConnectionId, string operationContext = null, CancellationToken cancellationToken = default) + public Response CancelAllMediaOperations(string callConnectionId, string operationContext = null, CancellationToken cancellationToken = default) { if (callConnectionId == null) { @@ -406,9 +406,9 @@ public Response CancelAllMediaOperations(strin { case 200: { - CancelAllMediaOperationsResponse value = default; + CancelAllMediaOperationsResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = CancelAllMediaOperationsResponse.DeserializeCancelAllMediaOperationsResponse(document.RootElement); + value = CancelAllMediaOperationsResult.DeserializeCancelAllMediaOperationsResult(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/AzureCommunicationCallingServerServiceModelFactory.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/CallingServerModelFactory.cs similarity index 57% rename from sdk/communication/Azure.Communication.CallingServer/src/Generated/AzureCommunicationCallingServerServiceModelFactory.cs rename to sdk/communication/Azure.Communication.CallingServer/src/Generated/CallingServerModelFactory.cs index 1ad0492e0f30..2c5e4686586f 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/AzureCommunicationCallingServerServiceModelFactory.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/CallingServerModelFactory.cs @@ -8,25 +8,25 @@ namespace Azure.Communication.CallingServer { /// Model factory for read-only models. - public static partial class AzureCommunicationCallingServerServiceModelFactory + internal static partial class CallingServerModelFactory { - /// Initializes new instance of CreateCallResponse class. + /// Initializes new instance of CreateCallResult class. /// The call connection id. - /// A new instance for mocking. - public static CreateCallResponse CreateCallResponse(string callConnectionId = default) + /// A new instance for mocking. + public static CreateCallResult CreateCallResult(string callConnectionId = default) { - return new CreateCallResponse(callConnectionId); + return new CreateCallResult(callConnectionId); } - /// Initializes new instance of PlayAudioResponse class. + /// Initializes new instance of PlayAudioResult class. /// Gets or sets the identifier. /// Gets or sets the status of the operation. /// Gets or sets the operation context. /// Gets or sets the result info. - /// A new instance for mocking. - public static PlayAudioResponse PlayAudioResponse(string id = default, OperationStatus? status = default, string operationContext = default, ResultInfo resultInfo = default) + /// A new instance for mocking. + public static PlayAudioResult PlayAudioResult(string id = default, OperationStatus? status = default, string operationContext = default, ResultInfo resultInfo = default) { - return new PlayAudioResponse(id, status, operationContext, resultInfo); + return new PlayAudioResult(id, status, operationContext, resultInfo); } /// Initializes new instance of ResultInfo class. @@ -51,39 +51,39 @@ public static ResultInfo ResultInfo(int? code = default, int? subcode = default, return new ResultInfo(code, subcode, message); } - /// Initializes new instance of CancelAllMediaOperationsResponse class. + /// Initializes new instance of CancelAllMediaOperationsResult class. /// Gets or sets the identifier. /// Gets or sets the status of the operation. /// Gets or sets the operation context. /// Gets or sets the result info. - /// A new instance for mocking. - public static CancelAllMediaOperationsResponse CancelAllMediaOperationsResponse(string id = default, OperationStatus? status = default, string operationContext = default, ResultInfo resultInfo = default) + /// A new instance for mocking. + public static CancelAllMediaOperationsResult CancelAllMediaOperationsResult(string id = default, OperationStatus? status = default, string operationContext = default, ResultInfo resultInfo = default) { - return new CancelAllMediaOperationsResponse(id, status, operationContext, resultInfo); + return new CancelAllMediaOperationsResult(id, status, operationContext, resultInfo); } - /// Initializes new instance of StartCallRecordingResponse class. + /// Initializes new instance of StartCallRecordingResult class. /// The recording id of the started recording. - /// A new instance for mocking. - public static StartCallRecordingResponse StartCallRecordingResponse(string recordingId = default) + /// A new instance for mocking. + public static StartCallRecordingResult StartCallRecordingResult(string recordingId = default) { - return new StartCallRecordingResponse(recordingId); + return new StartCallRecordingResult(recordingId); } - /// Initializes new instance of GetCallRecordingStateResponse class. + /// Initializes new instance of CallRecordingStateResult class. /// The recording state of the recording. - /// A new instance for mocking. - public static GetCallRecordingStateResponse GetCallRecordingStateResponse(CallRecordingState? recordingState = default) + /// A new instance for mocking. + public static CallRecordingStateResult CallRecordingStateResult(CallRecordingState? recordingState = default) { - return new GetCallRecordingStateResponse(recordingState); + return new CallRecordingStateResult(recordingState); } - /// Initializes new instance of JoinCallResponse class. + /// Initializes new instance of JoinCallResult class. /// The call connection id. - /// A new instance for mocking. - public static JoinCallResponse JoinCallResponse(string callConnectionId = default) + /// A new instance for mocking. + public static JoinCallResult JoinCallResult(string callConnectionId = default) { - return new JoinCallResponse(callConnectionId); + return new JoinCallResult(callConnectionId); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/GetCallRecordingStateResponse.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallRecordingStateResult.Serialization.cs similarity index 76% rename from sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/GetCallRecordingStateResponse.Serialization.cs rename to sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallRecordingStateResult.Serialization.cs index c004a26399d0..625173f46830 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/GetCallRecordingStateResponse.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallRecordingStateResult.Serialization.cs @@ -10,9 +10,9 @@ namespace Azure.Communication.CallingServer { - public partial class GetCallRecordingStateResponse + public partial class CallRecordingStateResult { - internal static GetCallRecordingStateResponse DeserializeGetCallRecordingStateResponse(JsonElement element) + internal static CallRecordingStateResult DeserializeCallRecordingStateResult(JsonElement element) { Optional recordingState = default; foreach (var property in element.EnumerateObject()) @@ -28,7 +28,7 @@ internal static GetCallRecordingStateResponse DeserializeGetCallRecordingStateRe continue; } } - return new GetCallRecordingStateResponse(Optional.ToNullable(recordingState)); + return new CallRecordingStateResult(Optional.ToNullable(recordingState)); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/GetCallRecordingStateResponse.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallRecordingStateResult.cs similarity index 61% rename from sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/GetCallRecordingStateResponse.cs rename to sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallRecordingStateResult.cs index ea34da593ec1..1e948fedc254 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/GetCallRecordingStateResponse.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CallRecordingStateResult.cs @@ -8,16 +8,16 @@ namespace Azure.Communication.CallingServer { /// The response payload of get call recording state operation. - public partial class GetCallRecordingStateResponse + public partial class CallRecordingStateResult { - /// Initializes a new instance of GetCallRecordingStateResponse. - internal GetCallRecordingStateResponse() + /// Initializes a new instance of CallRecordingStateResult. + internal CallRecordingStateResult() { } - /// Initializes a new instance of GetCallRecordingStateResponse. + /// Initializes a new instance of CallRecordingStateResult. /// The recording state of the recording. - internal GetCallRecordingStateResponse(CallRecordingState? recordingState) + internal CallRecordingStateResult(CallRecordingState? recordingState) { RecordingState = recordingState; } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CancelAllMediaOperationsResponse.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CancelAllMediaOperationsResult.Serialization.cs similarity index 84% rename from sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CancelAllMediaOperationsResponse.Serialization.cs rename to sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CancelAllMediaOperationsResult.Serialization.cs index 90342df4e832..7ac87c6c9707 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CancelAllMediaOperationsResponse.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CancelAllMediaOperationsResult.Serialization.cs @@ -10,9 +10,9 @@ namespace Azure.Communication.CallingServer { - public partial class CancelAllMediaOperationsResponse + public partial class CancelAllMediaOperationsResult { - internal static CancelAllMediaOperationsResponse DeserializeCancelAllMediaOperationsResponse(JsonElement element) + internal static CancelAllMediaOperationsResult DeserializeCancelAllMediaOperationsResult(JsonElement element) { Optional id = default; Optional status = default; @@ -51,7 +51,7 @@ internal static CancelAllMediaOperationsResponse DeserializeCancelAllMediaOperat continue; } } - return new CancelAllMediaOperationsResponse(id.Value, Optional.ToNullable(status), operationContext.Value, resultInfo.Value); + return new CancelAllMediaOperationsResult(id.Value, Optional.ToNullable(status), operationContext.Value, resultInfo.Value); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CancelAllMediaOperationsResponse.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CancelAllMediaOperationsResult.cs similarity index 81% rename from sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CancelAllMediaOperationsResponse.cs rename to sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CancelAllMediaOperationsResult.cs index 398ee1603d9c..55314376a885 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CancelAllMediaOperationsResponse.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CancelAllMediaOperationsResult.cs @@ -8,19 +8,19 @@ namespace Azure.Communication.CallingServer { /// The response payload of the cancel all media operations. - public partial class CancelAllMediaOperationsResponse + public partial class CancelAllMediaOperationsResult { - /// Initializes a new instance of CancelAllMediaOperationsResponse. - internal CancelAllMediaOperationsResponse() + /// Initializes a new instance of CancelAllMediaOperationsResult. + internal CancelAllMediaOperationsResult() { } - /// Initializes a new instance of CancelAllMediaOperationsResponse. + /// Initializes a new instance of CancelAllMediaOperationsResult. /// Gets or sets the identifier. /// Gets or sets the status of the operation. /// Gets or sets the operation context. /// Gets or sets the result info. - internal CancelAllMediaOperationsResponse(string id, OperationStatus? status, string operationContext, ResultInfo resultInfo) + internal CancelAllMediaOperationsResult(string id, OperationStatus? status, string operationContext, ResultInfo resultInfo) { Id = id; Status = status; diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/JoinCallResponse.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CreateCallResult.Serialization.cs similarity index 75% rename from sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/JoinCallResponse.Serialization.cs rename to sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CreateCallResult.Serialization.cs index 44d77b3d9e61..2418fc36a73d 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/JoinCallResponse.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CreateCallResult.Serialization.cs @@ -10,9 +10,9 @@ namespace Azure.Communication.CallingServer { - public partial class JoinCallResponse + public partial class CreateCallResult { - internal static JoinCallResponse DeserializeJoinCallResponse(JsonElement element) + internal static CreateCallResult DeserializeCreateCallResult(JsonElement element) { Optional callConnectionId = default; foreach (var property in element.EnumerateObject()) @@ -23,7 +23,7 @@ internal static JoinCallResponse DeserializeJoinCallResponse(JsonElement element continue; } } - return new JoinCallResponse(callConnectionId.Value); + return new CreateCallResult(callConnectionId.Value); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CreateCallResponse.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CreateCallResult.cs similarity index 78% rename from sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CreateCallResponse.cs rename to sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CreateCallResult.cs index c2b1c3abf896..29488a7a7a5b 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CreateCallResponse.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CreateCallResult.cs @@ -8,16 +8,16 @@ namespace Azure.Communication.CallingServer { /// The response payload of the create call operation. - public partial class CreateCallResponse + public partial class CreateCallResult { - /// Initializes a new instance of CreateCallResponse. - internal CreateCallResponse() + /// Initializes a new instance of CreateCallResult. + internal CreateCallResult() { } - /// Initializes a new instance of CreateCallResponse. + /// Initializes a new instance of CreateCallResult. /// The call connection id. - internal CreateCallResponse(string callConnectionId) + internal CreateCallResult(string callConnectionId) { CallConnectionId = callConnectionId; } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CreateCallResponse.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/JoinCallResult.Serialization.cs similarity index 74% rename from sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CreateCallResponse.Serialization.cs rename to sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/JoinCallResult.Serialization.cs index 03b04942d0d8..86f13f76c0fa 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/CreateCallResponse.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/JoinCallResult.Serialization.cs @@ -10,9 +10,9 @@ namespace Azure.Communication.CallingServer { - public partial class CreateCallResponse + public partial class JoinCallResult { - internal static CreateCallResponse DeserializeCreateCallResponse(JsonElement element) + internal static JoinCallResult DeserializeJoinCallResult(JsonElement element) { Optional callConnectionId = default; foreach (var property in element.EnumerateObject()) @@ -23,7 +23,7 @@ internal static CreateCallResponse DeserializeCreateCallResponse(JsonElement ele continue; } } - return new CreateCallResponse(callConnectionId.Value); + return new JoinCallResult(callConnectionId.Value); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/JoinCallResponse.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/JoinCallResult.cs similarity index 64% rename from sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/JoinCallResponse.cs rename to sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/JoinCallResult.cs index 91d58c07b4a5..daa4e90f76a1 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/JoinCallResponse.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/JoinCallResult.cs @@ -8,16 +8,16 @@ namespace Azure.Communication.CallingServer { /// The response payload of the join call operation. - public partial class JoinCallResponse + public partial class JoinCallResult { - /// Initializes a new instance of JoinCallResponse. - internal JoinCallResponse() + /// Initializes a new instance of JoinCallResult. + internal JoinCallResult() { } - /// Initializes a new instance of JoinCallResponse. + /// Initializes a new instance of JoinCallResult. /// The call connection id. - internal JoinCallResponse(string callConnectionId) + internal JoinCallResult(string callConnectionId) { CallConnectionId = callConnectionId; } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayAudioResponse.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayAudioResult.Serialization.cs similarity index 87% rename from sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayAudioResponse.Serialization.cs rename to sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayAudioResult.Serialization.cs index 8757de91f31c..2d23546a1d36 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayAudioResponse.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayAudioResult.Serialization.cs @@ -10,9 +10,9 @@ namespace Azure.Communication.CallingServer { - public partial class PlayAudioResponse + public partial class PlayAudioResult { - internal static PlayAudioResponse DeserializePlayAudioResponse(JsonElement element) + internal static PlayAudioResult DeserializePlayAudioResult(JsonElement element) { Optional id = default; Optional status = default; @@ -51,7 +51,7 @@ internal static PlayAudioResponse DeserializePlayAudioResponse(JsonElement eleme continue; } } - return new PlayAudioResponse(id.Value, Optional.ToNullable(status), operationContext.Value, resultInfo.Value); + return new PlayAudioResult(id.Value, Optional.ToNullable(status), operationContext.Value, resultInfo.Value); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayAudioResponse.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayAudioResult.cs similarity index 85% rename from sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayAudioResponse.cs rename to sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayAudioResult.cs index daa01f390e2b..88fcc5ba31a5 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayAudioResponse.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/PlayAudioResult.cs @@ -8,19 +8,19 @@ namespace Azure.Communication.CallingServer { /// The response payload for play audio operation. - public partial class PlayAudioResponse + public partial class PlayAudioResult { - /// Initializes a new instance of PlayAudioResponse. - internal PlayAudioResponse() + /// Initializes a new instance of PlayAudioResult. + internal PlayAudioResult() { } - /// Initializes a new instance of PlayAudioResponse. + /// Initializes a new instance of PlayAudioResult. /// Gets or sets the identifier. /// Gets or sets the status of the operation. /// Gets or sets the operation context. /// Gets or sets the result info. - internal PlayAudioResponse(string id, OperationStatus? status, string operationContext, ResultInfo resultInfo) + internal PlayAudioResult(string id, OperationStatus? status, string operationContext, ResultInfo resultInfo) { Id = id; Status = status; diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/StartCallRecordingResponse.Serialization.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/StartCallRecordingResult.Serialization.cs similarity index 71% rename from sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/StartCallRecordingResponse.Serialization.cs rename to sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/StartCallRecordingResult.Serialization.cs index 2819ae59c6cd..0ed327d5f67e 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/StartCallRecordingResponse.Serialization.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/StartCallRecordingResult.Serialization.cs @@ -10,9 +10,9 @@ namespace Azure.Communication.CallingServer { - public partial class StartCallRecordingResponse + public partial class StartCallRecordingResult { - internal static StartCallRecordingResponse DeserializeStartCallRecordingResponse(JsonElement element) + internal static StartCallRecordingResult DeserializeStartCallRecordingResult(JsonElement element) { Optional recordingId = default; foreach (var property in element.EnumerateObject()) @@ -23,7 +23,7 @@ internal static StartCallRecordingResponse DeserializeStartCallRecordingResponse continue; } } - return new StartCallRecordingResponse(recordingId.Value); + return new StartCallRecordingResult(recordingId.Value); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/StartCallRecordingResponse.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/StartCallRecordingResult.cs similarity index 76% rename from sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/StartCallRecordingResponse.cs rename to sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/StartCallRecordingResult.cs index fdd30e12eb77..1f34fac12aa1 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/StartCallRecordingResponse.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/Models/StartCallRecordingResult.cs @@ -8,16 +8,16 @@ namespace Azure.Communication.CallingServer { /// The response payload of start call recording operation. - public partial class StartCallRecordingResponse + public partial class StartCallRecordingResult { - /// Initializes a new instance of StartCallRecordingResponse. - internal StartCallRecordingResponse() + /// Initializes a new instance of StartCallRecordingResult. + internal StartCallRecordingResult() { } - /// Initializes a new instance of StartCallRecordingResponse. + /// Initializes a new instance of StartCallRecordingResult. /// The recording id of the started recording. - internal StartCallRecordingResponse(string recordingId) + internal StartCallRecordingResult(string recordingId) { RecordingId = recordingId; } diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Generated/ServerCallRestClient.cs b/sdk/communication/Azure.Communication.CallingServer/src/Generated/ServerCallRestClient.cs index 7bd56dbf2ea9..337d52b82fd0 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/Generated/ServerCallRestClient.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/Generated/ServerCallRestClient.cs @@ -234,7 +234,7 @@ internal HttpMessage CreateStartRecordingRequest(string serverCallId, string rec /// The uri to send notifications to. /// The cancellation token to use. /// is null. - public async Task> StartRecordingAsync(string serverCallId, string recordingStateCallbackUri = null, CancellationToken cancellationToken = default) + public async Task> StartRecordingAsync(string serverCallId, string recordingStateCallbackUri = null, CancellationToken cancellationToken = default) { if (serverCallId == null) { @@ -247,9 +247,9 @@ public async Task> StartRecordingAsync(stri { case 200: { - StartCallRecordingResponse value = default; + StartCallRecordingResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = StartCallRecordingResponse.DeserializeStartCallRecordingResponse(document.RootElement); + value = StartCallRecordingResult.DeserializeStartCallRecordingResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -262,7 +262,7 @@ public async Task> StartRecordingAsync(stri /// The uri to send notifications to. /// The cancellation token to use. /// is null. - public Response StartRecording(string serverCallId, string recordingStateCallbackUri = null, CancellationToken cancellationToken = default) + public Response StartRecording(string serverCallId, string recordingStateCallbackUri = null, CancellationToken cancellationToken = default) { if (serverCallId == null) { @@ -275,9 +275,9 @@ public Response StartRecording(string serverCallId, { case 200: { - StartCallRecordingResponse value = default; + StartCallRecordingResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = StartCallRecordingResponse.DeserializeStartCallRecordingResponse(document.RootElement); + value = StartCallRecordingResult.DeserializeStartCallRecordingResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -307,7 +307,7 @@ internal HttpMessage CreateRecordingStateRequest(string serverCallId, string rec /// The recording id. /// The cancellation token to use. /// or is null. - public async Task> RecordingStateAsync(string serverCallId, string recordingId, CancellationToken cancellationToken = default) + public async Task> RecordingStateAsync(string serverCallId, string recordingId, CancellationToken cancellationToken = default) { if (serverCallId == null) { @@ -324,9 +324,9 @@ public async Task> RecordingStateAsync(s { case 200: { - GetCallRecordingStateResponse value = default; + CallRecordingStateResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = GetCallRecordingStateResponse.DeserializeGetCallRecordingStateResponse(document.RootElement); + value = CallRecordingStateResult.DeserializeCallRecordingStateResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -339,7 +339,7 @@ public async Task> RecordingStateAsync(s /// The recording id. /// The cancellation token to use. /// or is null. - public Response RecordingState(string serverCallId, string recordingId, CancellationToken cancellationToken = default) + public Response RecordingState(string serverCallId, string recordingId, CancellationToken cancellationToken = default) { if (serverCallId == null) { @@ -356,9 +356,9 @@ public Response RecordingState(string serverCallI { case 200: { - GetCallRecordingStateResponse value = default; + CallRecordingStateResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = GetCallRecordingStateResponse.DeserializeGetCallRecordingStateResponse(document.RootElement); + value = CallRecordingStateResult.DeserializeCallRecordingStateResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -629,7 +629,7 @@ internal HttpMessage CreateJoinCallRequest(string serverCallId, CommunicationIde /// The requested call events to subscribe to. /// The cancellation token to use. /// , , or is null. - public async Task> JoinCallAsync(string serverCallId, CommunicationIdentifierModel source, string callbackUri, string subject = null, IEnumerable requestedMediaTypes = null, IEnumerable requestedCallEvents = null, CancellationToken cancellationToken = default) + public async Task> JoinCallAsync(string serverCallId, CommunicationIdentifierModel source, string callbackUri, string subject = null, IEnumerable requestedMediaTypes = null, IEnumerable requestedCallEvents = null, CancellationToken cancellationToken = default) { if (serverCallId == null) { @@ -650,9 +650,9 @@ public async Task> JoinCallAsync(string serverCallId, { case 202: { - JoinCallResponse value = default; + JoinCallResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = JoinCallResponse.DeserializeJoinCallResponse(document.RootElement); + value = JoinCallResult.DeserializeJoinCallResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -669,7 +669,7 @@ public async Task> JoinCallAsync(string serverCallId, /// The requested call events to subscribe to. /// The cancellation token to use. /// , , or is null. - public Response JoinCall(string serverCallId, CommunicationIdentifierModel source, string callbackUri, string subject = null, IEnumerable requestedMediaTypes = null, IEnumerable requestedCallEvents = null, CancellationToken cancellationToken = default) + public Response JoinCall(string serverCallId, CommunicationIdentifierModel source, string callbackUri, string subject = null, IEnumerable requestedMediaTypes = null, IEnumerable requestedCallEvents = null, CancellationToken cancellationToken = default) { if (serverCallId == null) { @@ -690,9 +690,9 @@ public Response JoinCall(string serverCallId, CommunicationIde { case 202: { - JoinCallResponse value = default; + JoinCallResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = JoinCallResponse.DeserializeJoinCallResponse(document.RootElement); + value = JoinCallResult.DeserializeJoinCallResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -745,7 +745,7 @@ internal HttpMessage CreatePlayAudioRequest(string serverCallId, string audioFil /// The callback Uri to receive PlayAudio status notifications. /// The cancellation token to use. /// is null. - public async Task> PlayAudioAsync(string serverCallId, string audioFileUri = null, bool? loop = null, string operationContext = null, string audioFileId = null, string callbackUri = null, CancellationToken cancellationToken = default) + public async Task> PlayAudioAsync(string serverCallId, string audioFileUri = null, bool? loop = null, string operationContext = null, string audioFileId = null, string callbackUri = null, CancellationToken cancellationToken = default) { if (serverCallId == null) { @@ -758,9 +758,9 @@ public async Task> PlayAudioAsync(string serverCallI { case 202: { - PlayAudioResponse value = default; + PlayAudioResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = PlayAudioResponse.DeserializePlayAudioResponse(document.RootElement); + value = PlayAudioResult.DeserializePlayAudioResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -785,7 +785,7 @@ public async Task> PlayAudioAsync(string serverCallI /// The callback Uri to receive PlayAudio status notifications. /// The cancellation token to use. /// is null. - public Response PlayAudio(string serverCallId, string audioFileUri = null, bool? loop = null, string operationContext = null, string audioFileId = null, string callbackUri = null, CancellationToken cancellationToken = default) + public Response PlayAudio(string serverCallId, string audioFileUri = null, bool? loop = null, string operationContext = null, string audioFileId = null, string callbackUri = null, CancellationToken cancellationToken = default) { if (serverCallId == null) { @@ -798,9 +798,9 @@ public Response PlayAudio(string serverCallId, string audioFi { case 202: { - PlayAudioResponse value = default; + PlayAudioResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = PlayAudioResponse.DeserializePlayAudioResponse(document.RootElement); + value = PlayAudioResult.DeserializePlayAudioResult(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/communication/Azure.Communication.CallingServer/src/Models/CallingServerModelFactory.cs b/sdk/communication/Azure.Communication.CallingServer/src/Models/CallingServerModelFactory.cs new file mode 100644 index 000000000000..24ecd69275cf --- /dev/null +++ b/sdk/communication/Azure.Communication.CallingServer/src/Models/CallingServerModelFactory.cs @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core; + +namespace Azure.Communication.CallingServer +{ + /// + /// Calling server model factory + /// + [CodeGenModel("AzureCommunicationCallingServerServiceModelFactory")] + internal partial class CallingServerModelFactory + { + } +} diff --git a/sdk/communication/Azure.Communication.CallingServer/src/ServerCall.cs b/sdk/communication/Azure.Communication.CallingServer/src/ServerCall.cs index 87579cdee97a..cdf81605e88d 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/ServerCall.cs +++ b/sdk/communication/Azure.Communication.CallingServer/src/ServerCall.cs @@ -6,8 +6,6 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Core.Pipeline; -using Azure.Communication.Pipeline; -using System.Collections.Generic; namespace Azure.Communication.CallingServer { @@ -47,7 +45,7 @@ protected ServerCall() /// The operation context. /// The cancellation token to use. /// The server returned an error. See for details returned from the server. - public virtual async Task> PlayAudioAsync(Uri audioFileUri, string audioFileId, Uri callbackUri, string operationContext = null, CancellationToken cancellationToken = default) + public virtual async Task> PlayAudioAsync(Uri audioFileUri, string audioFileId, Uri callbackUri, string operationContext = null, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(ServerCall)}.{nameof(PlayAudio)}"); scope.Start(); @@ -78,7 +76,7 @@ public virtual async Task> PlayAudioAsync(Uri audioF /// The operation context. /// The cancellation token to use. /// The server returned an error. See for details returned from the server. - public virtual Response PlayAudio(Uri audioFileUri, string audioFileId, Uri callbackUri, string operationContext = null, CancellationToken cancellationToken = default) + public virtual Response PlayAudio(Uri audioFileUri, string audioFileId, Uri callbackUri, string operationContext = null, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(ServerCall)}.{nameof(PlayAudio)}"); scope.Start(); @@ -120,7 +118,7 @@ public virtual Response AddParticipant(CommunicationIdentifier participant, Uri return RestClient.InviteParticipants( serverCallId: ServerCallId, - participants: new List { CommunicationIdentifierSerializer.Serialize(participant) }, + participants: new[] { CommunicationIdentifierSerializer.Serialize(participant) }, alternateCallerId: string.IsNullOrEmpty(alternateCallerId) ? null : new PhoneNumberIdentifierModel(alternateCallerId), callbackUri: callbackUri?.AbsoluteUri, operationContext: operationContext, @@ -152,7 +150,7 @@ public virtual async Task AddParticipantAsync(CommunicationIdentifier return await RestClient.InviteParticipantsAsync( serverCallId: ServerCallId, - participants: new List { CommunicationIdentifierSerializer.Serialize(participant) }, + participants: new[] { CommunicationIdentifierSerializer.Serialize(participant) }, alternateCallerId: string.IsNullOrEmpty(alternateCallerId) ? null : new PhoneNumberIdentifierModel(alternateCallerId), callbackUri: callbackUri?.AbsoluteUri, operationContext: operationContext, @@ -219,7 +217,7 @@ public virtual async Task RemoveParticipantAsync(string participantId, /// /// The uri to send state change callbacks. /// The cancellation token. - public virtual async Task> StartRecordingAsync(Uri recordingStateCallbackUri, CancellationToken cancellationToken = default) + public virtual async Task> StartRecordingAsync(Uri recordingStateCallbackUri, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(ServerCall)}.{nameof(StartRecording)}"); scope.Start(); @@ -243,7 +241,7 @@ public virtual async Task> StartRecordingAs /// /// The uri to send state change callbacks. /// The cancellation token. - public virtual Response StartRecording(Uri recordingStateCallbackUri, CancellationToken cancellationToken = default) + public virtual Response StartRecording(Uri recordingStateCallbackUri, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(ServerCall)}.{nameof(StartRecording)}"); scope.Start(); @@ -267,7 +265,7 @@ public virtual Response StartRecording(Uri recording /// /// The recording id to get the state of. /// The cancellation token. - public virtual async Task> GetRecordingStateAsync(string recordingId, CancellationToken cancellationToken = default) + public virtual async Task> GetRecordingStateAsync(string recordingId, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(ServerCall)}.{nameof(GetRecordingState)}"); scope.Start(); @@ -291,7 +289,7 @@ public virtual async Task> GetRecordingS /// /// The recording id to get the state of. /// The cancellation token. - public virtual Response GetRecordingState(string recordingId, CancellationToken cancellationToken = default) + public virtual Response GetRecordingState(string recordingId, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(ServerCall)}.{nameof(GetRecordingState)}"); scope.Start(); diff --git a/sdk/communication/Azure.Communication.CallingServer/src/autorest.md b/sdk/communication/Azure.Communication.CallingServer/src/autorest.md index ded8f6bf7115..3ef4269aa86e 100644 --- a/sdk/communication/Azure.Communication.CallingServer/src/autorest.md +++ b/sdk/communication/Azure.Communication.CallingServer/src/autorest.md @@ -16,7 +16,7 @@ The following are the settings for generating this API with AutoRest. ```yaml tag: beta -input-file: https://github.com/Azure/azure-rest-api-specs/blob/37acfb43a99ac90f6cb986f227a34bcfbccd6c5b/specification/communication/data-plane/CallingServer/preview/2021-06-15-preview/communicationservicescallingserver.json +input-file: https://github.com/Azure/azure-rest-api-specs/blob/74575fadb83fcd08a70d1168c8d04a6ca5e90715/specification/communication/data-plane/CallingServer/preview/2021-06-15-preview/communicationservicescallingserver.json payload-flattening-threshold: 10 clear-output-folder: true directive: diff --git a/sdk/communication/Azure.Communication.CallingServer/tests/CallingServerClients/CallConnectionTests.cs b/sdk/communication/Azure.Communication.CallingServer/tests/CallingServerClients/CallConnectionTests.cs index b156bbe241c8..069122cd47c8 100644 --- a/sdk/communication/Azure.Communication.CallingServer/tests/CallingServerClients/CallConnectionTests.cs +++ b/sdk/communication/Azure.Communication.CallingServer/tests/CallingServerClients/CallConnectionTests.cs @@ -8,7 +8,7 @@ namespace Azure.Communication.CallingServer.Tests { - public class CallConnectionTests : TestBase + public class CallConnectionTests : CallingServerTestBase { private const string CancelAllMediaOperaionsResponsePayload = "{" + "\"id\": \"dummyId\"," + @@ -190,7 +190,7 @@ public void RemoveParticipants_Passes(string callConnectionId, string participan Assert.AreEqual((int)response.Status, 202); } - private void VerifyCancelAllMediaOperationsResponse(CancelAllMediaOperationsResponse response) + private void VerifyCancelAllMediaOperationsResponse(CancelAllMediaOperationsResult response) { Assert.AreEqual("dummyId", response.Id); Assert.AreEqual(OperationStatus.Completed, response.Status); @@ -199,7 +199,7 @@ private void VerifyCancelAllMediaOperationsResponse(CancelAllMediaOperationsResp Assert.AreEqual("dummyMessage", response.ResultInfo.Message); } - private void VerifyPlayAudioResponse(PlayAudioResponse response) + private void VerifyPlayAudioResponse(PlayAudioResult response) { Assert.AreEqual("dummyId", response.Id); Assert.AreEqual(OperationStatus.Running, response.Status); @@ -215,8 +215,10 @@ private CallConnection CreateMockCallConnection(int responseCode, string? respon private static IEnumerable TestData_CallConnectionId() { - return new List(){ - new object?[] { + return new[] + { + new object?[] + { "4ab31d78-a189-4e50-afaa-f9610975b6cb", }, }; @@ -224,8 +226,10 @@ private CallConnection CreateMockCallConnection(int responseCode, string? respon private static IEnumerable TestData_PlayAudio() { - return new List(){ - new object?[] { + return new[] + { + new object?[] + { new Uri("https://bot.contoso.io/audio/sample-message.wav"), "sampleAudioFileId", new Uri("https://bot.contoso.io/callback"), @@ -236,8 +240,10 @@ private CallConnection CreateMockCallConnection(int responseCode, string? respon private static IEnumerable TestData_AddParticipant() { - return new List(){ - new object?[] { + return new[] + { + new object?[] + { new CommunicationUserIdentifier("8:acs:acsuserid"), "+14250000000", "dummycontext" @@ -247,8 +253,10 @@ private CallConnection CreateMockCallConnection(int responseCode, string? respon private static IEnumerable TestData_ParticipantId() { - return new List(){ - new object?[] { + return new[] + { + new object?[] + { "d09038e7-38f7-4aa1-9c5c-4bb07a65aa17", "66c76529-3e58-45bf-9592-84eadd52bc81" }, diff --git a/sdk/communication/Azure.Communication.CallingServer/tests/CallingServerClients/CallingServerClientsLiveTests.cs b/sdk/communication/Azure.Communication.CallingServer/tests/CallingServerClients/CallingServerClientsLiveTests.cs index 84949a704268..353f11caa41a 100644 --- a/sdk/communication/Azure.Communication.CallingServer/tests/CallingServerClients/CallingServerClientsLiveTests.cs +++ b/sdk/communication/Azure.Communication.CallingServer/tests/CallingServerClients/CallingServerClientsLiveTests.cs @@ -130,11 +130,11 @@ private async Task> CreateCallOperation(CallingServerCl CommunicationIdentityClient communicationIdentityClient = CreateInstrumentedCommunicationIdentityClient(); var source = await CreateUserAsync(communicationIdentityClient).ConfigureAwait(false); - var targets = new List() { new PhoneNumberIdentifier(TestEnvironment.TargetPhoneNumber) }; + var targets = new[] { new PhoneNumberIdentifier(TestEnvironment.TargetPhoneNumber) }; var createCallOption = new CreateCallOptions( new Uri(TestEnvironment.AppCallbackUrl), - new List { CallModality.Audio }, - new List { EventSubscriptionType.ParticipantsUpdated, EventSubscriptionType.DtmfReceived }); + new[] { CallModality.Audio }, + new[] { EventSubscriptionType.ParticipantsUpdated, EventSubscriptionType.DtmfReceived }); createCallOption.AlternateCallerId = new PhoneNumberIdentifier(TestEnvironment.SourcePhoneNumber); Console.WriteLine("Performing CreateCall operation"); diff --git a/sdk/communication/Azure.Communication.CallingServer/tests/CallingServerClients/CallingServerClientsTests.cs b/sdk/communication/Azure.Communication.CallingServer/tests/CallingServerClients/CallingServerClientsTests.cs index f3237b289d67..e736605bf7ec 100644 --- a/sdk/communication/Azure.Communication.CallingServer/tests/CallingServerClients/CallingServerClientsTests.cs +++ b/sdk/communication/Azure.Communication.CallingServer/tests/CallingServerClients/CallingServerClientsTests.cs @@ -9,7 +9,7 @@ namespace Azure.Communication.CallingServer.Tests { - public class CallingServerClientsTests : TestBase + public class CallingServerClientsTests : CallingServerTestBase { [TestCaseSource(nameof(TestData_CreateCall))] public async Task CreateCallAsync_Returns201Created(CommunicationIdentifier source, IEnumerable targets, CreateCallOptions createCallOptions) @@ -38,7 +38,7 @@ public async Task JoinCallAsync_Returns202Accepted(string serverCallId, Communic { CallingServerClient callingServerClient = CreateMockCallingServerClient(202, CreateOrJoinCallPayload); - var response = await callingServerClient.JoinCallConnectionAsync(serverCallId, source, joinCallOptions).ConfigureAwait(false); + var response = await callingServerClient.JoinCallAsync(serverCallId, source, joinCallOptions).ConfigureAwait(false); Assert.AreEqual((int)HttpStatusCode.Accepted, response.GetRawResponse().Status); Assert.AreEqual("cad9df7b-f3ac-4c53-96f7-c76e7437b3c1", response.Value.CallConnectionId); @@ -49,7 +49,7 @@ public void JoinCall_Returns202Accepted(string serverCallId, CommunicationIdenti { CallingServerClient callingServerClient = CreateMockCallingServerClient(202, CreateOrJoinCallPayload); - var response = callingServerClient.JoinCallConnection(serverCallId, source, joinCallOptions); + var response = callingServerClient.JoinCall(serverCallId, source, joinCallOptions); Assert.AreEqual((int)HttpStatusCode.Accepted, response.GetRawResponse().Status); Assert.AreEqual("cad9df7b-f3ac-4c53-96f7-c76e7437b3c1", response.Value.CallConnectionId); @@ -57,18 +57,26 @@ public void JoinCall_Returns202Accepted(string serverCallId, CommunicationIdenti private static IEnumerable TestData_CreateCall() { - return new List(){ - new object?[] { + return new[] + { + new object?[] + { new CommunicationUserIdentifier("8:acs:resource_source"), - new List() + new CommunicationIdentifier[] { new CommunicationUserIdentifier("8:acs:resource_target"), new PhoneNumberIdentifier("+14250001234") }, new CreateCallOptions( new Uri("https://bot.contoso.com/callback"), - new List(){ CallModality.Video }, - new List(){ EventSubscriptionType.ParticipantsUpdated } + new[] + { + CallModality.Video + }, + new[] + { + EventSubscriptionType.ParticipantsUpdated + } ) { AlternateCallerId = new PhoneNumberIdentifier("+17781234567"), @@ -80,14 +88,22 @@ public void JoinCall_Returns202Accepted(string serverCallId, CommunicationIdenti private static IEnumerable TestData_JoinCall() { - return new List(){ - new object?[] { + return new[] + { + new object?[] + { "guid", new CommunicationUserIdentifier("8:acs:resource_source"), new JoinCallOptions( new Uri("https://bot.contoso.com/callback"), - new List(){ CallModality.Video }, - new List(){ EventSubscriptionType.ParticipantsUpdated } + new[] + { + CallModality.Video + }, + new[] + { + EventSubscriptionType.ParticipantsUpdated + } ) { Subject = "testsubject" diff --git a/sdk/communication/Azure.Communication.CallingServer/tests/CallingServerClients/TestBase.cs b/sdk/communication/Azure.Communication.CallingServer/tests/CallingServerClients/CallingServerTestBase.cs similarity index 74% rename from sdk/communication/Azure.Communication.CallingServer/tests/CallingServerClients/TestBase.cs rename to sdk/communication/Azure.Communication.CallingServer/tests/CallingServerClients/CallingServerTestBase.cs index 393606931593..5851828694b9 100644 --- a/sdk/communication/Azure.Communication.CallingServer/tests/CallingServerClients/TestBase.cs +++ b/sdk/communication/Azure.Communication.CallingServer/tests/CallingServerClients/CallingServerTestBase.cs @@ -1,13 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System; using Azure.Core; using Azure.Core.TestFramework; namespace Azure.Communication.CallingServer.Tests { - public class TestBase + public class CallingServerTestBase { protected const string dummyAccessKey = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9+eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ+SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV+adQssw5c="; @@ -23,10 +22,14 @@ internal CallingServerClient CreateMockCallingServerClient(int responseCode, obj if (responseContent != null) { - if (responseContent.GetType() == typeof(string)) - mockResponse.SetContent((string)responseContent); - else if (responseContent.GetType() == typeof(byte[])) - mockResponse.SetContent((byte[])responseContent); + if (responseContent is string responseContentString) + { + mockResponse.SetContent(responseContentString); + } + else if (responseContent is byte[] responseContentObjectArr) + { + mockResponse.SetContent(responseContentObjectArr); + } } if (httpHeaders != null) @@ -47,17 +50,12 @@ internal CallingServerClient CreateMockCallingServerClient(int responseCode, obj internal CallingServerClient CreateMockCallingServerClient(MockResponse[] mockResponses) { - var uri = new Uri("https://acs.dummyresource.com"); - var communicationTokenCredential = - new AzureKeyCredential(dummyAccessKey); - var callingServerClientOptions = new CallingServerClientOptions { Transport = new MockTransport(mockResponses) }; - var callingserverClient = new CallingServerClient(uri, communicationTokenCredential, callingServerClientOptions); - return callingserverClient; + return new CallingServerClient(connectionString, callingServerClientOptions); } } } diff --git a/sdk/communication/Azure.Communication.CallingServer/tests/CallingServerClients/ContentDownloadTests.cs b/sdk/communication/Azure.Communication.CallingServer/tests/CallingServerClients/ContentDownloadTests.cs index 1702276a4996..9b55c4d073ce 100644 --- a/sdk/communication/Azure.Communication.CallingServer/tests/CallingServerClients/ContentDownloadTests.cs +++ b/sdk/communication/Azure.Communication.CallingServer/tests/CallingServerClients/ContentDownloadTests.cs @@ -13,7 +13,7 @@ namespace Azure.Communication.CallingServer.Tests.ContentDownloadTests { - public class ContentDownloadTests : TestBase + public class ContentDownloadTests : CallingServerTestBase { private const string DummyRecordingMetadata = "{" + "\"chunkDocumentId\": \"dummyDocId\"," + diff --git a/sdk/communication/Azure.Communication.CallingServer/tests/CallingServerClients/ServerCallTests.cs b/sdk/communication/Azure.Communication.CallingServer/tests/CallingServerClients/ServerCallTests.cs index 50a1a85cc396..5f2836bab77c 100644 --- a/sdk/communication/Azure.Communication.CallingServer/tests/CallingServerClients/ServerCallTests.cs +++ b/sdk/communication/Azure.Communication.CallingServer/tests/CallingServerClients/ServerCallTests.cs @@ -9,7 +9,7 @@ namespace Azure.Communication.CallingServer.Tests { - public class ServerCallTests : TestBase + public class ServerCallTests : CallingServerTestBase { private const string DummyStartRecordingResponse = "{" + "\"recordingId\": \"dummyRecordingId\"" + @@ -33,7 +33,7 @@ public class ServerCallTests : TestBase public void StartRecording_Returns200Ok(string sampleConversationId, Uri sampleCallBackUri) { ServerCall serverCall = CreateMockServerCall(sampleConversationId, 200, DummyStartRecordingResponse); - StartCallRecordingResponse response = serverCall.StartRecording(sampleCallBackUri); + StartCallRecordingResult response = serverCall.StartRecording(sampleCallBackUri); Assert.AreEqual("dummyRecordingId", response.RecordingId); } @@ -41,7 +41,7 @@ public void StartRecording_Returns200Ok(string sampleConversationId, Uri sampleC public async Task StartRecordingAsync_Returns200Ok(string sampleConversationId, Uri sampleCallBackUri) { ServerCall serverCall = CreateMockServerCall(sampleConversationId, 200, DummyStartRecordingResponse); - Response response = await serverCall.StartRecordingAsync(sampleCallBackUri); + Response response = await serverCall.StartRecordingAsync(sampleCallBackUri); Assert.AreEqual("dummyRecordingId", response.Value.RecordingId); } @@ -98,7 +98,7 @@ public async Task ResumeRecordingAsync_Return200Ok(string sampleConversationId, public void GetRecordingState_Return200Ok(string sampleConversationId, string sampleRecordingId) { ServerCall serverCall = CreateMockServerCall(sampleConversationId, 200, DummyRecordingStateResponse); - GetCallRecordingStateResponse response = serverCall.GetRecordingState(sampleRecordingId); + CallRecordingStateResult response = serverCall.GetRecordingState(sampleRecordingId); Assert.AreEqual(CallRecordingState.Active, response.RecordingState); } @@ -106,7 +106,7 @@ public void GetRecordingState_Return200Ok(string sampleConversationId, string sa public async Task GetRecordingStateAsync_Return200Ok(string sampleConversationId, string sampleRecordingId) { ServerCall serverCall = CreateMockServerCall(sampleConversationId, 200, DummyRecordingStateResponse); - Response response = await serverCall.GetRecordingStateAsync(sampleRecordingId); + Response response = await serverCall.GetRecordingStateAsync(sampleRecordingId); Assert.AreEqual(CallRecordingState.Active, response.Value.RecordingState); } @@ -114,7 +114,7 @@ public async Task GetRecordingStateAsync_Return200Ok(string sampleConversationId public void PlayAudio_Return202Accepted(string sampleConversationId, Uri sampleAudioFileUri, string sampleAudioFileId, Uri sampleCallbackUri, string sampleOperationContext) { ServerCall serverCall = CreateMockServerCall(sampleConversationId, 202, DummyPlayAudioResponse); - PlayAudioResponse response = serverCall.PlayAudio(sampleAudioFileUri, sampleAudioFileId, sampleCallbackUri, sampleOperationContext); + PlayAudioResult response = serverCall.PlayAudio(sampleAudioFileUri, sampleAudioFileId, sampleCallbackUri, sampleOperationContext); VerifyPlayAudioResponse(response); } @@ -122,7 +122,7 @@ public void PlayAudio_Return202Accepted(string sampleConversationId, Uri sampleA public async Task PlayAudioAsync_Return202Accepted(string sampleConversationId, Uri sampleAudioFileUri, string sampleAudioFileId, Uri sampleCallbackUri, string sampleOperationContext) { ServerCall serverCall = CreateMockServerCall(sampleConversationId, 202, DummyPlayAudioResponse); - Response response = await serverCall.PlayAudioAsync(sampleAudioFileUri, sampleAudioFileId, sampleCallbackUri, sampleOperationContext); + Response response = await serverCall.PlayAudioAsync(sampleAudioFileUri, sampleAudioFileId, sampleCallbackUri, sampleOperationContext); VerifyPlayAudioResponse(response); } @@ -166,7 +166,7 @@ public void RemoveParticipants_Return202Accepted(string serverCallId, string par Assert.AreEqual((int)response.Status, 202); } - private void VerifyPlayAudioResponse(PlayAudioResponse response) + private void VerifyPlayAudioResponse(PlayAudioResult response) { Assert.AreEqual("dummyId", response.Id); Assert.AreEqual(OperationStatus.Running, response.Status); @@ -177,8 +177,10 @@ private void VerifyPlayAudioResponse(PlayAudioResponse response) private static IEnumerable TestData_StartRecording() { - return new List(){ - new object?[] { + return new[] + { + new object?[] + { "sampleConversationId", new Uri("https://somecallbackurl"), }, @@ -187,8 +189,10 @@ private void VerifyPlayAudioResponse(PlayAudioResponse response) private static IEnumerable TestData_StopRecording() { - return new List(){ - new object?[] { + return new[] + { + new object?[] + { "sampleConversationId", "sampleRecordingId", }, @@ -197,8 +201,10 @@ private void VerifyPlayAudioResponse(PlayAudioResponse response) private static IEnumerable TestData_PauseRecording() { - return new List(){ - new object?[] { + return new[] + { + new object?[] + { "sampleConversationId", "sampleRecordingId", }, @@ -207,8 +213,10 @@ private void VerifyPlayAudioResponse(PlayAudioResponse response) private static IEnumerable TestData_ResumeRecording() { - return new List(){ - new object?[] { + return new[] + { + new object?[] + { "sampleConversationId", "sampleRecordingId", }, @@ -217,8 +225,10 @@ private void VerifyPlayAudioResponse(PlayAudioResponse response) private static IEnumerable TestData_GetRecordingState() { - return new List(){ - new object?[] { + return new[] + { + new object?[] + { "sampleConversationId", "sampleRecordingId", }, @@ -227,8 +237,10 @@ private void VerifyPlayAudioResponse(PlayAudioResponse response) private static IEnumerable TestData_PlayAudio() { - return new List(){ - new object?[] { + return new[] + { + new object?[] + { "sampleConversationId", new Uri("https://av.ngrok.io/audio/sample-message.wav"), "sampleAudioFileId", @@ -240,8 +252,10 @@ private void VerifyPlayAudioResponse(PlayAudioResponse response) private static IEnumerable TestData_AddParticipant() { - return new List(){ - new object?[] { + return new[] + { + new object?[] + { "sampleConversationId", new CommunicationUserIdentifier("8:acs:acsuserid"), new Uri("https://bot.contoso.com/callback"), @@ -253,8 +267,10 @@ private void VerifyPlayAudioResponse(PlayAudioResponse response) private static IEnumerable TestData_ParticipantId() { - return new List(){ - new object?[] { + return new[] + { + new object?[] + { "sampleConversationId", "66c76529-3e58-45bf-9592-84eadd52bc81" }, diff --git a/sdk/communication/Azure.Communication.CallingServer/tests/samples/Sample1_CallClient.cs b/sdk/communication/Azure.Communication.CallingServer/tests/samples/Sample1_CallClient.cs index ae6d3c1f0197..73a151bf6c3d 100644 --- a/sdk/communication/Azure.Communication.CallingServer/tests/samples/Sample1_CallClient.cs +++ b/sdk/communication/Azure.Communication.CallingServer/tests/samples/Sample1_CallClient.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; using System.Threading.Tasks; using Azure.Communication.Identity; using Azure.Core.TestFramework; @@ -26,12 +25,12 @@ public async Task CreateCallAsync() { CommunicationIdentityClient communicationIdentityClient = new CommunicationIdentityClient(TestEnvironment.LiveTestDynamicConnectionString); var source = await communicationIdentityClient.CreateUserAsync(); - var targets = new List() { new PhoneNumberIdentifier(TestEnvironment.SourcePhoneNumber) }; + var targets = new[] { new PhoneNumberIdentifier(TestEnvironment.SourcePhoneNumber) }; #region Snippet:Azure_Communication_Call_Tests_CreateCallOptions var createCallOption = new CreateCallOptions( new Uri(TestEnvironment.AppCallbackUrl), - new List { CallModality.Audio }, - new List + new[] { CallModality.Audio }, + new[] { EventSubscriptionType.ParticipantsUpdated, EventSubscriptionType.DtmfReceived @@ -59,11 +58,11 @@ public void CreateCall() { CommunicationIdentityClient communicationIdentityClient = new CommunicationIdentityClient(TestEnvironment.LiveTestDynamicConnectionString); var source = communicationIdentityClient.CreateUser(); - var targets = new List() { new PhoneNumberIdentifier(TestEnvironment.SourcePhoneNumber) }; + var targets = new[] { new PhoneNumberIdentifier(TestEnvironment.SourcePhoneNumber) }; var createCallOption = new CreateCallOptions( new Uri(TestEnvironment.AppCallbackUrl), - new List { CallModality.Audio }, - new List { + new[] { CallModality.Audio }, + new[] { EventSubscriptionType.ParticipantsUpdated, EventSubscriptionType.DtmfReceived });