Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Adding new incoming call event for call automation. Related work item…
…: 3954169
  • Loading branch information
ramneettung-msft committed Dec 3, 2024
commit 75e54be19c6b2b184bc2a0a235595d3618e0960d

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 IncomingCallEvent. </summary>
/// <param name="internalEvent">Internal Representation of the AddParticipantFailedEvent. </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