-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCallState.cs
More file actions
267 lines (242 loc) · 21.2 KB
/
Copy pathCallState.cs
File metadata and controls
267 lines (242 loc) · 21.2 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
/*
* Bandwidth
*
* Bandwidth's Communication APIs
*
* The version of the OpenAPI document: 1.0.0
* Contact: letstalk@bandwidth.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Bandwidth.Standard.Client.OpenAPIDateConverter;
namespace Bandwidth.Standard.Model
{
/// <summary>
/// CallState
/// </summary>
[DataContract(Name = "callState")]
public partial class CallState : IValidatableObject
{
/// <summary>
/// Gets or Sets Direction
/// </summary>
[DataMember(Name = "direction", EmitDefaultValue = false)]
public CallDirectionEnum? Direction { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="CallState" /> class.
/// </summary>
/// <param name="applicationId">The application id associated with the call..</param>
/// <param name="accountId">The account id associated with the call..</param>
/// <param name="callId">The programmable voice API call ID..</param>
/// <param name="parentCallId">The A-leg call id, set only if this call is the B-leg of a [`<Transfer>`](/docs/voice/bxml/transfer)..</param>
/// <param name="to">The phone number that received the call, in E.164 format (e.g. +15555555555), or if the call was to a SIP URI, the SIP URI..</param>
/// <param name="from">The phone number that made the call, in E.164 format (e.g. +15555555555)..</param>
/// <param name="direction">direction.</param>
/// <param name="state">The current state of the call. Current possible values are `queued`, `initiated`, `answered` and `disconnected`. Additional states may be added in the future, so your application must be tolerant of unknown values..</param>
/// <param name="stirShaken">For inbound calls, the Bandwidth STIR/SHAKEN implementation will verify the information provided in the inbound invite request `Identity` header. The verification status is stored in the call state `stirShaken` property as follows. | Property | Description | |:- -- -- -- -- -- -- -- -- -|:- -- -- -- -- -- -| | verstat | (optional) The verification status indicating whether the verification was successful or not. Possible values are `TN-Validation-Passed` or `TN-Validation-Failed`. | | attestationIndicator | (optional) The attestation level verified by Bandwidth. Possible values are `A` (full), `B` (partial) or `C` (gateway). | | originatingId | (optional) A unique origination identifier. | Note that these are common properties but that the `stirShaken` object is free form and can contain other key-value pairs. More information: [Understanding STIR/SHAKEN](https://www.bandwidth.com/regulations/stir-shaken)..</param>
/// <param name="identity">The value of the `Identity` header from the inbound invite request. Only present for inbound calls and if the account is configured to forward this header..</param>
/// <param name="enqueuedTime">The time this call was placed in queue..</param>
/// <param name="startTime">The time the call was initiated, in ISO 8601 format. `null` if the call is still in your queue..</param>
/// <param name="answerTime">Populated once the call has been answered, with the time in ISO 8601 format..</param>
/// <param name="endTime">Populated once the call has ended, with the time in ISO 8601 format..</param>
/// <param name="disconnectCause">| Cause | Description | |:- -- -- -|:- -- -- -- -- -- -| | `hangup`| One party hung up the call, a [`<Hangup>`](../../bxml/verbs/hangup.md) verb was executed, or there was no more BXML to execute; it indicates that the call ended normally. | | `busy` | Callee was busy. | | `timeout` | Call wasn't answered before the `callTimeout` was reached. | | `cancel` | Call was cancelled by its originator while it was ringing. | | `rejected` | Call was rejected by the callee. | | `callback-error` | BXML callback couldn't be delivered to your callback server. | | `invalid-bxml` | Invalid BXML was returned in response to a callback. | | `application-error` | An unsupported action was tried on the call, e.g. trying to play a .ogg audio. | | `account-limit` | Account rate limits were reached. | | `node-capacity-exceeded` | System maximum capacity was reached. | | `error` | Some error not described in any of the other causes happened on the call. | | `unknown` | Unknown error happened on the call. | Note: This list is not exhaustive and other values can appear in the future..</param>
/// <param name="errorMessage">Populated only if the call ended with an error, with text explaining the reason..</param>
/// <param name="errorId">Populated only if the call ended with an error, with a Bandwidth internal id that references the error event..</param>
/// <param name="lastUpdate">The last time the call had a state update, in ISO 8601 format..</param>
public CallState(string applicationId = default(string), string accountId = default(string), string callId = default(string), string parentCallId = default(string), string to = default(string), string from = default(string), CallDirectionEnum? direction = default(CallDirectionEnum?), string state = default(string), Dictionary<string, string> stirShaken = default(Dictionary<string, string>), string identity = default(string), DateTime? enqueuedTime = default(DateTime?), DateTime? startTime = default(DateTime?), DateTime? answerTime = default(DateTime?), DateTime? endTime = default(DateTime?), string disconnectCause = default(string), string errorMessage = default(string), string errorId = default(string), DateTime lastUpdate = default(DateTime))
{
this.ApplicationId = applicationId;
this.AccountId = accountId;
this.CallId = callId;
this.ParentCallId = parentCallId;
this.To = to;
this.From = from;
this.Direction = direction;
this.State = state;
this.StirShaken = stirShaken;
this.Identity = identity;
this.EnqueuedTime = enqueuedTime;
this.StartTime = startTime;
this.AnswerTime = answerTime;
this.EndTime = endTime;
this.DisconnectCause = disconnectCause;
this.ErrorMessage = errorMessage;
this.ErrorId = errorId;
this.LastUpdate = lastUpdate;
}
/// <summary>
/// The application id associated with the call.
/// </summary>
/// <value>The application id associated with the call.</value>
/// <example>04e88489-df02-4e34-a0ee-27a91849555f</example>
[DataMember(Name = "applicationId", EmitDefaultValue = false)]
public string ApplicationId { get; set; }
/// <summary>
/// The account id associated with the call.
/// </summary>
/// <value>The account id associated with the call.</value>
/// <example>9900000</example>
[DataMember(Name = "accountId", EmitDefaultValue = false)]
public string AccountId { get; set; }
/// <summary>
/// The programmable voice API call ID.
/// </summary>
/// <value>The programmable voice API call ID.</value>
/// <example>c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85</example>
[DataMember(Name = "callId", EmitDefaultValue = false)]
public string CallId { get; set; }
/// <summary>
/// The A-leg call id, set only if this call is the B-leg of a [`<Transfer>`](/docs/voice/bxml/transfer).
/// </summary>
/// <value>The A-leg call id, set only if this call is the B-leg of a [`<Transfer>`](/docs/voice/bxml/transfer).</value>
/// <example>c-25ac29a2-1331029c-2cb0-4a07-b215-b22865662d85</example>
[DataMember(Name = "parentCallId", EmitDefaultValue = true)]
public string ParentCallId { get; set; }
/// <summary>
/// The phone number that received the call, in E.164 format (e.g. +15555555555), or if the call was to a SIP URI, the SIP URI.
/// </summary>
/// <value>The phone number that received the call, in E.164 format (e.g. +15555555555), or if the call was to a SIP URI, the SIP URI.</value>
/// <example>+19195551234</example>
[DataMember(Name = "to", EmitDefaultValue = false)]
public string To { get; set; }
/// <summary>
/// The phone number that made the call, in E.164 format (e.g. +15555555555).
/// </summary>
/// <value>The phone number that made the call, in E.164 format (e.g. +15555555555).</value>
/// <example>+19195554321</example>
[DataMember(Name = "from", EmitDefaultValue = false)]
public string From { get; set; }
/// <summary>
/// The current state of the call. Current possible values are `queued`, `initiated`, `answered` and `disconnected`. Additional states may be added in the future, so your application must be tolerant of unknown values.
/// </summary>
/// <value>The current state of the call. Current possible values are `queued`, `initiated`, `answered` and `disconnected`. Additional states may be added in the future, so your application must be tolerant of unknown values.</value>
/// <example>disconnected</example>
[DataMember(Name = "state", EmitDefaultValue = false)]
public string State { get; set; }
/// <summary>
/// For inbound calls, the Bandwidth STIR/SHAKEN implementation will verify the information provided in the inbound invite request `Identity` header. The verification status is stored in the call state `stirShaken` property as follows. | Property | Description | |:- -- -- -- -- -- -- -- -- -|:- -- -- -- -- -- -| | verstat | (optional) The verification status indicating whether the verification was successful or not. Possible values are `TN-Validation-Passed` or `TN-Validation-Failed`. | | attestationIndicator | (optional) The attestation level verified by Bandwidth. Possible values are `A` (full), `B` (partial) or `C` (gateway). | | originatingId | (optional) A unique origination identifier. | Note that these are common properties but that the `stirShaken` object is free form and can contain other key-value pairs. More information: [Understanding STIR/SHAKEN](https://www.bandwidth.com/regulations/stir-shaken).
/// </summary>
/// <value>For inbound calls, the Bandwidth STIR/SHAKEN implementation will verify the information provided in the inbound invite request `Identity` header. The verification status is stored in the call state `stirShaken` property as follows. | Property | Description | |:- -- -- -- -- -- -- -- -- -|:- -- -- -- -- -- -| | verstat | (optional) The verification status indicating whether the verification was successful or not. Possible values are `TN-Validation-Passed` or `TN-Validation-Failed`. | | attestationIndicator | (optional) The attestation level verified by Bandwidth. Possible values are `A` (full), `B` (partial) or `C` (gateway). | | originatingId | (optional) A unique origination identifier. | Note that these are common properties but that the `stirShaken` object is free form and can contain other key-value pairs. More information: [Understanding STIR/SHAKEN](https://www.bandwidth.com/regulations/stir-shaken).</value>
/// <example>{"verstat":"TN-Validation-Passed","attestationIndicator":"A","originatingId":"abc123"}</example>
[DataMember(Name = "stirShaken", EmitDefaultValue = true)]
public Dictionary<string, string> StirShaken { get; set; }
/// <summary>
/// The value of the `Identity` header from the inbound invite request. Only present for inbound calls and if the account is configured to forward this header.
/// </summary>
/// <value>The value of the `Identity` header from the inbound invite request. Only present for inbound calls and if the account is configured to forward this header.</value>
/// <example>eyJhbGciOiJFUzI1NiIsInBwdCI6InNoYWtlbiIsInR5cCI6InBhc3Nwb3J0IiwieDV1IjoiaHR0cHM6Ly9idy1zaGFrZW4tY2VydC1wdWIuczMuYW1hem9uYXdzLmNvbS9iYW5kd2lkdGgtc2hha2VuLWNlcnRfMjAyMzA3MTYucGVtIn0.eyJhdHRlc3QiOiJBIiwiZGVzdCI6eyJ0biI6WyIxOTg0MjgyMDI4MCJdfSwiaWF0IjoxNjU2NTM0MzM2LCJvcmlnIjp7InRuIjoiMTkxOTQ0NDI2ODMifSwib3JpZ2lkIjoiNDk0NTlhOGEtNDJmNi0zNTFjLTkzNjEtYWRmNTdhOWUwOGNhIn0.56un9sRw_uH-sbJvnUsqdevlVxbOVjn8MVlGTlBMicjaZuRRwxfiNp-C9zYCMKTTCbc-QdYPN05F61XNVN4D3w;info=<https://bw-shaken-cert-pub.s3.amazonaws.com/bandwidth-shaken-cert_20230716.pem>;alg=ES256;ppt=shaken</example>
[DataMember(Name = "identity", EmitDefaultValue = true)]
public string Identity { get; set; }
/// <summary>
/// The time this call was placed in queue.
/// </summary>
/// <value>The time this call was placed in queue.</value>
/// <example>2022-06-16T13:15:07.160Z</example>
[DataMember(Name = "enqueuedTime", EmitDefaultValue = true)]
public DateTime? EnqueuedTime { get; set; }
/// <summary>
/// The time the call was initiated, in ISO 8601 format. `null` if the call is still in your queue.
/// </summary>
/// <value>The time the call was initiated, in ISO 8601 format. `null` if the call is still in your queue.</value>
/// <example>2022-06-16T13:15:07.160Z</example>
[DataMember(Name = "startTime", EmitDefaultValue = true)]
public DateTime? StartTime { get; set; }
/// <summary>
/// Populated once the call has been answered, with the time in ISO 8601 format.
/// </summary>
/// <value>Populated once the call has been answered, with the time in ISO 8601 format.</value>
/// <example>2022-06-16T13:15:18.126Z</example>
[DataMember(Name = "answerTime", EmitDefaultValue = true)]
public DateTime? AnswerTime { get; set; }
/// <summary>
/// Populated once the call has ended, with the time in ISO 8601 format.
/// </summary>
/// <value>Populated once the call has ended, with the time in ISO 8601 format.</value>
/// <example>2022-06-16T13:15:18.314Z</example>
[DataMember(Name = "endTime", EmitDefaultValue = true)]
public DateTime? EndTime { get; set; }
/// <summary>
/// | Cause | Description | |:- -- -- -|:- -- -- -- -- -- -| | `hangup`| One party hung up the call, a [`<Hangup>`](../../bxml/verbs/hangup.md) verb was executed, or there was no more BXML to execute; it indicates that the call ended normally. | | `busy` | Callee was busy. | | `timeout` | Call wasn't answered before the `callTimeout` was reached. | | `cancel` | Call was cancelled by its originator while it was ringing. | | `rejected` | Call was rejected by the callee. | | `callback-error` | BXML callback couldn't be delivered to your callback server. | | `invalid-bxml` | Invalid BXML was returned in response to a callback. | | `application-error` | An unsupported action was tried on the call, e.g. trying to play a .ogg audio. | | `account-limit` | Account rate limits were reached. | | `node-capacity-exceeded` | System maximum capacity was reached. | | `error` | Some error not described in any of the other causes happened on the call. | | `unknown` | Unknown error happened on the call. | Note: This list is not exhaustive and other values can appear in the future.
/// </summary>
/// <value>| Cause | Description | |:- -- -- -|:- -- -- -- -- -- -| | `hangup`| One party hung up the call, a [`<Hangup>`](../../bxml/verbs/hangup.md) verb was executed, or there was no more BXML to execute; it indicates that the call ended normally. | | `busy` | Callee was busy. | | `timeout` | Call wasn't answered before the `callTimeout` was reached. | | `cancel` | Call was cancelled by its originator while it was ringing. | | `rejected` | Call was rejected by the callee. | | `callback-error` | BXML callback couldn't be delivered to your callback server. | | `invalid-bxml` | Invalid BXML was returned in response to a callback. | | `application-error` | An unsupported action was tried on the call, e.g. trying to play a .ogg audio. | | `account-limit` | Account rate limits were reached. | | `node-capacity-exceeded` | System maximum capacity was reached. | | `error` | Some error not described in any of the other causes happened on the call. | | `unknown` | Unknown error happened on the call. | Note: This list is not exhaustive and other values can appear in the future.</value>
[DataMember(Name = "disconnectCause", EmitDefaultValue = true)]
public string DisconnectCause { get; set; }
/// <summary>
/// Populated only if the call ended with an error, with text explaining the reason.
/// </summary>
/// <value>Populated only if the call ended with an error, with text explaining the reason.</value>
[DataMember(Name = "errorMessage", EmitDefaultValue = true)]
public string ErrorMessage { get; set; }
/// <summary>
/// Populated only if the call ended with an error, with a Bandwidth internal id that references the error event.
/// </summary>
/// <value>Populated only if the call ended with an error, with a Bandwidth internal id that references the error event.</value>
[DataMember(Name = "errorId", EmitDefaultValue = true)]
public string ErrorId { get; set; }
/// <summary>
/// The last time the call had a state update, in ISO 8601 format.
/// </summary>
/// <value>The last time the call had a state update, in ISO 8601 format.</value>
/// <example>2022-06-16T13:15:18.314Z</example>
[DataMember(Name = "lastUpdate", EmitDefaultValue = false)]
public DateTime LastUpdate { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class CallState {\n");
sb.Append(" ApplicationId: ").Append(ApplicationId).Append("\n");
sb.Append(" AccountId: ").Append(AccountId).Append("\n");
sb.Append(" CallId: ").Append(CallId).Append("\n");
sb.Append(" ParentCallId: ").Append(ParentCallId).Append("\n");
sb.Append(" To: ").Append(To).Append("\n");
sb.Append(" From: ").Append(From).Append("\n");
sb.Append(" Direction: ").Append(Direction).Append("\n");
sb.Append(" State: ").Append(State).Append("\n");
sb.Append(" StirShaken: ").Append(StirShaken).Append("\n");
sb.Append(" Identity: ").Append(Identity).Append("\n");
sb.Append(" EnqueuedTime: ").Append(EnqueuedTime).Append("\n");
sb.Append(" StartTime: ").Append(StartTime).Append("\n");
sb.Append(" AnswerTime: ").Append(AnswerTime).Append("\n");
sb.Append(" EndTime: ").Append(EndTime).Append("\n");
sb.Append(" DisconnectCause: ").Append(DisconnectCause).Append("\n");
sb.Append(" ErrorMessage: ").Append(ErrorMessage).Append("\n");
sb.Append(" ErrorId: ").Append(ErrorId).Append("\n");
sb.Append(" LastUpdate: ").Append(LastUpdate).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
}