diff --git a/sdk/communication/Azure.Communication.Calling.Server/src/CallClient.cs b/sdk/communication/Azure.Communication.Calling.Server/src/CallClient.cs
index 73f67452249f..28da37c09871 100644
--- a/sdk/communication/Azure.Communication.Calling.Server/src/CallClient.cs
+++ b/sdk/communication/Azure.Communication.Calling.Server/src/CallClient.cs
@@ -248,15 +248,16 @@ public virtual Response HangupCall(string callLegId, CancellationToken cancellat
/// Cancel all media operations in the call.
/// The call leg id.
+ /// The operation context.
/// The cancellation token.
/// The server returned an error. See for details returned from the server.
- public virtual async Task> CancelAllMediaOperationsAsync(string callLegId, CancellationToken cancellationToken = default)
+ public virtual async Task> CancelAllMediaOperationsAsync(string callLegId, string operationContext = null, CancellationToken cancellationToken = default)
{
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallClient)}.{nameof(CancelAllMediaOperationsAsync)}");
scope.Start();
try
{
- return await RestClient.CancelAllMediaOperationsAsync(callLegId, cancellationToken: cancellationToken).ConfigureAwait(false);
+ return await RestClient.CancelAllMediaOperationsAsync(callLegId, operationContext, cancellationToken: cancellationToken).ConfigureAwait(false);
}
catch (Exception ex)
{
@@ -267,15 +268,16 @@ public virtual async Task> CancelAllM
/// Cancel all media operations in the call.
/// The call leg id.
+ /// The operation context.
/// The cancellation token.
/// The server returned an error. See for details returned from the server.
- public virtual Response CancelAllMediaOperations(string callLegId, CancellationToken cancellationToken = default)
+ public virtual Response CancelAllMediaOperations(string callLegId, string operationContext = null, CancellationToken cancellationToken = default)
{
using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(CallClient)}.{nameof(CancelAllMediaOperations)}");
scope.Start();
try
{
- return RestClient.CancelAllMediaOperations(callLegId, cancellationToken: cancellationToken);
+ return RestClient.CancelAllMediaOperations(callLegId, operationContext, cancellationToken: cancellationToken);
}
catch (Exception ex)
{
diff --git a/sdk/communication/Azure.Communication.Calling.Server/tests/ServerCallingClients/CallingServerClientsTests.cs b/sdk/communication/Azure.Communication.Calling.Server/tests/ServerCallingClients/CallingServerClientsTests.cs
index aee2548e2aa4..3a7703634662 100644
--- a/sdk/communication/Azure.Communication.Calling.Server/tests/ServerCallingClients/CallingServerClientsTests.cs
+++ b/sdk/communication/Azure.Communication.Calling.Server/tests/ServerCallingClients/CallingServerClientsTests.cs
@@ -85,24 +85,25 @@ public async Task HangupCallAsyncOverload_Passes(string expectedCallLegId)
Assert.AreEqual(expectedResponse, actualResponse);
}
- [TestCaseSource(nameof(TestData_CancelMediaOperations))]
- public async Task CancelMediaOperationsAsyncOverload_Passes(string expectedCallLegId)
+ [TestCaseSource(nameof(TestData_CancelAllMediaOperations))]
+ public async Task CancelMediaOperationsAsyncOverload_Passes(string expectedCallLegId, string expectedOperationContext)
{
Mock mockClient = new Mock() { CallBase = true };
Response? expectedResponse = default;
CancellationToken cancellationToken = new CancellationTokenSource().Token;
- var callExpression = BuildExpression(x => x.CancelAllMediaOperationsAsync(It.IsAny(), It.IsAny()));
+ var callExpression = BuildExpression(x => x.CancelAllMediaOperationsAsync(It.IsAny(), It.IsAny(), It.IsAny()));
mockClient
.Setup(callExpression)
.ReturnsAsync((string callLegId, string operationContext, CancellationToken token) =>
{
Assert.AreEqual(expectedCallLegId, callLegId);
+ Assert.AreEqual(expectedOperationContext, operationContext);
Assert.AreEqual(cancellationToken, token);
return expectedResponse = new Mock>().Object;
});
- Response actualResponse = await mockClient.Object.CancelAllMediaOperationsAsync(expectedCallLegId, cancellationToken);
+ Response actualResponse = await mockClient.Object.CancelAllMediaOperationsAsync(expectedCallLegId, expectedOperationContext, cancellationToken);
mockClient.Verify(callExpression, Times.Once());
Assert.AreEqual(expectedResponse, actualResponse);
@@ -161,7 +162,7 @@ public async Task PlayAudioAsyncOverload_Passes(string expectedCallLegId, Uri ex
}
[TestCaseSource(nameof(TestData_InviteParticipants))]
- public async Task InviteParticipantsAsyncOverload_Passes(string expectedCallLegId, CommunicationIdentifier expectedParticipant, string expectedOperationContext, string? expectedAlternateCallerId = null)
+ public async Task InviteParticipantsAsyncOverload_Passes(string expectedCallLegId, CommunicationIdentifier expectedParticipant, string expectedAlternateCallerId, string expectedOperationContext)
{
Mock mockClient = new Mock() { CallBase = true };
Response? expectedResponse = default;
@@ -170,7 +171,7 @@ public async Task InviteParticipantsAsyncOverload_Passes(string expectedCallLegI
mockClient
.Setup(callExpression)
- .ReturnsAsync((string callLegId, IEnumerable participants, string operationContext, string alternateCallerId, CancellationToken token) =>
+ .ReturnsAsync((string callLegId, CommunicationIdentifier participants, string operationContext, string alternateCallerId, CancellationToken token) =>
{
Assert.AreEqual(expectedCallLegId, callLegId);
Assert.AreEqual(expectedParticipant, participants);
@@ -221,11 +222,12 @@ public async Task RemoveParticipantAsyncOverload_Passes(string expectedCallLegId
};
}
- private static IEnumerable