Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beta 2 feedback changes(sdk specific only) #37876

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,4 @@
<PackageReference Include="Azure.Communication.Common" />
<PackageReference Include="System.Text.Json" />
</ItemGroup>
<ItemGroup>
<Folder Include="Generated\" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ private AnswerCallRequestInternal CreateAnswerCallRequest(AnswerCallOptions opti
AnswerCallRequestInternal request = new AnswerCallRequestInternal(options.IncomingCallContext, options.CallbackUri.AbsoluteUri);

// Add custom cognitive service domain name
if (options.AzureCognitiveServicesEndpointUri != null)
if (options.CognitiveServicesEndpoint != null)
{
request.AzureCognitiveServicesEndpointUrl = options.AzureCognitiveServicesEndpointUri.AbsoluteUri;
request.CognitiveServicesEndpoint = options.CognitiveServicesEndpoint.AbsoluteUri;
}

request.AnsweredBy = Source == null ? null : new CommunicationUserIdentifierModel(Source.Id);
Expand Down Expand Up @@ -622,9 +622,9 @@ private CreateCallRequestInternal CreateCallRequest(CreateCallOptions options)
};

// Add custom cognitive service domain name
if (options.AzureCognitiveServicesEndpointUri != null)
if (options.CognitiveServicesEndpoint != null)
{
request.AzureCognitiveServicesEndpointUrl = options.AzureCognitiveServicesEndpointUri.AbsoluteUri;
request.CognitiveServicesEndpoint = options.CognitiveServicesEndpoint.AbsoluteUri;
}

request.OperationContext = options.OperationContext;
Expand All @@ -646,9 +646,9 @@ private CreateCallRequestInternal CreateCallRequest(CreateGroupCallOptions optio
};

// Add custom cognitive service domain name
if (options.AzureCognitiveServicesEndpointUri != null)
if (options.CognitiveServicesEndpoint != null)
{
request.AzureCognitiveServicesEndpointUrl = options.AzureCognitiveServicesEndpointUri.AbsoluteUri;
request.CognitiveServicesEndpoint = options.CognitiveServicesEndpoint.AbsoluteUri;
}

request.OperationContext = options.OperationContext;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

