Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding new incoming call event for call automation. Related work item… #47379

Merged
merged 2 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading