Skip to content

Commit 4d28253

Browse files
[Azure.Communication.CallAutomation] Add Channel Affinity to Recording API (Azure#30425)
* Add Channel Affinity to Recording API * Rerun export API * Address comments
1 parent 2ffc4ba commit 4d28253

34 files changed

+1233
-49
lines changed

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

Lines changed: 95 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ public partial class AddParticipantsOptions
1313
public AddParticipantsOptions() { }
1414
public int? InvitationTimeoutInSeconds { get { throw null; } set { } }
1515
public string OperationContext { get { throw null; } set { } }
16-
public string ReplacementCallConnectionId { get { throw null; } set { } }
1716
public Azure.Communication.PhoneNumberIdentifier SourceCallerId { get { throw null; } set { } }
1817
}
1918
public partial class AddParticipantsResult
@@ -194,8 +193,8 @@ protected CallRecording() { }
194193
public virtual System.Threading.Tasks.Task<Azure.Response> PauseRecordingAsync(string recordingId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
195194
public virtual Azure.Response ResumeRecording(string recordingId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
196195
public virtual System.Threading.Tasks.Task<Azure.Response> ResumeRecordingAsync(string recordingId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
197-
public virtual Azure.Response<Azure.Communication.CallingServer.RecordingStatusResult> StartRecording(Azure.Communication.CallingServer.CallLocator callLocator, System.Uri recordingStateCallbackEndpoint, Azure.Communication.CallingServer.StartRecordingOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
198-
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Communication.CallingServer.RecordingStatusResult>> StartRecordingAsync(Azure.Communication.CallingServer.CallLocator callLocator, System.Uri recordingStateCallbackEndpoint, Azure.Communication.CallingServer.StartRecordingOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
196+
public virtual Azure.Response<Azure.Communication.CallingServer.RecordingStatusResult> StartRecording(Azure.Communication.CallingServer.StartRecordingOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
197+
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Communication.CallingServer.RecordingStatusResult>> StartRecordingAsync(Azure.Communication.CallingServer.StartRecordingOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
199198
public virtual Azure.Response StopRecording(string recordingId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
200199
public virtual System.Threading.Tasks.Task<Azure.Response> StopRecordingAsync(string recordingId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
201200
}
@@ -238,6 +237,19 @@ internal CallTransferFailed() { }
238237
public Azure.Communication.CallingServer.ResultInformation ResultInfo { get { throw null; } }
239238
public static Azure.Communication.CallingServer.CallTransferFailed Deserialize(string content) { throw null; }
240239
}
240+
public partial class ChannelAffinity
241+
{
242+
public ChannelAffinity() { }
243+
public int Channel { get { throw null; } set { } }
244+
public Azure.Communication.CommunicationIdentifier Participant { get { throw null; } set { } }
245+
}
246+
public partial class CollectTones
247+
{
248+
public CollectTones() { }
249+
public int? InterToneTimeoutInSeconds { get { throw null; } set { } }
250+
public int? MaxTonesToCollect { get { throw null; } set { } }
251+
public System.Collections.Generic.IList<string> StopTones { get { throw null; } }
252+
}
241253
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
242254
public partial struct ContentTransferOptions : System.IEquatable<Azure.Communication.CallingServer.ContentTransferOptions>
243255
{
@@ -282,6 +294,66 @@ public GroupCallLocator(string id) { }
282294
public override int GetHashCode() { throw null; }
283295
public override string ToString() { throw null; }
284296
}
297+
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
298+
public readonly partial struct MediaStreamingAudioChannelTypeDto : System.IEquatable<Azure.Communication.CallingServer.MediaStreamingAudioChannelTypeDto>
299+
{
300+
private readonly object _dummy;
301+
private readonly int _dummyPrimitive;
302+
public MediaStreamingAudioChannelTypeDto(string value) { throw null; }
303+
public static Azure.Communication.CallingServer.MediaStreamingAudioChannelTypeDto Mixed { get { throw null; } }
304+
public static Azure.Communication.CallingServer.MediaStreamingAudioChannelTypeDto Unmixed { get { throw null; } }
305+
public bool Equals(Azure.Communication.CallingServer.MediaStreamingAudioChannelTypeDto other) { throw null; }
306+
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
307+
public override bool Equals(object obj) { throw null; }
308+
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
309+
public override int GetHashCode() { throw null; }
310+
public static bool operator ==(Azure.Communication.CallingServer.MediaStreamingAudioChannelTypeDto left, Azure.Communication.CallingServer.MediaStreamingAudioChannelTypeDto right) { throw null; }
311+
public static implicit operator Azure.Communication.CallingServer.MediaStreamingAudioChannelTypeDto (string value) { throw null; }
312+
public static bool operator !=(Azure.Communication.CallingServer.MediaStreamingAudioChannelTypeDto left, Azure.Communication.CallingServer.MediaStreamingAudioChannelTypeDto right) { throw null; }
313+
public override string ToString() { throw null; }
314+
}
315+
public partial class MediaStreamingConfigurationDto
316+
{
317+
public MediaStreamingConfigurationDto() { }
318+
public Azure.Communication.CallingServer.MediaStreamingAudioChannelTypeDto? AudioChannelType { get { throw null; } set { } }
319+
public Azure.Communication.CallingServer.MediaStreamingContentTypeDto? ContentType { get { throw null; } set { } }
320+
public Azure.Communication.CallingServer.MediaStreamingTransportTypeDto? TransportType { get { throw null; } set { } }
321+
public string TransportUrl { get { throw null; } set { } }
322+
}
323+
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
324+
public readonly partial struct MediaStreamingContentTypeDto : System.IEquatable<Azure.Communication.CallingServer.MediaStreamingContentTypeDto>
325+
{
326+
private readonly object _dummy;
327+
private readonly int _dummyPrimitive;
328+
public MediaStreamingContentTypeDto(string value) { throw null; }
329+
public static Azure.Communication.CallingServer.MediaStreamingContentTypeDto Audio { get { throw null; } }
330+
public bool Equals(Azure.Communication.CallingServer.MediaStreamingContentTypeDto other) { throw null; }
331+
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
332+
public override bool Equals(object obj) { throw null; }
333+
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
334+
public override int GetHashCode() { throw null; }
335+
public static bool operator ==(Azure.Communication.CallingServer.MediaStreamingContentTypeDto left, Azure.Communication.CallingServer.MediaStreamingContentTypeDto right) { throw null; }
336+
public static implicit operator Azure.Communication.CallingServer.MediaStreamingContentTypeDto (string value) { throw null; }
337+
public static bool operator !=(Azure.Communication.CallingServer.MediaStreamingContentTypeDto left, Azure.Communication.CallingServer.MediaStreamingContentTypeDto right) { throw null; }
338+
public override string ToString() { throw null; }
339+
}
340+
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
341+
public readonly partial struct MediaStreamingTransportTypeDto : System.IEquatable<Azure.Communication.CallingServer.MediaStreamingTransportTypeDto>
342+
{
343+
private readonly object _dummy;
344+
private readonly int _dummyPrimitive;
345+
public MediaStreamingTransportTypeDto(string value) { throw null; }
346+
public static Azure.Communication.CallingServer.MediaStreamingTransportTypeDto Websocket { get { throw null; } }
347+
public bool Equals(Azure.Communication.CallingServer.MediaStreamingTransportTypeDto other) { throw null; }
348+
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
349+
public override bool Equals(object obj) { throw null; }
350+
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
351+
public override int GetHashCode() { throw null; }
352+
public static bool operator ==(Azure.Communication.CallingServer.MediaStreamingTransportTypeDto left, Azure.Communication.CallingServer.MediaStreamingTransportTypeDto right) { throw null; }
353+
public static implicit operator Azure.Communication.CallingServer.MediaStreamingTransportTypeDto (string value) { throw null; }
354+
public static bool operator !=(Azure.Communication.CallingServer.MediaStreamingTransportTypeDto left, Azure.Communication.CallingServer.MediaStreamingTransportTypeDto right) { throw null; }
355+
public override string ToString() { throw null; }
356+
}
285357
public partial class ParticipantsUpdated : Azure.Communication.CallingServer.CallAutomationEventBase
286358
{
287359
internal ParticipantsUpdated() { }
@@ -300,6 +372,23 @@ protected PlaySource() { }
300372
public string PlaySourceId { get { throw null; } set { } }
301373
}
302374
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
375+
public readonly partial struct RecognizeInputType : System.IEquatable<Azure.Communication.CallingServer.RecognizeInputType>
376+
{
377+
private readonly object _dummy;
378+
private readonly int _dummyPrimitive;
379+
public RecognizeInputType(string value) { throw null; }
380+
public static Azure.Communication.CallingServer.RecognizeInputType DTMF { get { throw null; } }
381+
public bool Equals(Azure.Communication.CallingServer.RecognizeInputType other) { throw null; }
382+
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
383+
public override bool Equals(object obj) { throw null; }
384+
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
385+
public override int GetHashCode() { throw null; }
386+
public static bool operator ==(Azure.Communication.CallingServer.RecognizeInputType left, Azure.Communication.CallingServer.RecognizeInputType right) { throw null; }
387+
public static implicit operator Azure.Communication.CallingServer.RecognizeInputType (string value) { throw null; }
388+
public static bool operator !=(Azure.Communication.CallingServer.RecognizeInputType left, Azure.Communication.CallingServer.RecognizeInputType right) { throw null; }
389+
public override string ToString() { throw null; }
390+
}
391+
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
303392
public readonly partial struct RecordingChannel : System.IEquatable<Azure.Communication.CallingServer.RecordingChannel>
304393
{
305394
private readonly object _dummy;
@@ -404,10 +493,12 @@ public ServerCallLocator(string id) { }
404493
}
405494
public partial class StartRecordingOptions
406495
{
407-
public StartRecordingOptions() { }
496+
public StartRecordingOptions(Azure.Communication.CallingServer.CallLocator callLocator) { }
497+
public System.Collections.Generic.IEnumerable<Azure.Communication.CallingServer.ChannelAffinity> ChannelAffinity { get { throw null; } set { } }
408498
public Azure.Communication.CallingServer.RecordingChannel RecordingChannel { get { throw null; } set { } }
409499
public Azure.Communication.CallingServer.RecordingContent RecordingContent { get { throw null; } set { } }
410500
public Azure.Communication.CallingServer.RecordingFormat RecordingFormat { get { throw null; } set { } }
501+
public System.Uri RecordingStateCallbackEndpoint { get { throw null; } set { } }
411502
}
412503
public partial class TransferCallToParticipantOptions
413504
{

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

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
// Licensed under the MIT License.
33

44
using System;
5+
using System.Collections.Generic;
56
using System.IO;
7+
using System.Linq;
68
using System.Threading;
79
using System.Threading.Tasks;
810
using Azure.Core;
@@ -47,26 +49,34 @@ protected CallRecording()
4749
/// <summary>
4850
/// Start recording of the call.
4951
/// </summary>
50-
/// <param name="callLocator"> The callLocator. </param>
51-
/// <param name="recordingStateCallbackEndpoint">The uri to send state change callbacks.</param>
52-
/// <param name="options">Optional parameters</param>
52+
/// <param name="options">Options for start recording</param>
5353
/// <param name="cancellationToken">The cancellation token.</param>
54-
public virtual Response<RecordingStatusResult> StartRecording(CallLocator callLocator, Uri recordingStateCallbackEndpoint, StartRecordingOptions options = default, CancellationToken cancellationToken = default)
54+
public virtual Response<RecordingStatusResult> StartRecording(StartRecordingOptions options, CancellationToken cancellationToken = default)
5555
{
56+
if (options == null) throw new ArgumentNullException(nameof(options));
57+
5658
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallRecording)}.{nameof(StartRecording)}");
5759
scope.Start();
5860
try
5961
{
60-
StartCallRecordingRequestInternal request = new StartCallRecordingRequestInternal(CallLocatorSerializer.Serialize(callLocator))
62+
StartCallRecordingRequestInternal request = new(CallLocatorSerializer.Serialize(options.CallLocator))
6163
{
62-
RecordingStateCallbackUri = recordingStateCallbackEndpoint.AbsoluteUri,
64+
RecordingStateCallbackUri = options.RecordingStateCallbackEndpoint?.AbsoluteUri,
65+
RecordingChannelType = options.RecordingChannel,
66+
RecordingContentType = options.RecordingContent,
67+
RecordingFormatType = options.RecordingFormat
6368
};
6469

65-
if (options != null)
70+
if (options.ChannelAffinity != null)
6671
{
67-
request.RecordingChannelType = options.RecordingChannel;
68-
request.RecordingContentType = options.RecordingContent;
69-
request.RecordingFormatType = options.RecordingFormat;
72+
foreach (var c in options.ChannelAffinity)
73+
{
74+
request.ChannelAffinity.Add(new ChannelAffinityInternal
75+
{
76+
Channel = c.Channel,
77+
Participant = CommunicationIdentifierSerializer.Serialize(c.Participant)
78+
});
79+
}
7080
};
7181

7282
return contentRestClient.Recording(request, cancellationToken);
@@ -81,27 +91,36 @@ public virtual Response<RecordingStatusResult> StartRecording(CallLocator callLo
8191
/// <summary>
8292
/// Start recording of the call.
8393
/// </summary>
84-
/// <param name="callLocator"> The callLocator. </param>
85-
/// <param name="recordingStateCallbackEndpoint">The uri to send state change callbacks.</param>
86-
/// <param name="options">Optional parameters</param>
94+
/// <param name="options">Options for start recording</param>
8795
/// <param name="cancellationToken">The cancellation token.</param>
88-
public virtual async Task<Response<RecordingStatusResult>> StartRecordingAsync(CallLocator callLocator, Uri recordingStateCallbackEndpoint, StartRecordingOptions options = default, CancellationToken cancellationToken = default)
96+
public virtual async Task<Response<RecordingStatusResult>> StartRecordingAsync(StartRecordingOptions options, CancellationToken cancellationToken = default)
8997
{
98+
if (options == null) throw new ArgumentNullException(nameof(options));
99+
90100
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallRecording)}.{nameof(StartRecording)}");
91101
scope.Start();
92102
try
93103
{
94-
StartCallRecordingRequestInternal request = new StartCallRecordingRequestInternal(CallLocatorSerializer.Serialize(callLocator))
104+
StartCallRecordingRequestInternal request = new(CallLocatorSerializer.Serialize(options.CallLocator))
95105
{
96-
RecordingStateCallbackUri = recordingStateCallbackEndpoint.AbsoluteUri,
106+
RecordingStateCallbackUri = options.RecordingStateCallbackEndpoint?.AbsoluteUri,
107+
RecordingChannelType = options.RecordingChannel,
108+
RecordingContentType = options.RecordingContent,
109+
RecordingFormatType = options.RecordingFormat
97110
};
98111

99-
if (options != null)
112+
if (options.ChannelAffinity != null)
100113
{
101-
request.RecordingChannelType = options.RecordingChannel;
102-
request.RecordingContentType = options.RecordingContent;
103-
request.RecordingFormatType = options.RecordingFormat;
114+
foreach (var c in options.ChannelAffinity)
115+
{
116+
request.ChannelAffinity.Add(new ChannelAffinityInternal
117+
{
118+
Channel = c.Channel,
119+
Participant = CommunicationIdentifierSerializer.Serialize(c.Participant)
120+
});
121+
}
104122
};
123+
105124
return await contentRestClient.RecordingAsync(request, cancellationToken).ConfigureAwait(false);
106125
}
107126
catch (Exception ex)

0 commit comments

Comments
 (0)