-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Expand file tree
/
Copy pathIncomingCall.cs
More file actions
64 lines (56 loc) · 2.8 KB
/
IncomingCall.cs
File metadata and controls
64 lines (56 loc) · 2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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);
}
}
}