Skip to content

Commit

Permalink
[ACS][GA1] Clean Commit (#36550)
Browse files Browse the repository at this point in the history
* clean commit

* Updated comments on start recording options

---------

Co-authored-by: Min Woo Lee 🧊 <77083090+minwoolee-ms@users.noreply.github.com>
  • Loading branch information
2 people authored and abhishesingh-msft committed Sep 18, 2023
1 parent 031a2f8 commit d6ae96f
Show file tree
Hide file tree
Showing 175 changed files with 484 additions and 4,995 deletions.
21 changes: 14 additions & 7 deletions sdk/communication/Azure.Communication.CallAutomation/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
# Release History

## 1.1.0-beta.1 (Unreleased)
## 1.0.0 (2023-06-14)

### Features Added

### Breaking Changes

### Bugs Fixed
### Features Added
- Outbound calls can now be created without providing a User Identifier. This value can be specified in the CallAutomationClientOption if desired.
- AnswerCall now accepts OperationContext.
- Calls can be answered by a specific communication identifier user.
- RemoveParticipant now sends success and failure events with the request.
- ParticipantsUpdated event now includes a sequence number to distinguish the ordering of events.
- CallConnectionProperties now includes CorrelationId.
- StartRecording now accepts ChannelAffinity.
- Added EventProcessor, an easy and powerful way to handle Call Automation events. See README for details.

### Other Changes
### Breaking Changes
- AddParticipant and RemoveParticipant now only accept one participant at a time.
- CallSource has been flattened out.
- CallInvite model replaces previous models for handling outbound calls.

## 1.0.0 (2023-06-14)

Expand Down
12 changes: 6 additions & 6 deletions sdk/communication/Azure.Communication.CallAutomation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ public IActionResult OnMidConnectionCallBackEvent([FromBody] CloudEvent[] events
# cast the event into a ParticipantUpdated event and do something with it. Eg. iterate through the participants
ParticipantsUpdated updatedEvent = (ParticipantsUpdated)ev;
break;
case AddParticipantsSucceeded ev:
# logic to handle an AddParticipantsSucceeded event
case AddParticipantSucceeded ev:
# logic to handle an AddParticipantSucceeded event
break;
case AddParticipantsFailed ev:
# logic to handle an AddParticipantsFailed event
case AddParticipantFailed ev:
# logic to handle an AddParticipantFailed event
break;
case CallTransferAccepted ev:
# logic to handle CallTransferAccepted event
Expand Down Expand Up @@ -155,10 +155,10 @@ CancellationToken token = cts.Token;
try
{
// this will wait until CreateCall is completed or Timesout!
CreateCallEventResult eventResult = await createCallResult.WaitForEventAsync(token);
CreateCallEventResult eventResult = await createCallResult.WaitForEventProcessorAsync(token);

// Once this is recieved, you know the call is now connected.
CallConnected returnedEvent = eventResult.SuccessEvent;
CallConnected returnedEvent = eventResult.SuccessResult;

// ...Do more actions, such as Play or AddParticipant, since the call is established...
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Microsoft Azure Communication Call Automation quickstart - https://learn.microsoft.com/azure/communication-services/quickstarts/voice-video-calling/callflows-for-customer-interactions?pivots=programming-language-csharp
</Description>
<AssemblyTitle>Azure Communication CallAutomation Service</AssemblyTitle>
<Version>1.1.0-beta.1</Version>
<Version>1.0.0</Version>
<!--The ApiCompatVersion is managed automatically and should not generally be modified manually.-->
<PackageTags>Microsoft Azure Communication CallAutomation Service;Microsoft;Azure;Azure Communication Service;Azure Communication CallAutomation Service;Calling;Communication;$(PackageCommonTags)</PackageTags>
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class CallAutomationClient
/// This can be provided by providing CallAutomationClientOption during construction of CallAutomationClient.
/// If left blank, service will create one each request.
/// </summary>
/// <returns></returns>
public CommunicationUserIdentifier Source { get; }

#region public constructors
Expand Down Expand Up @@ -64,31 +65,6 @@ public CallAutomationClient(Uri endpoint, TokenCredential credential, CallAutoma
Argument.CheckNotNull(credential, nameof(credential)),
options ?? new CallAutomationClientOptions())
{ }

/// <summary> Initializes a new instance of <see cref="CallAutomationClient"/> with custom PMA endpoint.</summary>
/// <param name="pmaEndpoint">Endpoint for PMA</param>
/// <param name="connectionString">Connection string acquired from the Azure Communication Services resource.</param>
/// <param name="options">Client option exposing <see cref="ClientOptions.Diagnostics"/>, <see cref="ClientOptions.Retry"/>, <see cref="ClientOptions.Transport"/>, etc.</param>
public CallAutomationClient(Uri pmaEndpoint, string connectionString, CallAutomationClientOptions options = default)
: this(
pmaEndpoint,
options ?? new CallAutomationClientOptions(),
ConnectionString.Parse(connectionString))
{ }

/// <summary> Initializes a new instance of <see cref="CallAutomationClient"/>.</summary>
/// <param name="pmaEndpoint">Endpoint for PMA</param>
/// <param name="acsEndpoint">The URI of the Azure Communication Services resource.</param>
/// <param name="credential">The TokenCredential used to authenticate requests, such as DefaultAzureCredential.</param>
/// <param name="options">Client option exposing <see cref="ClientOptions.Diagnostics"/>, <see cref="ClientOptions.Retry"/>, <see cref="ClientOptions.Transport"/>, etc.</param>
public CallAutomationClient(Uri pmaEndpoint, Uri acsEndpoint, TokenCredential credential, CallAutomationClientOptions options = default)
: this(
pmaEndpoint,
acsEndpoint,
options ?? new CallAutomationClientOptions(),
credential
)
{ }
#endregion

#region private constructors
Expand Down Expand Up @@ -120,14 +96,6 @@ private CallAutomationClient(Uri endpoint, HttpPipeline httpPipeline, CallAutoma
EventProcessor = new CallAutomationEventProcessor();
Source = options.Source;
}

private CallAutomationClient(
Uri pmaEndpoint,
Uri acsEndpoint,
CallAutomationClientOptions options,
TokenCredential tokenCredential)
: this(pmaEndpoint, options.CustomBuildHttpPipeline(acsEndpoint, tokenCredential), options)
{ }
#endregion

/// <summary>Initializes a new instance of <see cref="CallAutomationClient"/> for mocking.</summary>
Expand Down Expand Up @@ -245,8 +213,7 @@ private AnswerCallRequestInternal CreateAnswerCallRequest(AnswerCallOptions opti
{
request.AzureCognitiveServicesEndpointUrl = options.AzureCognitiveServicesEndpointUri.AbsoluteUri;
}
request.MediaStreamingConfiguration = CreateMediaStreamingOptionsInternal(options.MediaStreamingOptions);
request.AnsweredByIdentifier = Source == null ? null : new CommunicationUserIdentifierModel(Source.Id);
request.AnsweredBy = Source == null ? null : new CommunicationUserIdentifierModel(Source.Id);
request.OperationContext = options.OperationContext;

return request;
Expand Down Expand Up @@ -282,9 +249,6 @@ public virtual async Task<Response> RedirectCallAsync(RedirectCallOptions option

RedirectCallRequestInternal request = new RedirectCallRequestInternal(options.IncomingCallContext, CommunicationIdentifierSerializer.Serialize(options.CallInvite.Target));

request.CustomContext = new CustomContextInternal(
options.CallInvite.CustomContext.SipHeaders == null ? new ChangeTrackingDictionary<string, string>() : options.CallInvite.CustomContext.SipHeaders,
options.CallInvite.CustomContext.VoipHeaders == null ? new ChangeTrackingDictionary<string, string>() : options.CallInvite.CustomContext.VoipHeaders);

return await AzureCommunicationServicesRestClient.RedirectCallAsync(request, cancellationToken).ConfigureAwait(false);
}
Expand Down Expand Up @@ -325,10 +289,6 @@ public virtual Response RedirectCall(RedirectCallOptions options, CancellationTo

RedirectCallRequestInternal request = new RedirectCallRequestInternal(options.IncomingCallContext, CommunicationIdentifierSerializer.Serialize(options.CallInvite.Target));

request.CustomContext = new CustomContextInternal(
options.CallInvite.CustomContext.SipHeaders == null ? new ChangeTrackingDictionary<string, string>() : options.CallInvite.CustomContext.SipHeaders,
options.CallInvite.CustomContext.VoipHeaders == null ? new ChangeTrackingDictionary<string, string>() : options.CallInvite.CustomContext.VoipHeaders);

return AzureCommunicationServicesRestClient.RedirectCall(request, cancellationToken);
}
catch (Exception ex)
Expand Down Expand Up @@ -610,20 +570,15 @@ private CreateCallRequestInternal CreateCallRequest(CreateCallOptions options)
? null
: new PhoneNumberIdentifierModel(options?.CallInvite?.SourceCallerIdNumber?.PhoneNumber),
SourceDisplayName = options?.CallInvite?.SourceDisplayName,
SourceIdentity = Source == null ? null : new CommunicationUserIdentifierModel(Source.Id),
Source = Source == null ? null : new CommunicationUserIdentifierModel(Source.Id),
};

request.CustomContext = new CustomContextInternal(
options.CallInvite.CustomContext.SipHeaders == null ? new ChangeTrackingDictionary<string, string>() : options.CallInvite.CustomContext.SipHeaders,
options.CallInvite.CustomContext.VoipHeaders == null ? new ChangeTrackingDictionary<string, string>() : options.CallInvite.CustomContext.VoipHeaders);

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

return request;
}
Expand All @@ -638,21 +593,15 @@ private CreateCallRequestInternal CreateCallRequest(CreateGroupCallOptions optio
? null
: new PhoneNumberIdentifierModel(options?.SourceCallerIdNumber?.PhoneNumber),
SourceDisplayName = options?.SourceDisplayName,
SourceIdentity = Source == null ? null : new CommunicationUserIdentifierModel(Source.Id),
Source = Source == null ? null : new CommunicationUserIdentifierModel(Source.Id),
};

request.CustomContext = new CustomContextInternal(
options.CustomContext.SipHeaders == null ? new ChangeTrackingDictionary<string, string>() : options.CustomContext.SipHeaders,
options.CustomContext.VoipHeaders == null ? new ChangeTrackingDictionary<string, string>() : options.CustomContext.VoipHeaders);

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

return request;
}

Expand All @@ -668,14 +617,6 @@ private static bool IsValidHttpsUri(Uri uri) {
return Uri.IsWellFormedUriString(uriString, UriKind.Absolute) && new Uri(uriString).Scheme == Uri.UriSchemeHttps;
}

private static MediaStreamingOptionsInternal CreateMediaStreamingOptionsInternal(MediaStreamingOptions configuration)
{
return configuration == default
? default
: new MediaStreamingOptionsInternal(configuration.TransportUri.AbsoluteUri, configuration.MediaStreamingTransport, configuration.MediaStreamingContent,
configuration.MediaStreamingAudioChannel);
}

/// <summary> Initializes a new instance of CallConnection. <see cref="CallConnection"/>.</summary>
/// <param name="callConnectionId"> The call connection id for the GetCallConnection instance. </param>
public virtual CallConnection GetCallConnection(string callConnectionId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class CallAutomationClientOptions : ClientOptions
/// <summary>
/// The latest version of the CallAutomation service.
/// </summary>
internal const ServiceVersion LatestVersion = ServiceVersion.V2023_01_15_Preview;
internal const ServiceVersion LatestVersion = ServiceVersion.V2023_03_06;

internal string ApiVersion { get; }

Expand All @@ -32,7 +32,7 @@ public CallAutomationClientOptions(ServiceVersion version = LatestVersion)
{
ApiVersion = version switch
{
ServiceVersion.V2023_01_15_Preview => "2023-01-15-preview",
ServiceVersion.V2023_03_06 => "2023-03-06",
_ => throw new ArgumentOutOfRangeException(nameof(version)),
};
}
Expand All @@ -43,10 +43,10 @@ public CallAutomationClientOptions(ServiceVersion version = LatestVersion)
public enum ServiceVersion
{
/// <summary>
/// The Beta of the CallAutomation service.
/// The GA1 of the CallAutomation service.
/// </summary>
#pragma warning disable CA1707 // Identifiers should not contain underscores
V2023_01_15_Preview = 1
V2023_03_06 = 1
#pragma warning restore CA1707 // Identifiers should not contain underscores
}
}
Expand Down

This file was deleted.

Loading

0 comments on commit d6ae96f

Please sign in to comment.