-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding new incoming call event for call automation. Related work item… (
#47379) * Adding new incoming call event for call automation. Related work item: 3954169
- Loading branch information
1 parent
38f149a
commit a0c7d4f
Showing
10 changed files
with
321 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...ication.CallAutomation/src/Generated/Models/CustomCallingContextInternal.Serialization.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
106 changes: 106 additions & 0 deletions
106
...e.Communication.CallAutomation/src/Generated/Models/IncomingCallInternal.Serialization.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
56 changes: 56 additions & 0 deletions
56
...unication/Azure.Communication.CallAutomation/src/Generated/Models/IncomingCallInternal.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
sdk/communication/Azure.Communication.CallAutomation/src/Models/Events/IncomingCall.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...ommunication/Azure.Communication.CallAutomation/src/Models/Events/IncomingCallInternal.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters