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

Create call improvements #33932

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
0265fe6
add Call Invite class
richardcho-msft Feb 7, 2023
a4c2acb
integrate call invite to create call
richardcho-msft Feb 7, 2023
2887e08
fix tests
richardcho-msft Feb 7, 2023
d43ca2f
add Call Invite class (#33929)
richardcho-msft Feb 7, 2023
a33fa62
fixing build with autorest
minwoolee-msft Feb 7, 2023
acbc69c
fixing build by removing sip headers for now
minwoolee-msft Feb 7, 2023
8824b54
api file update
minwoolee-msft Feb 7, 2023
1b10570
integrate call invite to create call
richardcho-msft Feb 7, 2023
9db89a0
fix tests
richardcho-msft Feb 7, 2023
a52299f
Merge branch 'richardcho/callinvite' into richardcho/create-call
richardcho-msft Feb 7, 2023
36e4222
Merge branch 'richardcho/create-call' of https://github.com/richardch…
richardcho-msft Feb 7, 2023
be317a3
remove validation related unit tests
richardcho-msft Feb 7, 2023
211dd65
fix tests
richardcho-msft Feb 7, 2023
7d4b830
integrate call invite to create call
richardcho-msft Feb 7, 2023
749bdc0
fix tests
richardcho-msft Feb 7, 2023
0b40dbd
remove validation related unit tests
richardcho-msft Feb 7, 2023
3f3511c
fix tests
richardcho-msft Feb 7, 2023
23b5276
Merge branch 'richardcho/create-call' of https://github.com/richardch…
richardcho-msft Feb 7, 2023
ec579d6
remove comment
richardcho-msft Feb 8, 2023
22062d1
integrate call invite to create call
richardcho-msft Feb 7, 2023
ecbcf5b
fix tests
richardcho-msft Feb 7, 2023
8854fff
remove validation related unit tests
richardcho-msft Feb 7, 2023
0ed41d1
fix tests
richardcho-msft Feb 7, 2023
04e2b40
fix tests
richardcho-msft Feb 7, 2023
240d070
Merge branch 'richardcho/callinvite' into richardcho/create-call
richardcho-msft Feb 7, 2023
233c880
Merge branch 'richardcho/create-call' of https://github.com/richardch…
richardcho-msft Feb 7, 2023
edb3696
remove validation related unit tests
richardcho-msft Feb 7, 2023
5a5f550
fix tests
richardcho-msft Feb 7, 2023
c1519d0
Merge branch 'richardcho/create-call' of https://github.com/richardch…
richardcho-msft Feb 7, 2023
4390eb2
remove comment
richardcho-msft Feb 8, 2023
ae2631e
Merge branch 'richardcho/create-call' of https://github.com/richardch…
richardcho-msft Feb 8, 2023
2bd8929
resolve conflit
richardcho-msft Feb 8, 2023
3ab516f
fix merge conflicts
richardcho-msft Feb 8, 2023
2d1d092
make repeatabilityHeaders internal and generated automatically (#33965)
yyw-msft Feb 8, 2023
571d418
integrate call invite to create call
richardcho-msft Feb 7, 2023
8efe6d0
update auto gen
richardcho-msft Feb 8, 2023
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
37 changes: 1 addition & 36 deletions sdk/communication/Azure.Communication.CallAutomation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,41 +113,6 @@ Your app will receive mid-connection call back events via the callbackEndpoint y
return Ok();
}
```
### Idempotent Requests
An operation is idempotent if it can be performed multiple times and have the same result as a single execution.

The following operations are idempotent:
- `AnswerCall`
- `RedirectCall`
- `RejectCall`
- `CreateCall`
- `HangUp` when terminating the call for everyone, ie. `forEveryone` parameter is set to `true`.
- `TransferCallToParticipant`
- `AddParticipants`
- `RemoveParticipants`
- `StartRecording`

By default, SDK generates a new `RepeatabilityHeaders` object every time the above operation is called. If you would
like to provide your own `RepeatabilityHeaders` for your application (eg. for your own retry mechanism), you can do so by specifying
the `RepeatabilityHeaders` in the operation's `Options` object. If this is not set by user, then the SDK will generate
it. You can also disable this by setting `RepeatabilityHeaders` to NULL in the option.

The parameters for the `RepeatabilityHeaders` class are `repeatabilityRequestId` and `repeatabilityFirstSent`. Two or
more requests are considered the same request **if and only if** both repeatability parameters are the same.
- `repeatabilityRequestId`: an opaque string representing a client-generated unique identifier for the request.
It is a version 4 (random) UUID.
- `repeatabilityFirstSent`: The value should be the date and time at which the request was **first** created.

To set repeatability parameters, see below C# code snippet as an example:
```C#
var createCallOptions = new CreateCallOptions(callSource, new CommunicationIdentifier[] { target }, new Uri("https://exmaple.com/callback")) {
RepeatabilityHeaders = new RepeatabilityHeaders(Guid.NewGuid(), DateTimeOffset.UtcNow);
};
CreateCallResult response1 = await callAutomationClient.CreateCallAsync(createCallOptions).ConfigureAwait(false);
await Task.Delay(5000);
CreateCallResult response2 = await callAutomationClient.CreateCallAsync(createCallOptions).ConfigureAwait(false);
// response1 and response2 will have the same CallConnectionId as they have the same reapeatability parameters which means that the CreateCall operation was only executed once.
```

## Troubleshooting
A `RequestFailedException` is thrown as a service response for any unsuccessful requests. The exception contains information about what response code was returned from the service.
Expand Down Expand Up @@ -188,4 +153,4 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m
[build3]: https://learn.microsoft.com/azure/communication-services/quickstarts/voice-video-calling/play-action?pivots=programming-language-csharp
[build4]: https://learn.microsoft.com/azure/communication-services/quickstarts/voice-video-calling/recognize-action?pivots=programming-language-csharp
[recording1]: https://learn.microsoft.com/azure/communication-services/concepts/voice-video-calling/call-recording
[recording2]: https://learn.microsoft.com/azure/communication-services/quickstarts/voice-video-calling/get-started-call-recording?pivots=programming-language-csharp
[recording2]: https://learn.microsoft.com/azure/communication-services/quickstarts/voice-video-calling/get-started-call-recording?pivots=programming-language-csharp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public AddParticipantsOptions(System.Collections.Generic.IEnumerable<Azure.Commu
public int? InvitationTimeoutInSeconds { get { throw null; } set { } }
public string OperationContext { get { throw null; } set { } }
public System.Collections.Generic.IEnumerable<Azure.Communication.CommunicationIdentifier> ParticipantsToAdd { get { throw null; } }
public Azure.Communication.CallAutomation.RepeatabilityHeaders RepeatabilityHeaders { get { throw null; } set { } }
public System.Collections.Generic.IDictionary<string, string> SipHeaders { get { throw null; } set { } }
public Azure.Communication.PhoneNumberIdentifier SourceCallerId { get { throw null; } set { } }
public string SourceDisplayName { get { throw null; } set { } }
Expand Down Expand Up @@ -50,7 +49,6 @@ public AnswerCallOptions(string incomingCallContext, System.Uri callbackUri) { }
public System.Uri CallbackUri { get { throw null; } }
public string IncomingCallContext { get { throw null; } }
public Azure.Communication.CallAutomation.MediaStreamingOptions MediaStreamingOptions { get { throw null; } set { } }
public Azure.Communication.CallAutomation.RepeatabilityHeaders RepeatabilityHeaders { get { throw null; } set { } }
}
public partial class AnswerCallResult : Azure.Communication.CallAutomation.ResultWithWaitForEventBase
{
Expand All @@ -70,11 +68,16 @@ public CallAutomationClient(System.Uri pmaEndpoint, string connectionString, Azu
public virtual Azure.Response<Azure.Communication.CallAutomation.AnswerCallResult> AnswerCall(string incomingCallContext, System.Uri callbackUri, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Communication.CallAutomation.AnswerCallResult>> AnswerCallAsync(Azure.Communication.CallAutomation.AnswerCallOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Communication.CallAutomation.AnswerCallResult>> AnswerCallAsync(string incomingCallContext, System.Uri callbackUri, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.Communication.CallAutomation.CreateCallResult> CreateCall(Azure.Communication.CallAutomation.CallInvite callInvite, System.Uri callbackUri, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.Communication.CallAutomation.CreateCallResult> CreateCall(Azure.Communication.CallAutomation.CreateCallOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Communication.CallAutomation.CreateCallResult>> CreateCallAsync(Azure.Communication.CallAutomation.CallInvite callInvite, System.Uri callbackUri, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Communication.CallAutomation.CreateCallResult>> CreateCallAsync(Azure.Communication.CallAutomation.CreateCallOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.Communication.CallAutomation.CreateCallResult> CreateGroupCall(Azure.Communication.CallAutomation.CreateGroupCallOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Communication.CallAutomation.CreateCallResult>> CreateGroupCallAsync(Azure.Communication.CallAutomation.CreateGroupCallOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Communication.CallAutomation.CallConnection GetCallConnection(string callConnectionId) { throw null; }
public virtual Azure.Communication.CallAutomation.CallRecording GetCallRecording() { throw null; }
public virtual Azure.Communication.CallAutomation.EventProcessor GetEventProcessor() { throw null; }
public virtual Azure.Communication.CommunicationUserIdentifier GetSourceIdentity() { throw null; }
public virtual Azure.Response RedirectCall(Azure.Communication.CallAutomation.RedirectCallOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response RedirectCall(string incomingCallContext, Azure.Communication.CommunicationIdentifier target, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response> RedirectCallAsync(Azure.Communication.CallAutomation.RedirectCallOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
Expand All @@ -86,7 +89,7 @@ public CallAutomationClient(System.Uri pmaEndpoint, string connectionString, Azu
}
public partial class CallAutomationClientOptions : Azure.Core.ClientOptions
{
public CallAutomationClientOptions(Azure.Communication.CallAutomation.CallAutomationClientOptions.ServiceVersion version = Azure.Communication.CallAutomation.CallAutomationClientOptions.ServiceVersion.V2023_01_15_Preview) { }
public CallAutomationClientOptions(Azure.Communication.CallAutomation.CallAutomationClientOptions.ServiceVersion version = Azure.Communication.CallAutomation.CallAutomationClientOptions.ServiceVersion.V2023_01_15_Preview, Azure.Communication.CommunicationUserIdentifier source = null) { }
public Azure.Communication.CallAutomation.EventProcessorOptions EventProcessorOptions { get { throw null; } }
public enum ServiceVersion
{
Expand Down Expand Up @@ -230,6 +233,15 @@ public partial class CallDisconnected : Azure.Communication.CallAutomation.CallA
internal CallDisconnected() { }
public static Azure.Communication.CallAutomation.CallDisconnected Deserialize(string content) { throw null; }
}
public partial class CallInvite
{
public CallInvite(Azure.Communication.CommunicationUserIdentifier targetIdentity) { }
public CallInvite(Azure.Communication.MicrosoftTeamsUserIdentifier targetIdentity) { }
public CallInvite(Azure.Communication.PhoneNumberIdentifier targetPhoneNumberIdentity, Azure.Communication.PhoneNumberIdentifier callerIdNumber) { }
public Azure.Communication.PhoneNumberIdentifier SourceCallerIdNumber { get { throw null; } }
public string SourceDisplayName { get { throw null; } set { } }
public Azure.Communication.CommunicationIdentifier Target { get { throw null; } }
}
public abstract partial class CallLocator : System.IEquatable<Azure.Communication.CallAutomation.CallLocator>
{
protected CallLocator() { }
Expand Down Expand Up @@ -402,14 +414,12 @@ internal CreateCallEventResult() { }
}
public partial class CreateCallOptions
{
public CreateCallOptions(Azure.Communication.CallAutomation.CallSource callSource, System.Collections.Generic.IEnumerable<Azure.Communication.CommunicationIdentifier> targets, System.Uri callbackUri) { }
public CreateCallOptions(Azure.Communication.CallAutomation.CallInvite callInvite, System.Uri callbackUri) { }
public System.Uri AzureCognitiveServicesEndpointUrl { get { throw null; } set { } }
public System.Uri CallbackUri { get { throw null; } }
public Azure.Communication.CallAutomation.CallSource CallSource { get { throw null; } }
public Azure.Communication.CallAutomation.CallInvite CallInvite { get { throw null; } }
public Azure.Communication.CallAutomation.MediaStreamingOptions MediaStreamingOptions { get { throw null; } set { } }
public string OperationContext { get { throw null; } set { } }
public Azure.Communication.CallAutomation.RepeatabilityHeaders RepeatabilityHeaders { get { throw null; } set { } }
public System.Collections.Generic.IReadOnlyList<Azure.Communication.CommunicationIdentifier> Targets { get { throw null; } }
}
public partial class CreateCallResult : Azure.Communication.CallAutomation.ResultWithWaitForEventBase
{
Expand All @@ -418,6 +428,17 @@ internal CreateCallResult() { }
public Azure.Communication.CallAutomation.CallConnectionProperties CallConnectionProperties { get { throw null; } }
public System.Threading.Tasks.Task<Azure.Communication.CallAutomation.CreateCallEventResult> WaitForEvent(System.TimeSpan eventTimeout = default(System.TimeSpan)) { throw null; }
}
public partial class CreateGroupCallOptions
{
public CreateGroupCallOptions(System.Collections.Generic.IEnumerable<Azure.Communication.CommunicationIdentifier> targets, System.Uri callbackUri) { }
public System.Uri AzureCognitiveServicesEndpointUrl { get { throw null; } set { } }
public System.Uri CallbackUri { get { throw null; } }
public Azure.Communication.CallAutomation.MediaStreamingOptions MediaStreamingOptions { get { throw null; } set { } }
public string OperationContext { get { throw null; } set { } }
public Azure.Communication.PhoneNumberIdentifier SourceCallerIdNumber { get { throw null; } set { } }
public string SourceDisplayName { get { throw null; } set { } }
public System.Collections.Generic.IEnumerable<Azure.Communication.CommunicationIdentifier> Targets { get { throw null; } }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct DtmfTone : System.IEquatable<Azure.Communication.CallAutomation.DtmfTone>
{
Expand Down Expand Up @@ -504,7 +525,6 @@ public partial class HangUpOptions
{
public HangUpOptions(bool forEveryone) { }
public bool ForEveryone { get { throw null; } }
public Azure.Communication.CallAutomation.RepeatabilityHeaders RepeatabilityHeaders { get { throw null; } set { } }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct MediaStreamingAudioChannel : System.IEquatable<Azure.Communication.CallAutomation.MediaStreamingAudioChannel>
Expand Down Expand Up @@ -610,7 +630,6 @@ public partial class MuteParticipantsOptions
{
public MuteParticipantsOptions(System.Collections.Generic.IEnumerable<Azure.Communication.CommunicationIdentifier> targetParticipants) { }
public string OperationContext { get { throw null; } set { } }
public Azure.Communication.CallAutomation.RepeatabilityHeaders RepeatabilityHeaders { get { throw null; } set { } }
public System.Collections.Generic.IEnumerable<Azure.Communication.CommunicationIdentifier> TargetParticipants { get { throw null; } }
}
public partial class MuteParticipantsResponse
Expand Down Expand Up @@ -846,35 +865,25 @@ public partial class RedirectCallOptions
{
public RedirectCallOptions(string incomingCallContext, Azure.Communication.CommunicationIdentifier target) { }
public string IncomingCallContext { get { throw null; } }
public Azure.Communication.CallAutomation.RepeatabilityHeaders RepeatabilityHeaders { get { throw null; } set { } }
public Azure.Communication.CommunicationIdentifier Target { get { throw null; } }
}
public partial class RejectCallOptions
{
public RejectCallOptions(string incomingCallContext) { }
public Azure.Communication.CallAutomation.CallRejectReason CallRejectReason { get { throw null; } set { } }
public string IncomingCallContext { get { throw null; } }
public Azure.Communication.CallAutomation.RepeatabilityHeaders RepeatabilityHeaders { get { throw null; } set { } }
}
public partial class RemoveParticipantsOptions
{
public RemoveParticipantsOptions(System.Collections.Generic.IEnumerable<Azure.Communication.CommunicationIdentifier> participantsToRemove) { }
public string OperationContext { get { throw null; } set { } }
public System.Collections.Generic.IReadOnlyList<Azure.Communication.CommunicationIdentifier> ParticipantsToRemove { get { throw null; } }
public Azure.Communication.CallAutomation.RepeatabilityHeaders RepeatabilityHeaders { get { throw null; } set { } }
}
public partial class RemoveParticipantsResult
{
internal RemoveParticipantsResult() { }
public string OperationContext { get { throw null; } }
}
public partial class RepeatabilityHeaders
{
public RepeatabilityHeaders() { }
public RepeatabilityHeaders(System.Guid repeatabilityRequestId, System.DateTimeOffset repeatabilityFirstSent) { }
public System.DateTimeOffset RepeatabilityFirstSent { get { throw null; } }
public System.Guid RepeatabilityRequestId { get { throw null; } }
}
public partial class ResultInformation
{
internal ResultInformation() { }
Expand Down Expand Up @@ -914,7 +923,6 @@ public StartRecordingOptions(Azure.Communication.CallAutomation.CallLocator call
public Azure.Communication.CallAutomation.RecordingFormat RecordingFormat { get { throw null; } set { } }
public System.Uri RecordingStateCallbackEndpoint { get { throw null; } set { } }
public Azure.Communication.CallAutomation.RecordingStorageType? RecordingStorageType { get { throw null; } set { } }
public Azure.Communication.CallAutomation.RepeatabilityHeaders RepeatabilityHeaders { get { throw null; } set { } }
}
public partial class TextSource : Azure.Communication.CallAutomation.PlaySource
{
Expand Down Expand Up @@ -942,7 +950,6 @@ public partial class TransferToParticipantOptions
{
public TransferToParticipantOptions(Azure.Communication.CommunicationIdentifier targetParticipant) { }
public string OperationContext { get { throw null; } set { } }
public Azure.Communication.CallAutomation.RepeatabilityHeaders RepeatabilityHeaders { get { throw null; } set { } }
public Azure.Communication.PhoneNumberIdentifier SourceCallerId { get { throw null; } set { } }
public Azure.Communication.CommunicationIdentifier TargetParticipant { get { throw null; } }
public string UserToUserInformation { get { throw null; } set { } }
Expand All @@ -951,7 +958,6 @@ public partial class UnmuteParticipantsOptions
{
public UnmuteParticipantsOptions(System.Collections.Generic.IEnumerable<Azure.Communication.CommunicationIdentifier> targetParticipant) { }
public string OperationContext { get { throw null; } set { } }
public Azure.Communication.CallAutomation.RepeatabilityHeaders RepeatabilityHeaders { get { throw null; } set { } }
public System.Collections.Generic.IEnumerable<Azure.Communication.CommunicationIdentifier> TargetParticipants { get { throw null; } }
}
public partial class UnmuteParticipantsResponse
Expand Down
Loading