Skip to content

Commit

Permalink
Adding new incoming call event for call automation. Related work item… (
Browse files Browse the repository at this point in the history
#47379)

* Adding new incoming call event for call automation. Related work item: 3954169
  • Loading branch information
ramneettung-msft authored Dec 3, 2024
1 parent 38f149a commit a0c7d4f
Show file tree
Hide file tree
Showing 10 changed files with 321 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,17 @@ public HoldOptions(Azure.Communication.CommunicationIdentifier targetParticipant
public Azure.Communication.CallAutomation.PlaySource PlaySourceInfo { get { throw null; } set { } }
public Azure.Communication.CommunicationIdentifier TargetParticipant { get { throw null; } }
}
public partial class IncomingCall : Azure.Communication.CallAutomation.CallAutomationEventBase
{
internal IncomingCall() { }
public string CallerDisplayName { get { throw null; } }
public Azure.Communication.CallAutomation.CustomCallingContext CustomContext { get { throw null; } }
public Azure.Communication.CommunicationIdentifier From { get { throw null; } }
public string IncomingCallContext { get { throw null; } }
public Azure.Communication.CommunicationIdentifier OnBehalfOfCallee { get { throw null; } }
public Azure.Communication.CommunicationIdentifier To { get { throw null; } }
public static Azure.Communication.CallAutomation.IncomingCall Deserialize(string content) { throw null; }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct MediaEventReasonCode : System.IEquatable<Azure.Communication.CallAutomation.MediaEventReasonCode>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,17 @@ public HoldOptions(Azure.Communication.CommunicationIdentifier targetParticipant
public Azure.Communication.CallAutomation.PlaySource PlaySourceInfo { get { throw null; } set { } }
public Azure.Communication.CommunicationIdentifier TargetParticipant { get { throw null; } }
}
public partial class IncomingCall : Azure.Communication.CallAutomation.CallAutomationEventBase
{
internal IncomingCall() { }
public string CallerDisplayName { get { throw null; } }
public Azure.Communication.CallAutomation.CustomCallingContext CustomContext { get { throw null; } }
public Azure.Communication.CommunicationIdentifier From { get { throw null; } }
public string IncomingCallContext { get { throw null; } }
public Azure.Communication.CommunicationIdentifier OnBehalfOfCallee { get { throw null; } }
public Azure.Communication.CommunicationIdentifier To { get { throw null; } }
public static Azure.Communication.CallAutomation.IncomingCall Deserialize(string content) { throw null; }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct MediaEventReasonCode : System.IEquatable<Azure.Communication.CallAutomation.MediaEventReasonCode>
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Azure.Communication.CallAutomation
{
[CodeGenModel("CustomCallingContext")]
[CodeGenModel("CustomCallingContext", Usage = new string[] { "output" }, Formats = new string[] { "json" })]
internal partial class CustomCallingContextInternal
{
public CustomCallingContextInternal(IDictionary<string, string> sipHeaders, IDictionary<string, string> voipHeaders)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ private static CallAutomationEventBase Deserialize(string eventData, string type
case nameof(DialogUpdated):
return DialogUpdated.Deserialize(eventData);
#endregion
#region Incoming Call
case nameof(IncomingCall):
return IncomingCall.Deserialize(eventData);
#endregion
default:
return null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System.Text.Json;

namespace Azure.Communication.CallAutomation
{
/// <summary>
/// The add participant failed event.
/// </summary>
public class IncomingCall : CallAutomationEventBase
{
/// <summary> Initializes a new instance of <see cref="IncomingCall"/>. </summary>
internal IncomingCall()
{
}

/// <summary> Initializes a new instance of <see cref="IncomingCall"/>. </summary>
/// <param name="internalEvent">Internal Representation of the IncomingCall. </param>
internal IncomingCall(IncomingCallInternal internalEvent)
{
To = CommunicationIdentifierSerializer.Deserialize(internalEvent.To);
From = CommunicationIdentifierSerializer.Deserialize(internalEvent.From);
ServerCallId = internalEvent.ServerCallId;
CallerDisplayName = internalEvent.CallerDisplayName;
CustomContext = new CustomCallingContext(internalEvent.CustomContext.SipHeaders, internalEvent.CustomContext.VoipHeaders);
IncomingCallContext = internalEvent.IncomingCallContext;

if (internalEvent.OnBehalfOfCallee != null)
{
OnBehalfOfCallee = CommunicationIdentifierSerializer.Deserialize(internalEvent.OnBehalfOfCallee);
}

CorrelationId = internalEvent.CorrelationId;
}

/// <summary> The communication identifier of the target user. </summary>
public CommunicationIdentifier To { get; }
/// <summary> The communication identifier of the user who initiated the call. </summary>
public CommunicationIdentifier From { get; }
/// <summary> Display name of caller. </summary>
public string CallerDisplayName { get; }
/// <summary> Custom Context of Incoming Call. </summary>
public CustomCallingContext CustomContext { get; }
/// <summary> Incoming call context. </summary>
public string IncomingCallContext { get; }
/// <summary> The communication identifier of the user on behalf of whom the call is made. </summary>
public CommunicationIdentifier OnBehalfOfCallee { get; }

/// <summary>
/// Deserialize <see cref="IncomingCall"/> event.
/// </summary>
/// <param name="content">The json content.</param>
/// <returns>The new <see cref="IncomingCall"/> object.</returns>
public static IncomingCall Deserialize(string content)
{
using var document = JsonDocument.Parse(content);
JsonElement element = document.RootElement;

var internalEvent = IncomingCallInternal.DeserializeIncomingCallInternal(element);
return new IncomingCall(internalEvent);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System.Text.Json;
using Azure.Core;

namespace Azure.Communication.CallAutomation
{
/// <summary>
/// The incoming call event internal.
/// </summary>
[CodeGenModel("IncomingCall", Usage = new string[] { "output" }, Formats = new string[] { "json" })]
internal partial class IncomingCallInternal
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ model-namespace: false
tag: package-2023-10-03-preview

require:
- https://github.com/Azure/azure-rest-api-specs/blob/be2a0fa68829fcb15c4e6b47aa6bc4bdd566c1cf/specification/communication/data-plane/CallAutomation/readme.md
- https://github.com/Azure/azure-rest-api-specs/blob/caabf7f24ee18b923a01bd51461c188e861a044e/specification/communication/data-plane/CallAutomation/readme.md


title: Azure Communication Services
Expand Down

0 comments on commit a0c7d4f

Please sign in to comment.