namespace Azure.Communication.CallAutomation
{
/// <summary><see cref="SendDtmfTonesEventResult"/> is returned from WaitForEvent of <see cref="SendDtmfTonesResult"/>.</summary>
public class SendDtmfTonesEventResult
{
/// <summary>
/// Indicates whether the returned event is considered successful or not.
/// </summary>
public bool IsSuccess { get; internal set; }

/// <summary>
/// <see cref="SendDtmfTonesCompleted"/> event will be returned once the dtmf tones have been sent successfully.
/// </summary>
public SendDtmfTonesCompleted SuccessResult { get; }

/// <summary>
/// <see cref="SendDtmfTonesFailed"/> event will be returned if send dtmf tones completed unsuccessfully.
/// </summary>
public SendDtmfTonesFailed FailureResult { get; }

internal SendDtmfTonesEventResult(bool isSuccess, SendDtmfTonesCompleted successResult, SendDtmfTonesFailed failureResult)
{
IsSuccess = isSuccess;
SuccessResult = successResult;
FailureResult = failureResult;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -662,47 +662,30 @@ public virtual CallMedia GetCallMedia()
/// Only Acs Users are currently supported.
/// </summary>
/// <param name="targetParticipant">Participant to mute.</param>
/// <param name="operationContext"> The Operation Context. </param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <exception cref="RequestFailedException">The server returned an error. See <see cref="Exception.Message"/> for details returned from the server.</exception>
/// <exception cref="ArgumentNullException"> <paramref name="targetParticipant"/> is null. </exception>
/// <returns>A Response containing MuteParticipantsResponse.</returns>
public virtual Response<MuteParticipantsResult> MuteParticipants(CommunicationIdentifier targetParticipant, CancellationToken cancellationToken = default)
{
var options = new MuteParticipantsOptions(new List<CommunicationIdentifier> { targetParticipant });

return MuteParticipants(options, cancellationToken);
}

/// <summary>
/// Mute participants from the call.
/// Only Acs Users are currently supported.
/// </summary>
/// <param name="options">Options for the MuteParticipant operation.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <exception cref="RequestFailedException">The server returned an error. See <see cref="Exception.Message"/> for details returned from the server.</exception>
/// <exception cref="ArgumentNullException"> <paramref name="options"/> is null. </exception>
/// <returns>A Response containing MuteParticipantsResponse. </returns>
public virtual Response<MuteParticipantsResult> MuteParticipants(MuteParticipantsOptions options, CancellationToken cancellationToken = default)
public virtual Response<MuteParticipantResult> MuteParticipant(CommunicationIdentifier targetParticipant, string operationContext = default, CancellationToken cancellationToken = default)
{
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallConnection)}.{nameof(MuteParticipants)}");
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallConnection)}.{nameof(MuteParticipant)}");
scope.Start();
try
{
if (options == null)
throw new ArgumentNullException(nameof(options));

MuteParticipantsRequestInternal request = new MuteParticipantsRequestInternal(
options.TargetParticipants.Select(participant => CommunicationIdentifierSerializer.Serialize(participant)));
MuteParticipantRequestInternal request = new(new List<CommunicationIdentifierModel>() { CommunicationIdentifierSerializer.Serialize(targetParticipant) });
var repeatabilityHeaders = new RepeatabilityHeaders();

request.OperationContext = options.OperationContext;
request.OperationContext = operationContext;

return RestClient.Mute(
var response = RestClient.Mute(
CallConnectionId,
request,
repeatabilityHeaders.RepeatabilityRequestId,
repeatabilityHeaders.RepeatabilityFirstSent,
cancellationToken);

return Response.FromValue(new MuteParticipantResult(response.Value), response.GetRawResponse());
}
catch (Exception ex)
{
Expand All @@ -716,47 +699,30 @@ public virtual Response<MuteParticipantsResult> MuteParticipants(MuteParticipant
/// Only Acs Users are currently supported.
/// </summary>
/// <param name="targetParticipant">Participants to mute.</param>
/// <param name="operationContext"> The Operation Context. </param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <exception cref="ArgumentNullException"> <paramref name="targetParticipant"/> is null. </exception>
/// <exception cref="RequestFailedException">The server returned an error. See <see cref="Exception.Message"/> for details returned from the server.</exception>
/// <returns></returns>
public async virtual Task<Response<MuteParticipantsResult>> MuteParticipantsAsync(CommunicationIdentifier targetParticipant, CancellationToken cancellationToken = default)
public async virtual Task<Response<MuteParticipantResult>> MuteParticipantAsync(CommunicationIdentifier targetParticipant, string operationContext = default, CancellationToken cancellationToken = default)
{
var options = new MuteParticipantsOptions(new List<CommunicationIdentifier> { targetParticipant });

return await MuteParticipantsAsync(options, cancellationToken).ConfigureAwait(false);
}

/// <summary>
/// Mute participants on the call.
/// </summary>
/// <param name="options">Options for the MuteParticipant operation.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <exception cref="ArgumentNullException"> <paramref name="options"/> is null. </exception>
/// <exception cref="ArgumentException"> <paramref name="options"/> OperationContext is too long. </exception>
/// <exception cref="RequestFailedException">The server returned an error. See <see cref="Exception.Message"/> for details returned from the server.</exception>
/// <returns></returns>
public async virtual Task<Response<MuteParticipantsResult>> MuteParticipantsAsync(MuteParticipantsOptions options, CancellationToken cancellationToken = default)
{
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallConnection)}.{nameof(MuteParticipants)}");
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallConnection)}.{nameof(MuteParticipant)}");
scope.Start();
try
{
if (options == null)
throw new ArgumentNullException(nameof(options));

MuteParticipantsRequestInternal request = new MuteParticipantsRequestInternal(
options.TargetParticipants.Select(participant => CommunicationIdentifierSerializer.Serialize(participant)));
MuteParticipantRequestInternal request = new(new List<CommunicationIdentifierModel>() { CommunicationIdentifierSerializer.Serialize(targetParticipant) });
var repeatabilityHeaders = new RepeatabilityHeaders();

request.OperationContext = options.OperationContext;
request.OperationContext = operationContext;

return await RestClient.MuteAsync(
var response = await RestClient.MuteAsync(
CallConnectionId,
request,
repeatabilityHeaders.RepeatabilityRequestId,
repeatabilityHeaders.RepeatabilityFirstSent,
cancellationToken).ConfigureAwait(false);

return Response.FromValue(new MuteParticipantResult(response.Value), response.GetRawResponse());
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ private static RecognizeRequestInternal CreateRecognizeRequest(CallMediaRecogniz
InitialSilenceTimeoutInSeconds = (int)recognizeChoiceOptions.InitialSilenceTimeout.TotalSeconds
};

recognizeChoiceOptions.RecognizeChoices
recognizeChoiceOptions.Choices
.ToList().ForEach(t => recognizeConfigurationsInternal.Choices.Add(t));

if (!String.IsNullOrEmpty(recognizeChoiceOptions.SpeechLanguage))
Expand Down Expand Up @@ -532,19 +532,19 @@ private static PlaySourceInternal TranslatePlaySourceToInternal(PlaySource playS
else if (playSource != null && playSource is TextSource textSource)
{
sourceInternal = new PlaySourceInternal(PlaySourceTypeInternal.Text);
sourceInternal.TextSource = new TextSourceInternal(textSource.Text);
sourceInternal.TextSource.SourceLocale = textSource.SourceLocale ?? null;
sourceInternal.TextSource.VoiceGender = textSource.VoiceGender ?? GenderType.Male;
sourceInternal.TextSource.VoiceName = textSource.VoiceName ?? null;
sourceInternal.TextSource.CustomVoiceEndpointId = textSource.CustomVoiceEndpointId ?? null;
sourceInternal.Text = new TextSourceInternal(textSource.Text);
sourceInternal.Text.SourceLocale = textSource.SourceLocale ?? null;
sourceInternal.Text.VoiceKind = textSource.VoiceKind ?? VoiceKind.Male;
sourceInternal.Text.VoiceName = textSource.VoiceName ?? null;
sourceInternal.Text.CustomVoiceEndpointId = textSource.CustomVoiceEndpointId ?? null;
sourceInternal.PlaySourceCacheId = textSource.PlaySourceCacheId;
return sourceInternal;
}
else if (playSource != null && playSource is SsmlSource ssmlSource)
{
sourceInternal = new PlaySourceInternal(PlaySourceTypeInternal.Ssml);
sourceInternal.SsmlSource = new SsmlSourceInternal(ssmlSource.SsmlText);
sourceInternal.SsmlSource.CustomVoiceEndpointId = ssmlSource.CustomVoiceEndpointId ?? null;
sourceInternal.Ssml = new SsmlSourceInternal(ssmlSource.SsmlText);
sourceInternal.Ssml.CustomVoiceEndpointId = ssmlSource.CustomVoiceEndpointId ?? null;
sourceInternal.PlaySourceCacheId = ssmlSource.PlaySourceCacheId;
return sourceInternal;
}
Expand Down Expand Up @@ -673,23 +673,24 @@ public virtual async Task<Response> StopContinuousDtmfRecognitionAsync(Communica
/// <param name="operationContext">An optional context object containing information about the operation, such as a unique identifier or custom metadata.</param>
/// <param name="cancellationToken">An optional CancellationToken to cancel the request.</param>
/// <returns>Returns a Response containing a SendDtmfResult object indicating the result of the send operation.</returns>
public virtual async Task<Response<SendDtmfResult>> SendDtmfAsync(IEnumerable<DtmfTone> tones, CommunicationIdentifier targetParticipant,
public virtual async Task<Response<SendDtmfTonesResult>> SendDtmfTonesAsync(IEnumerable<DtmfTone> tones, CommunicationIdentifier targetParticipant,
string operationContext = default, CancellationToken cancellationToken = default)
{
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(SendDtmf)}");
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(SendDtmfTones)}");
scope.Start();
try
{
SendDtmfRequestInternal request = request = new(tones, CommunicationIdentifierSerializer.Serialize(targetParticipant));

request.OperationContext = operationContext;
SendDtmfTonesRequestInternal request = new(tones, CommunicationIdentifierSerializer.Serialize(targetParticipant))
{
OperationContext = operationContext
};

var repeatabilityHeaders = new RepeatabilityHeaders();

var response = await CallMediaRestClient.SendDtmfAsync(CallConnectionId, request, repeatabilityHeaders.RepeatabilityRequestId,
var response = await CallMediaRestClient.SendDtmfTonesAsync(CallConnectionId, request, repeatabilityHeaders.RepeatabilityRequestId,
repeatabilityHeaders.RepeatabilityFirstSent, cancellationToken).ConfigureAwait(false);

var result = new SendDtmfResult();
var result = new SendDtmfTonesResult(response.Value.OperationContext);
result.SetEventProcessor(EventProcessor, CallConnectionId, response.Value.OperationContext);

return Response.FromValue(result, response.GetRawResponse());
Expand All @@ -709,23 +710,24 @@ public virtual async Task<Response<SendDtmfResult>> SendDtmfAsync(IEnumerable<Dt
/// <param name="operationContext">An optional context object containing information about the operation, such as a unique identifier or custom metadata.</param>
/// <param name="cancellationToken">An optional CancellationToken to cancel the request.</param>
/// <returns>Returns a Response containing a SendDtmfResult object indicating the result of the send operation.</returns>
public virtual Response<SendDtmfResult> SendDtmf(IEnumerable<DtmfTone> tones, CommunicationIdentifier targetParticipant,
public virtual Response<SendDtmfTonesResult> SendDtmfTones(IEnumerable<DtmfTone> tones, CommunicationIdentifier targetParticipant,
string operationContext = default, CancellationToken cancellationToken = default)
{
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(SendDtmf)}");
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallMedia)}.{nameof(SendDtmfTones)}");
scope.Start();
try
{
SendDtmfRequestInternal request = new(tones, CommunicationIdentifierSerializer.Serialize(targetParticipant));

request.OperationContext = operationContext;
SendDtmfTonesRequestInternal request = new(tones, CommunicationIdentifierSerializer.Serialize(targetParticipant))
{
OperationContext = operationContext
};

var repeatabilityHeaders = new RepeatabilityHeaders();

var response = CallMediaRestClient.SendDtmf(CallConnectionId, request, repeatabilityHeaders.RepeatabilityRequestId,
var response = CallMediaRestClient.SendDtmfTones(CallConnectionId, request, repeatabilityHeaders.RepeatabilityRequestId,
repeatabilityHeaders.RepeatabilityFirstSent, cancellationToken);

var result = new SendDtmfResult();
var result = new SendDtmfTonesResult(response.Value.OperationContext);
result.SetEventProcessor(EventProcessor, CallConnectionId, response.Value.OperationContext);

return Response.FromValue(result, response.GetRawResponse());
Expand Down
Loading