diff --git a/sdk/communication/Azure.Communication.CallAutomation/api/Azure.Communication.CallAutomation.netstandard2.0.cs b/sdk/communication/Azure.Communication.CallAutomation/api/Azure.Communication.CallAutomation.netstandard2.0.cs
index 7d6c3a29a2cc..f2d7a80e0136 100644
--- a/sdk/communication/Azure.Communication.CallAutomation/api/Azure.Communication.CallAutomation.netstandard2.0.cs
+++ b/sdk/communication/Azure.Communication.CallAutomation/api/Azure.Communication.CallAutomation.netstandard2.0.cs
@@ -947,7 +947,6 @@ public partial class TransferToParticipantOptions
public TransferToParticipantOptions(Azure.Communication.CallAutomation.CallInvite callInvite) { }
public Azure.Communication.CallAutomation.CallInvite CallInvite { get { throw null; } }
public string OperationContext { get { throw null; } set { } }
- public string UserToUserInformation { get { throw null; } set { } }
}
public partial class UnmuteParticipantsOptions
{
diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/CallConnection.cs b/sdk/communication/Azure.Communication.CallAutomation/src/CallConnection.cs
index 36340d5b2f28..6b4da8f2c926 100644
--- a/sdk/communication/Azure.Communication.CallAutomation/src/CallConnection.cs
+++ b/sdk/communication/Azure.Communication.CallAutomation/src/CallConnection.cs
@@ -297,15 +297,17 @@ private static TransferToParticipantRequestInternal CreateTransferToParticipantR
TransferToParticipantRequestInternal request = new TransferToParticipantRequestInternal(CommunicationIdentifierSerializer.Serialize(options.CallInvite.Target));
request.TransfereeCallerId = options.CallInvite.SourceCallerIdNumber == null ? null : new PhoneNumberIdentifierModel(options.CallInvite.SourceCallerIdNumber.PhoneNumber);
- if (options.UserToUserInformation != null && options.UserToUserInformation.Length > CallAutomationConstants.InputValidation.StringMaxLength)
+
+ foreach (var sipHeader in options.CallInvite.SipHeaders)
{
- throw new ArgumentException(CallAutomationErrorMessages.UserToUserInformationExceedsMaxLength);
+ request.CustomContext.SipHeaders.Add(sipHeader.Key, sipHeader.Value);
}
- // TODO: update logic
- // else
- // {
- // request.UserToUserInformation = options.UserToUserInformation;
- // }
+
+ foreach (var voipHeader in options.CallInvite.VoipHeaders)
+ {
+ request.CustomContext.SipHeaders.Add(voipHeader.Key, voipHeader.Value);
+ }
+
if (options.OperationContext != null && options.OperationContext.Length > CallAutomationConstants.InputValidation.StringMaxLength)
{
throw new ArgumentException(CallAutomationErrorMessages.OperationContextExceedsMaxLength);
diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/TransferToParticipantOptions.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/TransferToParticipantOptions.cs
index 93c0ee9751b1..204cdf0ccf14 100644
--- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/TransferToParticipantOptions.cs
+++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/TransferToParticipantOptions.cs
@@ -24,11 +24,6 @@ public TransferToParticipantOptions(CallInvite callInvite)
///
public CallInvite CallInvite { get; }
- ///
- /// The UserToUserInformation.
- ///
- public string UserToUserInformation { get; set; }
-
///
/// The operationContext for this transfer call.
///
diff --git a/sdk/communication/Azure.Communication.CallAutomation/tests/CallConnections/CallConnectionTests.cs b/sdk/communication/Azure.Communication.CallAutomation/tests/CallConnections/CallConnectionTests.cs
index e8b49cf00d02..d2ff890880a4 100644
--- a/sdk/communication/Azure.Communication.CallAutomation/tests/CallConnections/CallConnectionTests.cs
+++ b/sdk/communication/Azure.Communication.CallAutomation/tests/CallConnections/CallConnectionTests.cs
@@ -190,20 +190,6 @@ public void TransferCallToParticipant_ExceedsMaxOperationContextLength(CallInvit
Assert.True(ex?.Message.Contains(CallAutomationErrorMessages.OperationContextExceedsMaxLength));
}
- [TestCaseSource(nameof(TestData_TransferCallToParticipant))]
- public void TransferCallToParticipant_ExceedsMaxUserToUserInformationLengthLength(CallInvite callInvite)
- {
- var callConnection = CreateMockCallConnection(202);
-
- var options = new TransferToParticipantOptions(callInvite)
- {
- UserToUserInformation = new string('a', 1 + CallAutomationConstants.InputValidation.StringMaxLength)
- };
- ArgumentException? ex = Assert.Throws(() => callConnection.TransferCallToParticipant(options));
- Assert.NotNull(ex);
- Assert.True(ex?.Message.Contains(CallAutomationErrorMessages.UserToUserInformationExceedsMaxLength));
- }
-
[TestCaseSource(nameof(TestData_AddOrRemoveParticipant))]
public async Task AddParticipantsAsync_202Accepted(CommunicationIdentifier participantToAdd)
{
@@ -575,7 +561,8 @@ private CallConnection CreateMockCallConnection(int responseCode, string? respon
{
new object?[]
{
- new CallInvite(new CommunicationUserIdentifier("userId"))
+ new CallInvite(new CommunicationUserIdentifier("userId")){
+ SipHeaders = {{ "key1", "value1" }}}
},
};
}