Skip to content

Commit 407b666

Browse files
authored
Update CallMedia, CallConnection, and CallRecording methods and models based on ABR feedback (Azure#35746)
* add media fixes * add callconnection and callrecording updates * revert playmedia() method back to play() * export api * update media docstrings and playoptions * update api * add simple method overloads for play
1 parent 03cc79f commit 407b666

27 files changed

+511
-288
lines changed

sdk/communication/Azure.Communication.CallAutomation/api/Azure.Communication.CallAutomation.netstandard2.0.cs

Lines changed: 80 additions & 67 deletions
Large diffs are not rendered by default.

sdk/communication/Azure.Communication.CallAutomation/src/CallAutomationEventProcessor/EventResult/StartRecognizingEventResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace Azure.Communication.CallAutomation
55
{
6-
/// <summary><see cref="StartRecognizingEventResult"/> is returned from WaitForEvent of <see cref="StartRecognizingResult"/>.</summary>
6+
/// <summary><see cref="StartRecognizingEventResult"/> is returned from WaitForEvent of <see cref="StartRecognizingCallMediaResult"/>.</summary>
77
public class StartRecognizingEventResult
88
{
99
/// <summary>

sdk/communication/Azure.Communication.CallAutomation/src/CallConnection.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -479,20 +479,20 @@ private static AddParticipantRequestInternal CreateAddParticipantRequest(AddPart
479479
}
480480

481481
/// <summary> Get participant from a call. </summary>
482-
/// <param name="participantMri">The participant's MRI.</param>
482+
/// <param name="participantIdentifier">The participant's identifier.</param>
483483
/// <param name="cancellationToken"> The cancellation token. </param>
484484
/// <exception cref="RequestFailedException">The server returned an error. See <see cref="Exception.Message"/> for details returned from the server.</exception>
485-
/// <exception cref="ArgumentNullException"> <paramref name="participantMri"/> is null. </exception>
485+
/// <exception cref="ArgumentNullException"> <paramref name="participantIdentifier"/> is null. </exception>
486486
/// <returns>The <see cref="CallParticipant"/>.</returns>
487-
public virtual async Task<Response<CallParticipant>> GetParticipantAsync(string participantMri, CancellationToken cancellationToken = default)
487+
public virtual async Task<Response<CallParticipant>> GetParticipantAsync(CommunicationIdentifier participantIdentifier, CancellationToken cancellationToken = default)
488488
{
489489
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallConnection)}.{nameof(GetParticipant)}");
490490
scope.Start();
491491
try
492492
{
493493
var response = await RestClient.GetParticipantAsync(
494494
callConnectionId: CallConnectionId,
495-
participantMri,
495+
participantIdentifier.RawId,
496496
cancellationToken: cancellationToken
497497
).ConfigureAwait(false);
498498

@@ -506,20 +506,20 @@ public virtual async Task<Response<CallParticipant>> GetParticipantAsync(string
506506
}
507507

508508
/// <summary> Get participant from a call. </summary>
509-
/// <param name="participantMri">The participant MRI.</param>
509+
/// <param name="participantIdentifier">The participant identifier.</param>
510510
/// <param name="cancellationToken"> The cancellation token. </param>
511511
/// <exception cref="RequestFailedException">The server returned an error. See <see cref="Exception.Message"/> for details returned from the server.</exception>
512-
/// <exception cref="ArgumentNullException"> <paramref name="participantMri"/> is null. </exception>
512+
/// <exception cref="ArgumentNullException"> <paramref name="participantIdentifier"/> is null. </exception>
513513
/// <returns>The <see cref="CallParticipant"/>.</returns>
514-
public virtual Response<CallParticipant> GetParticipant(string participantMri, CancellationToken cancellationToken = default)
514+
public virtual Response<CallParticipant> GetParticipant(CommunicationIdentifier participantIdentifier, CancellationToken cancellationToken = default)
515515
{
516516
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallConnection)}.{nameof(GetParticipant)}");
517517
scope.Start();
518518
try
519519
{
520520
var response = RestClient.GetParticipant(
521521
callConnectionId: CallConnectionId,
522-
participantMri,
522+
participantIdentifier.RawId,
523523
cancellationToken: cancellationToken
524524
);
525525

sdk/communication/Azure.Communication.CallAutomation/src/CallMedia.cs

Lines changed: 162 additions & 50 deletions
Large diffs are not rendered by default.

sdk/communication/Azure.Communication.CallAutomation/src/CallRecording.cs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,18 @@ protected CallRecording()
4747
/// </summary>
4848
/// <param name="options">Options for start recording</param>
4949
/// <param name="cancellationToken">The cancellation token.</param>
50-
public virtual Response<RecordingStateResult> StartRecording(StartRecordingOptions options, CancellationToken cancellationToken = default)
50+
public virtual Response<RecordingStateResult> Start(StartRecordingOptions options, CancellationToken cancellationToken = default)
5151
{
5252
if (options == null)
5353
throw new ArgumentNullException(nameof(options));
5454

55-
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallRecording)}.{nameof(StartRecording)}");
55+
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallRecording)}.{nameof(Start)}");
5656
scope.Start();
5757
try
5858
{
5959
StartCallRecordingRequestInternal request = new(CallLocatorSerializer.Serialize(options.CallLocator))
6060
{
61-
RecordingStateCallbackUri = options.RecordingStateCallbackEndpoint?.AbsoluteUri,
61+
RecordingStateCallbackUri = options.RecordingStateCallbackUri?.AbsoluteUri,
6262
RecordingChannelType = options.RecordingChannel,
6363
RecordingContentType = options.RecordingContent,
6464
RecordingFormatType = options.RecordingFormat,
@@ -95,18 +95,18 @@ public virtual Response<RecordingStateResult> StartRecording(StartRecordingOptio
9595
/// </summary>
9696
/// <param name="options">Options for start recording</param>
9797
/// <param name="cancellationToken">The cancellation token.</param>
98-
public virtual async Task<Response<RecordingStateResult>> StartRecordingAsync(StartRecordingOptions options, CancellationToken cancellationToken = default)
98+
public virtual async Task<Response<RecordingStateResult>> StartAsync(StartRecordingOptions options, CancellationToken cancellationToken = default)
9999
{
100100
if (options == null)
101101
throw new ArgumentNullException(nameof(options));
102102

103-
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallRecording)}.{nameof(StartRecording)}");
103+
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallRecording)}.{nameof(Start)}");
104104
scope.Start();
105105
try
106106
{
107107
StartCallRecordingRequestInternal request = new(CallLocatorSerializer.Serialize(options.CallLocator))
108108
{
109-
RecordingStateCallbackUri = options.RecordingStateCallbackEndpoint?.AbsoluteUri,
109+
RecordingStateCallbackUri = options.RecordingStateCallbackUri?.AbsoluteUri,
110110
RecordingChannelType = options.RecordingChannel,
111111
RecordingContentType = options.RecordingContent,
112112
RecordingFormatType = options.RecordingFormat,
@@ -156,9 +156,9 @@ public virtual async Task<Response<RecordingStateResult>> StartRecordingAsync(St
156156
/// </summary>
157157
/// <param name="recordingId">The recording id to get the state of.</param>
158158
/// <param name="cancellationToken">The cancellation token.</param>
159-
public virtual Response<RecordingStateResult> GetRecordingState(string recordingId, CancellationToken cancellationToken = default)
159+
public virtual Response<RecordingStateResult> GetState(string recordingId, CancellationToken cancellationToken = default)
160160
{
161-
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallRecording)}.{nameof(GetRecordingState)}");
161+
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallRecording)}.{nameof(GetState)}");
162162
scope.Start();
163163
try
164164
{
@@ -179,9 +179,9 @@ public virtual Response<RecordingStateResult> GetRecordingState(string recording
179179
/// </summary>
180180
/// <param name="recordingId">The recording id to get the state of.</param>
181181
/// <param name="cancellationToken">The cancellation token.</param>
182-
public virtual async Task<Response<RecordingStateResult>> GetRecordingStateAsync(string recordingId, CancellationToken cancellationToken = default)
182+
public virtual async Task<Response<RecordingStateResult>> GetStateAsync(string recordingId, CancellationToken cancellationToken = default)
183183
{
184-
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallRecording)}.{nameof(GetRecordingState)}");
184+
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallRecording)}.{nameof(GetState)}");
185185
scope.Start();
186186
try
187187
{
@@ -202,9 +202,9 @@ public virtual async Task<Response<RecordingStateResult>> GetRecordingStateAsync
202202
/// </summary>
203203
/// <param name="recordingId">The recording id to stop.</param>
204204
/// <param name="cancellationToken">The cancellation token.</param>
205-
public virtual Response StopRecording(string recordingId, CancellationToken cancellationToken = default)
205+
public virtual Response Stop(string recordingId, CancellationToken cancellationToken = default)
206206
{
207-
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallRecording)}.{nameof(StopRecording)}");
207+
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallRecording)}.{nameof(Stop)}");
208208
scope.Start();
209209
try
210210
{
@@ -225,9 +225,9 @@ public virtual Response StopRecording(string recordingId, CancellationToken canc
225225
/// </summary>
226226
/// <param name="recordingId">The recording id to stop.</param>
227227
/// <param name="cancellationToken">The cancellation token.</param>
228-
public virtual async Task<Response> StopRecordingAsync(string recordingId, CancellationToken cancellationToken = default)
228+
public virtual async Task<Response> StopAsync(string recordingId, CancellationToken cancellationToken = default)
229229
{
230-
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallRecording)}.{nameof(StopRecording)}");
230+
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallRecording)}.{nameof(Stop)}");
231231
scope.Start();
232232
try
233233
{
@@ -248,9 +248,9 @@ public virtual async Task<Response> StopRecordingAsync(string recordingId, Cance
248248
/// </summary>
249249
/// <param name="recordingId">The recording id to pause.</param>
250250
/// <param name="cancellationToken">The cancellation token.</param>
251-
public virtual async Task<Response> PauseRecordingAsync(string recordingId, CancellationToken cancellationToken = default)
251+
public virtual async Task<Response> PauseAsync(string recordingId, CancellationToken cancellationToken = default)
252252
{
253-
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallRecording)}.{nameof(PauseRecording)}");
253+
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallRecording)}.{nameof(Pause)}");
254254
scope.Start();
255255
try
256256
{
@@ -271,9 +271,9 @@ public virtual async Task<Response> PauseRecordingAsync(string recordingId, Canc
271271
/// </summary>
272272
/// <param name="recordingId">The recording id to pause.</param>
273273
/// <param name="cancellationToken">The cancellation token.</param>
274-
public virtual Response PauseRecording(string recordingId, CancellationToken cancellationToken = default)
274+
public virtual Response Pause(string recordingId, CancellationToken cancellationToken = default)
275275
{
276-
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallRecording)}.{nameof(PauseRecording)}");
276+
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallRecording)}.{nameof(Pause)}");
277277
scope.Start();
278278
try
279279
{
@@ -294,9 +294,9 @@ public virtual Response PauseRecording(string recordingId, CancellationToken can
294294
/// </summary>
295295
/// <param name="recordingId">The recording id to pause.</param>
296296
/// <param name="cancellationToken">The cancellation token.</param>
297-
public virtual async Task<Response> ResumeRecordingAsync(string recordingId, CancellationToken cancellationToken = default)
297+
public virtual async Task<Response> ResumeAsync(string recordingId, CancellationToken cancellationToken = default)
298298
{
299-
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallRecording)}.{nameof(ResumeRecording)}");
299+
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallRecording)}.{nameof(Resume)}");
300300
scope.Start();
301301
try
302302
{
@@ -317,9 +317,9 @@ public virtual async Task<Response> ResumeRecordingAsync(string recordingId, Can
317317
/// </summary>
318318
/// <param name="recordingId">The recording id to resume.</param>
319319
/// <param name="cancellationToken">The cancellation token.</param>
320-
public virtual Response ResumeRecording(string recordingId, CancellationToken cancellationToken = default)
320+
public virtual Response Resume(string recordingId, CancellationToken cancellationToken = default)
321321
{
322-
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallRecording)}.{nameof(ResumeRecording)}");
322+
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallRecording)}.{nameof(Resume)}");
323323
scope.Start();
324324
try
325325
{
@@ -533,7 +533,7 @@ public virtual async Task<Response> DownloadToAsync(Uri sourceLocation, string d
533533
}
534534

535535
/// <summary>
536-
/// The <see cref="DeleteRecording(Uri, CancellationToken)"/>
536+
/// The <see cref="Delete(Uri, CancellationToken)"/>
537537
/// operation deletes the specified content from storage.
538538
/// </summary>
539539
/// <param name="recordingLocation">
@@ -550,9 +550,9 @@ public virtual async Task<Response> DownloadToAsync(Uri sourceLocation, string d
550550
/// A <see cref="RequestFailedException"/> will be thrown if
551551
/// a failure occurs.
552552
/// </remarks>
553-
public virtual Response DeleteRecording(Uri recordingLocation, CancellationToken cancellationToken = default)
553+
public virtual Response Delete(Uri recordingLocation, CancellationToken cancellationToken = default)
554554
{
555-
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallRecording)}.{nameof(DeleteRecording)}");
555+
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallRecording)}.{nameof(Delete)}");
556556
scope.Start();
557557
try
558558
{
@@ -575,7 +575,7 @@ public virtual Response DeleteRecording(Uri recordingLocation, CancellationToken
575575
}
576576

577577
/// <summary>
578-
/// The <see cref="DeleteRecordingAsync(Uri, CancellationToken)"/>
578+
/// The <see cref="DeleteAsync(Uri, CancellationToken)"/>
579579
/// operation deletes the specified content from storage
580580
/// using parallel requests.
581581
/// </summary>
@@ -593,9 +593,9 @@ public virtual Response DeleteRecording(Uri recordingLocation, CancellationToken
593593
/// A <see cref="RequestFailedException"/> will be thrown if
594594
/// a failure occurs.
595595
/// </remarks>
596-
public virtual async Task<Response> DeleteRecordingAsync(Uri recordingLocation, CancellationToken cancellationToken = default)
596+
public virtual async Task<Response> DeleteAsync(Uri recordingLocation, CancellationToken cancellationToken = default)
597597
{
598-
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallRecording)}.{nameof(DeleteRecording)}");
598+
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallRecording)}.{nameof(Delete)}");
599599
scope.Start();
600600
try
601601
{

sdk/communication/Azure.Communication.CallAutomation/src/Models/CallAutomationModelFactory.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public static AnswerCallResult AnswerCallResult(CallConnection callConnection =
3636
/// <param name="serverCallId">The server call id.</param>
3737
/// <param name="targets">The targets of the call.</param>
3838
/// <param name="callConnectionState">The state of the call connection.</param>
39-
/// <param name="callbackEndpoint">The callback URI.</param>
39+
/// <param name="callbackUri">The callback URI.</param>
4040
/// <param name="sourceIdentity">Source identity.</param>
4141
/// <param name="sourceCallerIdNumber">Caller ID phone number to appear on the invitee.</param>
4242
/// <param name="sourceDisplayName">Display name to appear on the invitee.</param>
@@ -47,13 +47,13 @@ public static CallConnectionProperties CallConnectionProperties(
4747
string serverCallId = default,
4848
IEnumerable<CommunicationIdentifier> targets = default,
4949
CallConnectionState callConnectionState = default,
50-
Uri callbackEndpoint = default,
50+
Uri callbackUri = default,
5151
CommunicationIdentifier sourceIdentity = default,
5252
PhoneNumberIdentifier sourceCallerIdNumber = default,
5353
string sourceDisplayName = default,
5454
string mediaSubscriptionId = default)
5555
{
56-
return new CallConnectionProperties(callConnectionId, serverCallId, targets, callConnectionState, callbackEndpoint, sourceIdentity, sourceCallerIdNumber, sourceDisplayName, mediaSubscriptionId);
56+
return new CallConnectionProperties(callConnectionId, serverCallId, targets, callConnectionState, callbackUri, sourceIdentity, sourceCallerIdNumber, sourceDisplayName, mediaSubscriptionId);
5757
}
5858

5959
/// <summary> Initializes a new instance of CallParticipant. </summary>

sdk/communication/Azure.Communication.CallAutomation/src/Models/CallConnectionProperties.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ internal CallConnectionProperties(
1515
string serverCallId,
1616
IEnumerable<CommunicationIdentifier> targets,
1717
CallConnectionState callConnectionState,
18-
Uri callbackEndpoint,
18+
Uri callbackUri,
1919
CommunicationIdentifier sourceIdentity,
2020
PhoneNumberIdentifier sourceCallerIdNumber,
2121
string sourceDisplayName,
@@ -26,7 +26,7 @@ string mediaSubscriptionId
2626
ServerCallId = serverCallId;
2727
Targets = targets == null ? new List<CommunicationIdentifier>() : targets.ToList();
2828
CallConnectionState = callConnectionState == default ? CallConnectionState.Unknown : callConnectionState;
29-
CallbackEndpoint = callbackEndpoint;
29+
CallbackUri = callbackUri;
3030
SourceIdentity = sourceIdentity;
3131
SourceCallerIdNumber = sourceCallerIdNumber;
3232
SourceDisplayName = sourceDisplayName;
@@ -48,7 +48,7 @@ internal CallConnectionProperties(CallConnectionPropertiesInternal callConnectio
4848
CallConnectionState = callConnectionPropertiesDtoInternal.CallConnectionState.Value;
4949
}
5050

51-
CallbackEndpoint = new Uri(callConnectionPropertiesDtoInternal.CallbackUri);
51+
CallbackUri = new Uri(callConnectionPropertiesDtoInternal.CallbackUri);
5252
MediaSubscriptionId = callConnectionPropertiesDtoInternal.MediaSubscriptionId;
5353
SourceIdentity = CommunicationIdentifierSerializer.Deserialize(callConnectionPropertiesDtoInternal.SourceIdentity);
5454
SourceDisplayName = callConnectionPropertiesDtoInternal.SourceDisplayName;
@@ -68,7 +68,7 @@ internal CallConnectionProperties(CallConnectionPropertiesInternal callConnectio
6868
/// <summary> The state of the call connection. </summary>
6969
public CallConnectionState CallConnectionState { get; }
7070
/// <summary> The callback URI. </summary>
71-
public Uri CallbackEndpoint { get; }
71+
public Uri CallbackUri { get; }
7272
/// <summary> SubscriptionId for media streaming. </summary>
7373
public string MediaSubscriptionId { get; }
7474
/// <summary>

sdk/communication/Azure.Communication.CallAutomation/src/Models/CallMediaRecognizeDtmfOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ public CallMediaRecognizeDtmfOptions(CommunicationIdentifier targetParticipant,
3434
/// <summary>
3535
/// List of tones that will stop recognizing.
3636
/// </summary>
37-
public IReadOnlyList<DtmfTone> StopTones { get; set; }
37+
public IList<DtmfTone> StopTones { get; set; }
3838
}
3939
}

0 commit comments

Comments
 (0)