voice-react-native-sdk 1.6.2-fork.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/LICENSE +206 -0
  2. package/README.md +179 -0
  3. package/android/build.gradle +113 -0
  4. package/android/gradle.properties +29 -0
  5. package/android/src/main/AndroidManifest.xml +30 -0
  6. package/android/src/main/java/com/twiliovoicereactnative/AudioSwitchManager.java +141 -0
  7. package/android/src/main/java/com/twiliovoicereactnative/CallListenerProxy.java +186 -0
  8. package/android/src/main/java/com/twiliovoicereactnative/CallMessageListenerProxy.java +103 -0
  9. package/android/src/main/java/com/twiliovoicereactnative/CallRecordDatabase.java +183 -0
  10. package/android/src/main/java/com/twiliovoicereactnative/CommonConstants.java +195 -0
  11. package/android/src/main/java/com/twiliovoicereactnative/ConfigurationProperties.java +41 -0
  12. package/android/src/main/java/com/twiliovoicereactnative/Constants.java +23 -0
  13. package/android/src/main/java/com/twiliovoicereactnative/ExpoActivityLifecycleListener.java +27 -0
  14. package/android/src/main/java/com/twiliovoicereactnative/ExpoApplicationLifecycleListener.java +14 -0
  15. package/android/src/main/java/com/twiliovoicereactnative/ExpoModule.kt +36 -0
  16. package/android/src/main/java/com/twiliovoicereactnative/ExpoPackage.java +20 -0
  17. package/android/src/main/java/com/twiliovoicereactnative/JSEventEmitter.java +98 -0
  18. package/android/src/main/java/com/twiliovoicereactnative/MediaPlayerManager.java +58 -0
  19. package/android/src/main/java/com/twiliovoicereactnative/NotificationUtility.java +363 -0
  20. package/android/src/main/java/com/twiliovoicereactnative/ReactNativeArgumentsSerializer.java +276 -0
  21. package/android/src/main/java/com/twiliovoicereactnative/SDKLog.java +74 -0
  22. package/android/src/main/java/com/twiliovoicereactnative/StatsListenerProxy.java +178 -0
  23. package/android/src/main/java/com/twiliovoicereactnative/TwilioVoiceReactNativeModule.java +778 -0
  24. package/android/src/main/java/com/twiliovoicereactnative/TwilioVoiceReactNativePackage.java +28 -0
  25. package/android/src/main/java/com/twiliovoicereactnative/VoiceActivityProxy.java +101 -0
  26. package/android/src/main/java/com/twiliovoicereactnative/VoiceApplicationProxy.java +133 -0
  27. package/android/src/main/java/com/twiliovoicereactnative/VoiceFirebaseMessagingService.java +88 -0
  28. package/android/src/main/java/com/twiliovoicereactnative/VoiceService.java +403 -0
  29. package/android/src/main/res/drawable/answered_call_small_icon.png +0 -0
  30. package/android/src/main/res/drawable/ic_launcher_round.png +0 -0
  31. package/android/src/main/res/drawable/ic_launcher_sdk.png +0 -0
  32. package/android/src/main/res/drawable/incoming_call_small_icon.png +0 -0
  33. package/android/src/main/res/drawable/outgoing_call_small_icon.png +0 -0
  34. package/android/src/main/res/raw/disconnect.wav +0 -0
  35. package/android/src/main/res/raw/incoming.wav +0 -0
  36. package/android/src/main/res/raw/outgoing.wav +0 -0
  37. package/android/src/main/res/raw/ringtone.wav +0 -0
  38. package/android/src/main/res/raw/silent.wav +0 -0
  39. package/android/src/main/res/values/colors.xml +11 -0
  40. package/android/src/main/res/values/config.xml +5 -0
  41. package/android/src/main/res/values/dimens.xml +7 -0
  42. package/android/src/main/res/values/strings.xml +25 -0
  43. package/android/src/main/res/values/styles.xml +10 -0
  44. package/android/src/main/res/values-night/colors.xml +11 -0
  45. package/expo-config-plugin/android.js +191 -0
  46. package/expo-config-plugin/ios.js +22 -0
  47. package/expo-module.config.json +6 -0
  48. package/ios/TwilioVoicePushRegistry.h +19 -0
  49. package/ios/TwilioVoicePushRegistry.m +72 -0
  50. package/ios/TwilioVoiceReactNative+CallInvite.m +56 -0
  51. package/ios/TwilioVoiceReactNative+CallKit.m +533 -0
  52. package/ios/TwilioVoiceReactNative+CallMessage.m +81 -0
  53. package/ios/TwilioVoiceReactNative.h +74 -0
  54. package/ios/TwilioVoiceReactNative.m +1046 -0
  55. package/ios/TwilioVoiceReactNative.xcodeproj/project.pbxproj +328 -0
  56. package/ios/TwilioVoiceReactNativeConstants.h +200 -0
  57. package/ios/Utilities/TwilioVoiceStatsReport.h +175 -0
  58. package/lib/commonjs/AudioDevice.js +101 -0
  59. package/lib/commonjs/AudioDevice.js.map +1 -0
  60. package/lib/commonjs/Call.js +765 -0
  61. package/lib/commonjs/Call.js.map +1 -0
  62. package/lib/commonjs/CallInvite.js +452 -0
  63. package/lib/commonjs/CallInvite.js.map +1 -0
  64. package/lib/commonjs/CallMessage/CallMessage.js +54 -0
  65. package/lib/commonjs/CallMessage/CallMessage.js.map +1 -0
  66. package/lib/commonjs/CallMessage/IncomingCallMessage.js +120 -0
  67. package/lib/commonjs/CallMessage/IncomingCallMessage.js.map +1 -0
  68. package/lib/commonjs/CallMessage/OutgoingCallMessage.js +148 -0
  69. package/lib/commonjs/CallMessage/OutgoingCallMessage.js.map +1 -0
  70. package/lib/commonjs/ExpoModule.js +69 -0
  71. package/lib/commonjs/ExpoModule.js.map +1 -0
  72. package/lib/commonjs/Voice.js +611 -0
  73. package/lib/commonjs/Voice.js.map +1 -0
  74. package/lib/commonjs/common.js +26 -0
  75. package/lib/commonjs/common.js.map +1 -0
  76. package/lib/commonjs/constants.js +158 -0
  77. package/lib/commonjs/constants.js.map +1 -0
  78. package/lib/commonjs/error/InvalidArgumentError.js +32 -0
  79. package/lib/commonjs/error/InvalidArgumentError.js.map +1 -0
  80. package/lib/commonjs/error/InvalidStateError.js +33 -0
  81. package/lib/commonjs/error/InvalidStateError.js.map +1 -0
  82. package/lib/commonjs/error/TwilioError.js +38 -0
  83. package/lib/commonjs/error/TwilioError.js.map +1 -0
  84. package/lib/commonjs/error/UnsupportedPlatformError.js +33 -0
  85. package/lib/commonjs/error/UnsupportedPlatformError.js.map +1 -0
  86. package/lib/commonjs/error/generated.js +2343 -0
  87. package/lib/commonjs/error/generated.js.map +1 -0
  88. package/lib/commonjs/error/index.js +112 -0
  89. package/lib/commonjs/error/index.js.map +1 -0
  90. package/lib/commonjs/error/utility.js +37 -0
  91. package/lib/commonjs/error/utility.js.map +1 -0
  92. package/lib/commonjs/index.js +95 -0
  93. package/lib/commonjs/index.js.map +1 -0
  94. package/lib/commonjs/type/AudioDevice.js +6 -0
  95. package/lib/commonjs/type/AudioDevice.js.map +1 -0
  96. package/lib/commonjs/type/Call.js +6 -0
  97. package/lib/commonjs/type/Call.js.map +1 -0
  98. package/lib/commonjs/type/CallInvite.js +6 -0
  99. package/lib/commonjs/type/CallInvite.js.map +1 -0
  100. package/lib/commonjs/type/CallKit.js +30 -0
  101. package/lib/commonjs/type/CallKit.js.map +1 -0
  102. package/lib/commonjs/type/CallMessage.js +6 -0
  103. package/lib/commonjs/type/CallMessage.js.map +1 -0
  104. package/lib/commonjs/type/Error.js +6 -0
  105. package/lib/commonjs/type/Error.js.map +1 -0
  106. package/lib/commonjs/type/NativeModule.js +6 -0
  107. package/lib/commonjs/type/NativeModule.js.map +1 -0
  108. package/lib/commonjs/type/RTCStats.js +29 -0
  109. package/lib/commonjs/type/RTCStats.js.map +1 -0
  110. package/lib/commonjs/type/Voice.js +6 -0
  111. package/lib/commonjs/type/Voice.js.map +1 -0
  112. package/lib/commonjs/type/common.js +2 -0
  113. package/lib/commonjs/type/common.js.map +1 -0
  114. package/lib/module/AudioDevice.js +97 -0
  115. package/lib/module/AudioDevice.js.map +1 -0
  116. package/lib/module/Call.js +766 -0
  117. package/lib/module/Call.js.map +1 -0
  118. package/lib/module/CallInvite.js +450 -0
  119. package/lib/module/CallInvite.js.map +1 -0
  120. package/lib/module/CallMessage/CallMessage.js +51 -0
  121. package/lib/module/CallMessage/CallMessage.js.map +1 -0
  122. package/lib/module/CallMessage/IncomingCallMessage.js +116 -0
  123. package/lib/module/CallMessage/IncomingCallMessage.js.map +1 -0
  124. package/lib/module/CallMessage/OutgoingCallMessage.js +154 -0
  125. package/lib/module/CallMessage/OutgoingCallMessage.js.map +1 -0
  126. package/lib/module/ExpoModule.js +58 -0
  127. package/lib/module/ExpoModule.js.map +1 -0
  128. package/lib/module/Voice.js +598 -0
  129. package/lib/module/Voice.js.map +1 -0
  130. package/lib/module/common.js +11 -0
  131. package/lib/module/common.js.map +1 -0
  132. package/lib/module/constants.js +151 -0
  133. package/lib/module/constants.js.map +1 -0
  134. package/lib/module/error/InvalidArgumentError.js +23 -0
  135. package/lib/module/error/InvalidArgumentError.js.map +1 -0
  136. package/lib/module/error/InvalidStateError.js +24 -0
  137. package/lib/module/error/InvalidStateError.js.map +1 -0
  138. package/lib/module/error/TwilioError.js +29 -0
  139. package/lib/module/error/TwilioError.js.map +1 -0
  140. package/lib/module/error/UnsupportedPlatformError.js +24 -0
  141. package/lib/module/error/UnsupportedPlatformError.js.map +1 -0
  142. package/lib/module/error/generated.js +2315 -0
  143. package/lib/module/error/generated.js.map +1 -0
  144. package/lib/module/error/index.js +6 -0
  145. package/lib/module/error/index.js.map +1 -0
  146. package/lib/module/error/utility.js +27 -0
  147. package/lib/module/error/utility.js.map +1 -0
  148. package/lib/module/index.js +23 -0
  149. package/lib/module/index.js.map +1 -0
  150. package/lib/module/type/AudioDevice.js +2 -0
  151. package/lib/module/type/AudioDevice.js.map +1 -0
  152. package/lib/module/type/Call.js +2 -0
  153. package/lib/module/type/Call.js.map +1 -0
  154. package/lib/module/type/CallInvite.js +2 -0
  155. package/lib/module/type/CallInvite.js.map +1 -0
  156. package/lib/module/type/CallKit.js +22 -0
  157. package/lib/module/type/CallKit.js.map +1 -0
  158. package/lib/module/type/CallMessage.js +2 -0
  159. package/lib/module/type/CallMessage.js.map +1 -0
  160. package/lib/module/type/Error.js +2 -0
  161. package/lib/module/type/Error.js.map +1 -0
  162. package/lib/module/type/NativeModule.js +2 -0
  163. package/lib/module/type/NativeModule.js.map +1 -0
  164. package/lib/module/type/RTCStats.js +21 -0
  165. package/lib/module/type/RTCStats.js.map +1 -0
  166. package/lib/module/type/Voice.js +2 -0
  167. package/lib/module/type/Voice.js.map +1 -0
  168. package/lib/module/type/common.js +2 -0
  169. package/lib/module/type/common.js.map +1 -0
  170. package/lib/typescript/AudioDevice.d.ts +74 -0
  171. package/lib/typescript/Call.d.ts +874 -0
  172. package/lib/typescript/CallInvite.d.ts +484 -0
  173. package/lib/typescript/CallMessage/CallMessage.d.ts +53 -0
  174. package/lib/typescript/CallMessage/IncomingCallMessage.d.ts +75 -0
  175. package/lib/typescript/CallMessage/OutgoingCallMessage.d.ts +198 -0
  176. package/lib/typescript/ExpoModule.d.ts +13 -0
  177. package/lib/typescript/Voice.d.ts +620 -0
  178. package/lib/typescript/common.d.ts +11 -0
  179. package/lib/typescript/constants.d.ts +148 -0
  180. package/lib/typescript/error/InvalidArgumentError.d.ts +11 -0
  181. package/lib/typescript/error/InvalidStateError.d.ts +12 -0
  182. package/lib/typescript/error/TwilioError.d.ts +14 -0
  183. package/lib/typescript/error/UnsupportedPlatformError.d.ts +12 -0
  184. package/lib/typescript/error/generated.d.ts +1558 -0
  185. package/lib/typescript/error/index.d.ts +5 -0
  186. package/lib/typescript/error/utility.d.ts +12 -0
  187. package/lib/typescript/index.d.ts +18 -0
  188. package/lib/typescript/type/AudioDevice.d.ts +15 -0
  189. package/lib/typescript/type/Call.d.ts +59 -0
  190. package/lib/typescript/type/CallInvite.d.ts +40 -0
  191. package/lib/typescript/type/CallKit.d.ts +60 -0
  192. package/lib/typescript/type/CallMessage.d.ts +20 -0
  193. package/lib/typescript/type/Error.d.ts +9 -0
  194. package/lib/typescript/type/NativeModule.d.ts +59 -0
  195. package/lib/typescript/type/RTCStats.d.ts +91 -0
  196. package/lib/typescript/type/Voice.d.ts +16 -0
  197. package/lib/typescript/type/common.d.ts +15 -0
  198. package/package.json +167 -0
  199. package/src/AudioDevice.tsx +88 -0
  200. package/src/Call.tsx +1343 -0
  201. package/src/CallInvite.tsx +757 -0
  202. package/src/CallMessage/CallMessage.ts +83 -0
  203. package/src/CallMessage/IncomingCallMessage.ts +104 -0
  204. package/src/CallMessage/OutgoingCallMessage.ts +308 -0
  205. package/src/ExpoModule.ts +59 -0
  206. package/src/Voice.tsx +1010 -0
  207. package/src/common.ts +16 -0
  208. package/src/constants.ts +193 -0
  209. package/src/error/InvalidArgumentError.ts +19 -0
  210. package/src/error/InvalidStateError.ts +19 -0
  211. package/src/error/TwilioError.ts +22 -0
  212. package/src/error/UnsupportedPlatformError.ts +19 -0
  213. package/src/error/generated.ts +2277 -0
  214. package/src/error/index.ts +18 -0
  215. package/src/error/utility.ts +36 -0
  216. package/src/index.tsx +24 -0
  217. package/src/type/AudioDevice.ts +18 -0
  218. package/src/type/Call.ts +102 -0
  219. package/src/type/CallInvite.ts +59 -0
  220. package/src/type/CallKit.ts +61 -0
  221. package/src/type/CallMessage.ts +31 -0
  222. package/src/type/Error.ts +11 -0
  223. package/src/type/NativeModule.ts +93 -0
  224. package/src/type/RTCStats.ts +99 -0
  225. package/src/type/Voice.ts +31 -0
  226. package/src/type/common.ts +16 -0
  227. package/twilio-voice-react-native.podspec +22 -0
@@ -0,0 +1,2277 @@
1
+ /**
2
+ * This is a generated file. Any modifications here will be overwritten.
3
+ * See scripts/errors.js.
4
+ */
5
+ import { TwilioError } from './TwilioError';
6
+
7
+ /**
8
+ * @public
9
+ * Authorization errors.
10
+ */
11
+ export namespace AuthorizationErrors {
12
+ /**
13
+ * @public
14
+ * AuthorizationErrors.AccessTokenInvalid error.
15
+ * Error code `20101`.
16
+ */
17
+ export class AccessTokenInvalid extends TwilioError {
18
+ /**
19
+ * Not applicable.
20
+ */
21
+ causes: string[] = [];
22
+ /**
23
+ * Invalid access token
24
+ */
25
+ description: string = 'Invalid access token';
26
+ /**
27
+ * Twilio was unable to validate your Access Token
28
+ */
29
+ explanation: string = 'Twilio was unable to validate your Access Token';
30
+ /**
31
+ * AccessTokenInvalid
32
+ */
33
+ name: string = 'AccessTokenInvalid';
34
+ /**
35
+ * Not applicable.
36
+ */
37
+ solutions: string[] = [];
38
+
39
+ constructor(message: string) {
40
+ super(message, 20101);
41
+ Object.setPrototypeOf(this, AuthorizationErrors.AccessTokenInvalid.prototype);
42
+
43
+ const msg: string = typeof message === 'string'
44
+ ? message
45
+ : this.explanation;
46
+
47
+ this.message = `${this.name} (${this.code}): ${msg}`;
48
+ }
49
+ }
50
+
51
+ /**
52
+ * @public
53
+ * AuthorizationErrors.AccessTokenHeaderInvalid error.
54
+ * Error code `20102`.
55
+ */
56
+ export class AccessTokenHeaderInvalid extends TwilioError {
57
+ /**
58
+ * Not applicable.
59
+ */
60
+ causes: string[] = [];
61
+ /**
62
+ * Invalid access token header
63
+ */
64
+ description: string = 'Invalid access token header';
65
+ /**
66
+ * The header of the Access Token provided to the Twilio API was invalid
67
+ */
68
+ explanation: string = 'The header of the Access Token provided to the Twilio API was invalid';
69
+ /**
70
+ * AccessTokenHeaderInvalid
71
+ */
72
+ name: string = 'AccessTokenHeaderInvalid';
73
+ /**
74
+ * Not applicable.
75
+ */
76
+ solutions: string[] = [];
77
+
78
+ constructor(message: string) {
79
+ super(message, 20102);
80
+ Object.setPrototypeOf(this, AuthorizationErrors.AccessTokenHeaderInvalid.prototype);
81
+
82
+ const msg: string = typeof message === 'string'
83
+ ? message
84
+ : this.explanation;
85
+
86
+ this.message = `${this.name} (${this.code}): ${msg}`;
87
+ }
88
+ }
89
+
90
+ /**
91
+ * @public
92
+ * AuthorizationErrors.AccessTokenIssuerInvalid error.
93
+ * Error code `20103`.
94
+ */
95
+ export class AccessTokenIssuerInvalid extends TwilioError {
96
+ /**
97
+ * Not applicable.
98
+ */
99
+ causes: string[] = [];
100
+ /**
101
+ * Invalid access token issuer/subject
102
+ */
103
+ description: string = 'Invalid access token issuer/subject';
104
+ /**
105
+ * The issuer or subject of the Access Token provided to the Twilio API was invalid
106
+ */
107
+ explanation: string = 'The issuer or subject of the Access Token provided to the Twilio API was invalid';
108
+ /**
109
+ * AccessTokenIssuerInvalid
110
+ */
111
+ name: string = 'AccessTokenIssuerInvalid';
112
+ /**
113
+ * Not applicable.
114
+ */
115
+ solutions: string[] = [];
116
+
117
+ constructor(message: string) {
118
+ super(message, 20103);
119
+ Object.setPrototypeOf(this, AuthorizationErrors.AccessTokenIssuerInvalid.prototype);
120
+
121
+ const msg: string = typeof message === 'string'
122
+ ? message
123
+ : this.explanation;
124
+
125
+ this.message = `${this.name} (${this.code}): ${msg}`;
126
+ }
127
+ }
128
+
129
+ /**
130
+ * @public
131
+ * AuthorizationErrors.AccessTokenExpired error.
132
+ * Error code `20104`.
133
+ */
134
+ export class AccessTokenExpired extends TwilioError {
135
+ /**
136
+ * Not applicable.
137
+ */
138
+ causes: string[] = [];
139
+ /**
140
+ * Access token expired or expiration date invalid
141
+ */
142
+ description: string = 'Access token expired or expiration date invalid';
143
+ /**
144
+ * The Access Token provided to the Twilio API has expired, the expiration time specified in the token was invalid, or the expiration time specified was too far in the future
145
+ */
146
+ explanation: string = 'The Access Token provided to the Twilio API has expired, the expiration time specified in the token was invalid, or the expiration time specified was too far in the future';
147
+ /**
148
+ * AccessTokenExpired
149
+ */
150
+ name: string = 'AccessTokenExpired';
151
+ /**
152
+ * Not applicable.
153
+ */
154
+ solutions: string[] = [];
155
+
156
+ constructor(message: string) {
157
+ super(message, 20104);
158
+ Object.setPrototypeOf(this, AuthorizationErrors.AccessTokenExpired.prototype);
159
+
160
+ const msg: string = typeof message === 'string'
161
+ ? message
162
+ : this.explanation;
163
+
164
+ this.message = `${this.name} (${this.code}): ${msg}`;
165
+ }
166
+ }
167
+
168
+ /**
169
+ * @public
170
+ * AuthorizationErrors.AccessTokenNotYetValid error.
171
+ * Error code `20105`.
172
+ */
173
+ export class AccessTokenNotYetValid extends TwilioError {
174
+ /**
175
+ * Not applicable.
176
+ */
177
+ causes: string[] = [];
178
+ /**
179
+ * Access token not yet valid
180
+ */
181
+ description: string = 'Access token not yet valid';
182
+ /**
183
+ * The Access Token provided to the Twilio API is not yet valid
184
+ */
185
+ explanation: string = 'The Access Token provided to the Twilio API is not yet valid';
186
+ /**
187
+ * AccessTokenNotYetValid
188
+ */
189
+ name: string = 'AccessTokenNotYetValid';
190
+ /**
191
+ * Not applicable.
192
+ */
193
+ solutions: string[] = [];
194
+
195
+ constructor(message: string) {
196
+ super(message, 20105);
197
+ Object.setPrototypeOf(this, AuthorizationErrors.AccessTokenNotYetValid.prototype);
198
+
199
+ const msg: string = typeof message === 'string'
200
+ ? message
201
+ : this.explanation;
202
+
203
+ this.message = `${this.name} (${this.code}): ${msg}`;
204
+ }
205
+ }
206
+
207
+ /**
208
+ * @public
209
+ * AuthorizationErrors.AccessTokenGrantsInvalid error.
210
+ * Error code `20106`.
211
+ */
212
+ export class AccessTokenGrantsInvalid extends TwilioError {
213
+ /**
214
+ * Not applicable.
215
+ */
216
+ causes: string[] = [];
217
+ /**
218
+ * Invalid access token grants
219
+ */
220
+ description: string = 'Invalid access token grants';
221
+ /**
222
+ * The Access Token signature and issuer were valid, but the grants specified in the token were invalid, unparseable, or did not authorize the action being requested
223
+ */
224
+ explanation: string = 'The Access Token signature and issuer were valid, but the grants specified in the token were invalid, unparseable, or did not authorize the action being requested';
225
+ /**
226
+ * AccessTokenGrantsInvalid
227
+ */
228
+ name: string = 'AccessTokenGrantsInvalid';
229
+ /**
230
+ * Not applicable.
231
+ */
232
+ solutions: string[] = [];
233
+
234
+ constructor(message: string) {
235
+ super(message, 20106);
236
+ Object.setPrototypeOf(this, AuthorizationErrors.AccessTokenGrantsInvalid.prototype);
237
+
238
+ const msg: string = typeof message === 'string'
239
+ ? message
240
+ : this.explanation;
241
+
242
+ this.message = `${this.name} (${this.code}): ${msg}`;
243
+ }
244
+ }
245
+
246
+ /**
247
+ * @public
248
+ * AuthorizationErrors.AccessTokenSignatureInvalid error.
249
+ * Error code `20107`.
250
+ */
251
+ export class AccessTokenSignatureInvalid extends TwilioError {
252
+ /**
253
+ * Not applicable.
254
+ */
255
+ causes: string[] = [];
256
+ /**
257
+ * Invalid access token signature
258
+ */
259
+ description: string = 'Invalid access token signature';
260
+ /**
261
+ * The signature for the Access Token provided was invalid.
262
+ */
263
+ explanation: string = 'The signature for the Access Token provided was invalid.';
264
+ /**
265
+ * AccessTokenSignatureInvalid
266
+ */
267
+ name: string = 'AccessTokenSignatureInvalid';
268
+ /**
269
+ * Not applicable.
270
+ */
271
+ solutions: string[] = [];
272
+
273
+ constructor(message: string) {
274
+ super(message, 20107);
275
+ Object.setPrototypeOf(this, AuthorizationErrors.AccessTokenSignatureInvalid.prototype);
276
+
277
+ const msg: string = typeof message === 'string'
278
+ ? message
279
+ : this.explanation;
280
+
281
+ this.message = `${this.name} (${this.code}): ${msg}`;
282
+ }
283
+ }
284
+
285
+ /**
286
+ * @public
287
+ * AuthorizationErrors.AuthenticationFailed error.
288
+ * Error code `20151`.
289
+ */
290
+ export class AuthenticationFailed extends TwilioError {
291
+ /**
292
+ * Not applicable.
293
+ */
294
+ causes: string[] = [];
295
+ /**
296
+ * Authentication Failed
297
+ */
298
+ description: string = 'Authentication Failed';
299
+ /**
300
+ * The Authentication with the provided JWT failed
301
+ */
302
+ explanation: string = 'The Authentication with the provided JWT failed';
303
+ /**
304
+ * AuthenticationFailed
305
+ */
306
+ name: string = 'AuthenticationFailed';
307
+ /**
308
+ * Not applicable.
309
+ */
310
+ solutions: string[] = [];
311
+
312
+ constructor(message: string) {
313
+ super(message, 20151);
314
+ Object.setPrototypeOf(this, AuthorizationErrors.AuthenticationFailed.prototype);
315
+
316
+ const msg: string = typeof message === 'string'
317
+ ? message
318
+ : this.explanation;
319
+
320
+ this.message = `${this.name} (${this.code}): ${msg}`;
321
+ }
322
+ }
323
+
324
+ /**
325
+ * @public
326
+ * AuthorizationErrors.ExpirationTimeExceedsMaxTimeAllowed error.
327
+ * Error code `20157`.
328
+ */
329
+ export class ExpirationTimeExceedsMaxTimeAllowed extends TwilioError {
330
+ /**
331
+ * Not applicable.
332
+ */
333
+ causes: string[] = [];
334
+ /**
335
+ * Expiration Time Exceeds Maximum Time Allowed
336
+ */
337
+ description: string = 'Expiration Time Exceeds Maximum Time Allowed';
338
+ /**
339
+ * The expiration time provided when creating the JWT exceeds the maximum duration allowed
340
+ */
341
+ explanation: string = 'The expiration time provided when creating the JWT exceeds the maximum duration allowed';
342
+ /**
343
+ * ExpirationTimeExceedsMaxTimeAllowed
344
+ */
345
+ name: string = 'ExpirationTimeExceedsMaxTimeAllowed';
346
+ /**
347
+ * Not applicable.
348
+ */
349
+ solutions: string[] = [];
350
+
351
+ constructor(message: string) {
352
+ super(message, 20157);
353
+ Object.setPrototypeOf(this, AuthorizationErrors.ExpirationTimeExceedsMaxTimeAllowed.prototype);
354
+
355
+ const msg: string = typeof message === 'string'
356
+ ? message
357
+ : this.explanation;
358
+
359
+ this.message = `${this.name} (${this.code}): ${msg}`;
360
+ }
361
+ }
362
+
363
+ /**
364
+ * @public
365
+ * AuthorizationErrors.AuthorizationError error.
366
+ * Error code `31201`.
367
+ */
368
+ export class AuthorizationError extends TwilioError {
369
+ /**
370
+ * Not applicable.
371
+ */
372
+ causes: string[] = [];
373
+ /**
374
+ * Authorization error
375
+ */
376
+ description: string = 'Authorization error';
377
+ /**
378
+ * The request requires user authentication. The server understood the request, but is refusing to fulfill it.
379
+ */
380
+ explanation: string = 'The request requires user authentication. The server understood the request, but is refusing to fulfill it.';
381
+ /**
382
+ * AuthorizationError
383
+ */
384
+ name: string = 'AuthorizationError';
385
+ /**
386
+ * Not applicable.
387
+ */
388
+ solutions: string[] = [];
389
+
390
+ constructor(message: string) {
391
+ super(message, 31201);
392
+ Object.setPrototypeOf(this, AuthorizationErrors.AuthorizationError.prototype);
393
+
394
+ const msg: string = typeof message === 'string'
395
+ ? message
396
+ : this.explanation;
397
+
398
+ this.message = `${this.name} (${this.code}): ${msg}`;
399
+ }
400
+ }
401
+
402
+ /**
403
+ * @public
404
+ * AuthorizationErrors.RateExceededError error.
405
+ * Error code `31206`.
406
+ */
407
+ export class RateExceededError extends TwilioError {
408
+ /**
409
+ * Rate limit exceeded.
410
+ */
411
+ causes: string[] = [
412
+ 'Rate limit exceeded.',
413
+ ];
414
+ /**
415
+ * Rate exceeded authorized limit.
416
+ */
417
+ description: string = 'Rate exceeded authorized limit.';
418
+ /**
419
+ * The request performed exceeds the authorized limit.
420
+ */
421
+ explanation: string = 'The request performed exceeds the authorized limit.';
422
+ /**
423
+ * RateExceededError
424
+ */
425
+ name: string = 'RateExceededError';
426
+ /**
427
+ * Ensure message send rate does not exceed authorized limits.
428
+ */
429
+ solutions: string[] = [
430
+ 'Ensure message send rate does not exceed authorized limits.',
431
+ ];
432
+
433
+ constructor(message: string) {
434
+ super(message, 31206);
435
+ Object.setPrototypeOf(this, AuthorizationErrors.RateExceededError.prototype);
436
+
437
+ const msg: string = typeof message === 'string'
438
+ ? message
439
+ : this.explanation;
440
+
441
+ this.message = `${this.name} (${this.code}): ${msg}`;
442
+ }
443
+ }
444
+
445
+ /**
446
+ * @public
447
+ * AuthorizationErrors.CallMessageEventTypeInvalidError error.
448
+ * Error code `31210`.
449
+ */
450
+ export class CallMessageEventTypeInvalidError extends TwilioError {
451
+ /**
452
+ * The Call Message Event Type is invalid and is not understood by Twilio Voice.
453
+ */
454
+ causes: string[] = [
455
+ 'The Call Message Event Type is invalid and is not understood by Twilio Voice.',
456
+ ];
457
+ /**
458
+ * Call Message Event Type is invalid.
459
+ */
460
+ description: string = 'Call Message Event Type is invalid.';
461
+ /**
462
+ * The Call Message Event Type is invalid and is not understood by Twilio Voice.
463
+ */
464
+ explanation: string = 'The Call Message Event Type is invalid and is not understood by Twilio Voice.';
465
+ /**
466
+ * CallMessageEventTypeInvalidError
467
+ */
468
+ name: string = 'CallMessageEventTypeInvalidError';
469
+ /**
470
+ * Ensure the Call Message Event Type is Valid and understood by Twilio Voice and try again.
471
+ */
472
+ solutions: string[] = [
473
+ 'Ensure the Call Message Event Type is Valid and understood by Twilio Voice and try again.',
474
+ ];
475
+
476
+ constructor(message: string) {
477
+ super(message, 31210);
478
+ Object.setPrototypeOf(this, AuthorizationErrors.CallMessageEventTypeInvalidError.prototype);
479
+
480
+ const msg: string = typeof message === 'string'
481
+ ? message
482
+ : this.explanation;
483
+
484
+ this.message = `${this.name} (${this.code}): ${msg}`;
485
+ }
486
+ }
487
+
488
+ /**
489
+ * @public
490
+ * AuthorizationErrors.CallMessageUnexpectedStateError error.
491
+ * Error code `31211`.
492
+ */
493
+ export class CallMessageUnexpectedStateError extends TwilioError {
494
+ /**
495
+ * The Call should be at least in the ringing state to subscribe and send Call Message.
496
+ */
497
+ causes: string[] = [
498
+ 'The Call should be at least in the ringing state to subscribe and send Call Message.',
499
+ ];
500
+ /**
501
+ * Call is not in the expected state.
502
+ */
503
+ description: string = 'Call is not in the expected state.';
504
+ /**
505
+ * The Call should be at least in the ringing state to send Call Message.
506
+ */
507
+ explanation: string = 'The Call should be at least in the ringing state to send Call Message.';
508
+ /**
509
+ * CallMessageUnexpectedStateError
510
+ */
511
+ name: string = 'CallMessageUnexpectedStateError';
512
+ /**
513
+ * Ensure the Call is at least in the ringing state and the subscription is successful and try again.
514
+ */
515
+ solutions: string[] = [
516
+ 'Ensure the Call is at least in the ringing state and the subscription is successful and try again.',
517
+ ];
518
+
519
+ constructor(message: string) {
520
+ super(message, 31211);
521
+ Object.setPrototypeOf(this, AuthorizationErrors.CallMessageUnexpectedStateError.prototype);
522
+
523
+ const msg: string = typeof message === 'string'
524
+ ? message
525
+ : this.explanation;
526
+
527
+ this.message = `${this.name} (${this.code}): ${msg}`;
528
+ }
529
+ }
530
+
531
+ /**
532
+ * @public
533
+ * AuthorizationErrors.PayloadSizeExceededError error.
534
+ * Error code `31212`.
535
+ */
536
+ export class PayloadSizeExceededError extends TwilioError {
537
+ /**
538
+ * The payload size of Call Message Event exceeds the authorized limit.
539
+ */
540
+ causes: string[] = [
541
+ 'The payload size of Call Message Event exceeds the authorized limit.',
542
+ ];
543
+ /**
544
+ * Call Message Event Payload size exceeded authorized limit.
545
+ */
546
+ description: string = 'Call Message Event Payload size exceeded authorized limit.';
547
+ /**
548
+ * The request performed to send a Call Message Event exceeds the payload size authorized limit
549
+ */
550
+ explanation: string = 'The request performed to send a Call Message Event exceeds the payload size authorized limit';
551
+ /**
552
+ * PayloadSizeExceededError
553
+ */
554
+ name: string = 'PayloadSizeExceededError';
555
+ /**
556
+ * Reduce payload size of Call Message Event to be within the authorized limit and try again.
557
+ */
558
+ solutions: string[] = [
559
+ 'Reduce payload size of Call Message Event to be within the authorized limit and try again.',
560
+ ];
561
+
562
+ constructor(message: string) {
563
+ super(message, 31212);
564
+ Object.setPrototypeOf(this, AuthorizationErrors.PayloadSizeExceededError.prototype);
565
+
566
+ const msg: string = typeof message === 'string'
567
+ ? message
568
+ : this.explanation;
569
+
570
+ this.message = `${this.name} (${this.code}): ${msg}`;
571
+ }
572
+ }
573
+
574
+ /**
575
+ * @public
576
+ * AuthorizationErrors.AccessTokenRejected error.
577
+ * Error code `51007`.
578
+ */
579
+ export class AccessTokenRejected extends TwilioError {
580
+ /**
581
+ * Not applicable.
582
+ */
583
+ causes: string[] = [];
584
+ /**
585
+ * Token authentication is rejected by authentication service
586
+ */
587
+ description: string = 'Token authentication is rejected by authentication service';
588
+ /**
589
+ * The authentication service has rejected the provided Access Token. To check whether the Access Token is structurally correct, you can use the tools available at https://jwt.io. For the details of Twilio's specific Access Token implementation including the grant format, check https://www.twilio.com/docs/iam/access-tokens.
590
+ */
591
+ explanation: string = 'The authentication service has rejected the provided Access Token. To check whether the Access Token is structurally correct, you can use the tools available at https://jwt.io. For the details of Twilio\'s specific Access Token implementation including the grant format, check https://www.twilio.com/docs/iam/access-tokens.';
592
+ /**
593
+ * AccessTokenRejected
594
+ */
595
+ name: string = 'AccessTokenRejected';
596
+ /**
597
+ * Not applicable.
598
+ */
599
+ solutions: string[] = [];
600
+
601
+ constructor(message: string) {
602
+ super(message, 51007);
603
+ Object.setPrototypeOf(this, AuthorizationErrors.AccessTokenRejected.prototype);
604
+
605
+ const msg: string = typeof message === 'string'
606
+ ? message
607
+ : this.explanation;
608
+
609
+ this.message = `${this.name} (${this.code}): ${msg}`;
610
+ }
611
+ }
612
+ }
613
+
614
+ /**
615
+ * @public
616
+ * Forbidden errors.
617
+ */
618
+ export namespace ForbiddenErrors {
619
+ /**
620
+ * @public
621
+ * ForbiddenErrors.Forbidden error.
622
+ * Error code `20403`.
623
+ */
624
+ export class Forbidden extends TwilioError {
625
+ /**
626
+ * Not applicable.
627
+ */
628
+ causes: string[] = [];
629
+ /**
630
+ * 403 Forbidden
631
+ */
632
+ description: string = '403 Forbidden';
633
+ /**
634
+ * The account lacks permission to access the Twilio API. Typically this means the account has been suspended or closed. For assistance, please contact support
635
+ */
636
+ explanation: string = 'The account lacks permission to access the Twilio API. Typically this means the account has been suspended or closed. For assistance, please contact support';
637
+ /**
638
+ * Forbidden
639
+ */
640
+ name: string = 'Forbidden';
641
+ /**
642
+ * Not applicable.
643
+ */
644
+ solutions: string[] = [];
645
+
646
+ constructor(message: string) {
647
+ super(message, 20403);
648
+ Object.setPrototypeOf(this, ForbiddenErrors.Forbidden.prototype);
649
+
650
+ const msg: string = typeof message === 'string'
651
+ ? message
652
+ : this.explanation;
653
+
654
+ this.message = `${this.name} (${this.code}): ${msg}`;
655
+ }
656
+ }
657
+ }
658
+
659
+ /**
660
+ * @public
661
+ * Client errors.
662
+ */
663
+ export namespace ClientErrors {
664
+ /**
665
+ * @public
666
+ * ClientErrors.BadRequest error.
667
+ * Error code `31400`.
668
+ */
669
+ export class BadRequest extends TwilioError {
670
+ /**
671
+ * Not applicable.
672
+ */
673
+ causes: string[] = [];
674
+ /**
675
+ * Bad Request (HTTP/SIP)
676
+ */
677
+ description: string = 'Bad Request (HTTP/SIP)';
678
+ /**
679
+ * The request could not be understood due to malformed syntax.
680
+ */
681
+ explanation: string = 'The request could not be understood due to malformed syntax.';
682
+ /**
683
+ * BadRequest
684
+ */
685
+ name: string = 'BadRequest';
686
+ /**
687
+ * Not applicable.
688
+ */
689
+ solutions: string[] = [];
690
+
691
+ constructor(message: string) {
692
+ super(message, 31400);
693
+ Object.setPrototypeOf(this, ClientErrors.BadRequest.prototype);
694
+
695
+ const msg: string = typeof message === 'string'
696
+ ? message
697
+ : this.explanation;
698
+
699
+ this.message = `${this.name} (${this.code}): ${msg}`;
700
+ }
701
+ }
702
+
703
+ /**
704
+ * @public
705
+ * ClientErrors.Forbidden error.
706
+ * Error code `31403`.
707
+ */
708
+ export class Forbidden extends TwilioError {
709
+ /**
710
+ * Not applicable.
711
+ */
712
+ causes: string[] = [];
713
+ /**
714
+ * Forbidden (HTTP/SIP)
715
+ */
716
+ description: string = 'Forbidden (HTTP/SIP)';
717
+ /**
718
+ * The server understood the request, but is refusing to fulfill it.
719
+ */
720
+ explanation: string = 'The server understood the request, but is refusing to fulfill it.';
721
+ /**
722
+ * Forbidden
723
+ */
724
+ name: string = 'Forbidden';
725
+ /**
726
+ * Not applicable.
727
+ */
728
+ solutions: string[] = [];
729
+
730
+ constructor(message: string) {
731
+ super(message, 31403);
732
+ Object.setPrototypeOf(this, ClientErrors.Forbidden.prototype);
733
+
734
+ const msg: string = typeof message === 'string'
735
+ ? message
736
+ : this.explanation;
737
+
738
+ this.message = `${this.name} (${this.code}): ${msg}`;
739
+ }
740
+ }
741
+
742
+ /**
743
+ * @public
744
+ * ClientErrors.NotFound error.
745
+ * Error code `31404`.
746
+ */
747
+ export class NotFound extends TwilioError {
748
+ /**
749
+ * The outbound call was made to an invalid phone number.
750
+ * The TwiML application sid is missing a Voice URL.
751
+ */
752
+ causes: string[] = [
753
+ 'The outbound call was made to an invalid phone number.',
754
+ 'The TwiML application sid is missing a Voice URL.',
755
+ ];
756
+ /**
757
+ * Not Found (HTTP/SIP)
758
+ */
759
+ description: string = 'Not Found (HTTP/SIP)';
760
+ /**
761
+ * The server has not found anything matching the request.
762
+ */
763
+ explanation: string = 'The server has not found anything matching the request.';
764
+ /**
765
+ * NotFound
766
+ */
767
+ name: string = 'NotFound';
768
+ /**
769
+ * Ensure the phone number dialed is valid.
770
+ * Ensure the TwiML application is configured correctly with a Voice URL link.
771
+ */
772
+ solutions: string[] = [
773
+ 'Ensure the phone number dialed is valid.',
774
+ 'Ensure the TwiML application is configured correctly with a Voice URL link.',
775
+ ];
776
+
777
+ constructor(message: string) {
778
+ super(message, 31404);
779
+ Object.setPrototypeOf(this, ClientErrors.NotFound.prototype);
780
+
781
+ const msg: string = typeof message === 'string'
782
+ ? message
783
+ : this.explanation;
784
+
785
+ this.message = `${this.name} (${this.code}): ${msg}`;
786
+ }
787
+ }
788
+
789
+ /**
790
+ * @public
791
+ * ClientErrors.RequestTimeout error.
792
+ * Error code `31408`.
793
+ */
794
+ export class RequestTimeout extends TwilioError {
795
+ /**
796
+ * Not applicable.
797
+ */
798
+ causes: string[] = [];
799
+ /**
800
+ * Request Timeout (HTTP/SIP)
801
+ */
802
+ description: string = 'Request Timeout (HTTP/SIP)';
803
+ /**
804
+ * A request timeout occurred.
805
+ */
806
+ explanation: string = 'A request timeout occurred.';
807
+ /**
808
+ * RequestTimeout
809
+ */
810
+ name: string = 'RequestTimeout';
811
+ /**
812
+ * Not applicable.
813
+ */
814
+ solutions: string[] = [];
815
+
816
+ constructor(message: string) {
817
+ super(message, 31408);
818
+ Object.setPrototypeOf(this, ClientErrors.RequestTimeout.prototype);
819
+
820
+ const msg: string = typeof message === 'string'
821
+ ? message
822
+ : this.explanation;
823
+
824
+ this.message = `${this.name} (${this.code}): ${msg}`;
825
+ }
826
+ }
827
+
828
+ /**
829
+ * @public
830
+ * ClientErrors.Conflict error.
831
+ * Error code `31409`.
832
+ */
833
+ export class Conflict extends TwilioError {
834
+ /**
835
+ * Not applicable.
836
+ */
837
+ causes: string[] = [];
838
+ /**
839
+ * Conflict (HTTP)
840
+ */
841
+ description: string = 'Conflict (HTTP)';
842
+ /**
843
+ * The request could not be processed because of a conflict in the current state of the resource. Another request may be in progress.
844
+ */
845
+ explanation: string = 'The request could not be processed because of a conflict in the current state of the resource. Another request may be in progress.';
846
+ /**
847
+ * Conflict
848
+ */
849
+ name: string = 'Conflict';
850
+ /**
851
+ * Not applicable.
852
+ */
853
+ solutions: string[] = [];
854
+
855
+ constructor(message: string) {
856
+ super(message, 31409);
857
+ Object.setPrototypeOf(this, ClientErrors.Conflict.prototype);
858
+
859
+ const msg: string = typeof message === 'string'
860
+ ? message
861
+ : this.explanation;
862
+
863
+ this.message = `${this.name} (${this.code}): ${msg}`;
864
+ }
865
+ }
866
+
867
+ /**
868
+ * @public
869
+ * ClientErrors.UpgradeRequired error.
870
+ * Error code `31426`.
871
+ */
872
+ export class UpgradeRequired extends TwilioError {
873
+ /**
874
+ * Not applicable.
875
+ */
876
+ causes: string[] = [];
877
+ /**
878
+ * Upgrade Required (HTTP)
879
+ */
880
+ description: string = 'Upgrade Required (HTTP)';
881
+ /**
882
+ * This error is raised when an HTTP 426 response is received. The reason for this is most likely because of an incompatible TLS version. To mitigate this, you may need to upgrade the OS or download a more recent version of the SDK.
883
+ */
884
+ explanation: string = 'This error is raised when an HTTP 426 response is received. The reason for this is most likely because of an incompatible TLS version. To mitigate this, you may need to upgrade the OS or download a more recent version of the SDK.';
885
+ /**
886
+ * UpgradeRequired
887
+ */
888
+ name: string = 'UpgradeRequired';
889
+ /**
890
+ * Not applicable.
891
+ */
892
+ solutions: string[] = [];
893
+
894
+ constructor(message: string) {
895
+ super(message, 31426);
896
+ Object.setPrototypeOf(this, ClientErrors.UpgradeRequired.prototype);
897
+
898
+ const msg: string = typeof message === 'string'
899
+ ? message
900
+ : this.explanation;
901
+
902
+ this.message = `${this.name} (${this.code}): ${msg}`;
903
+ }
904
+ }
905
+
906
+ /**
907
+ * @public
908
+ * ClientErrors.TooManyRequests error.
909
+ * Error code `31429`.
910
+ */
911
+ export class TooManyRequests extends TwilioError {
912
+ /**
913
+ * Not applicable.
914
+ */
915
+ causes: string[] = [];
916
+ /**
917
+ * Too Many Requests (HTTP)
918
+ */
919
+ description: string = 'Too Many Requests (HTTP)';
920
+ /**
921
+ * Too many requests were sent in a given amount of time.
922
+ */
923
+ explanation: string = 'Too many requests were sent in a given amount of time.';
924
+ /**
925
+ * TooManyRequests
926
+ */
927
+ name: string = 'TooManyRequests';
928
+ /**
929
+ * Not applicable.
930
+ */
931
+ solutions: string[] = [];
932
+
933
+ constructor(message: string) {
934
+ super(message, 31429);
935
+ Object.setPrototypeOf(this, ClientErrors.TooManyRequests.prototype);
936
+
937
+ const msg: string = typeof message === 'string'
938
+ ? message
939
+ : this.explanation;
940
+
941
+ this.message = `${this.name} (${this.code}): ${msg}`;
942
+ }
943
+ }
944
+
945
+ /**
946
+ * @public
947
+ * ClientErrors.TemporarilyUnavailable error.
948
+ * Error code `31480`.
949
+ */
950
+ export class TemporarilyUnavailable extends TwilioError {
951
+ /**
952
+ * Not applicable.
953
+ */
954
+ causes: string[] = [];
955
+ /**
956
+ * Temporarily Unavailable (SIP)
957
+ */
958
+ description: string = 'Temporarily Unavailable (SIP)';
959
+ /**
960
+ * The callee is currently unavailable.
961
+ */
962
+ explanation: string = 'The callee is currently unavailable.';
963
+ /**
964
+ * TemporarilyUnavailable
965
+ */
966
+ name: string = 'TemporarilyUnavailable';
967
+ /**
968
+ * Not applicable.
969
+ */
970
+ solutions: string[] = [];
971
+
972
+ constructor(message: string) {
973
+ super(message, 31480);
974
+ Object.setPrototypeOf(this, ClientErrors.TemporarilyUnavailable.prototype);
975
+
976
+ const msg: string = typeof message === 'string'
977
+ ? message
978
+ : this.explanation;
979
+
980
+ this.message = `${this.name} (${this.code}): ${msg}`;
981
+ }
982
+ }
983
+
984
+ /**
985
+ * @public
986
+ * ClientErrors.CallTransactionDoesNotExist error.
987
+ * Error code `31481`.
988
+ */
989
+ export class CallTransactionDoesNotExist extends TwilioError {
990
+ /**
991
+ * Not applicable.
992
+ */
993
+ causes: string[] = [];
994
+ /**
995
+ * Call/Transaction Does Not Exist (SIP)
996
+ */
997
+ description: string = 'Call/Transaction Does Not Exist (SIP)';
998
+ /**
999
+ * The call no longer exists.
1000
+ */
1001
+ explanation: string = 'The call no longer exists.';
1002
+ /**
1003
+ * CallTransactionDoesNotExist
1004
+ */
1005
+ name: string = 'CallTransactionDoesNotExist';
1006
+ /**
1007
+ * Not applicable.
1008
+ */
1009
+ solutions: string[] = [];
1010
+
1011
+ constructor(message: string) {
1012
+ super(message, 31481);
1013
+ Object.setPrototypeOf(this, ClientErrors.CallTransactionDoesNotExist.prototype);
1014
+
1015
+ const msg: string = typeof message === 'string'
1016
+ ? message
1017
+ : this.explanation;
1018
+
1019
+ this.message = `${this.name} (${this.code}): ${msg}`;
1020
+ }
1021
+ }
1022
+
1023
+ /**
1024
+ * @public
1025
+ * ClientErrors.AddressIncomplete error.
1026
+ * Error code `31484`.
1027
+ */
1028
+ export class AddressIncomplete extends TwilioError {
1029
+ /**
1030
+ * The outbound call was made with a phone number that has an invalid format.
1031
+ */
1032
+ causes: string[] = [
1033
+ 'The outbound call was made with a phone number that has an invalid format.',
1034
+ ];
1035
+ /**
1036
+ * Address Incomplete (SIP)
1037
+ */
1038
+ description: string = 'Address Incomplete (SIP)';
1039
+ /**
1040
+ * The provided phone number is malformed.
1041
+ */
1042
+ explanation: string = 'The provided phone number is malformed.';
1043
+ /**
1044
+ * AddressIncomplete
1045
+ */
1046
+ name: string = 'AddressIncomplete';
1047
+ /**
1048
+ * Ensure the phone number dialed is formatted correctly.
1049
+ */
1050
+ solutions: string[] = [
1051
+ 'Ensure the phone number dialed is formatted correctly.',
1052
+ ];
1053
+
1054
+ constructor(message: string) {
1055
+ super(message, 31484);
1056
+ Object.setPrototypeOf(this, ClientErrors.AddressIncomplete.prototype);
1057
+
1058
+ const msg: string = typeof message === 'string'
1059
+ ? message
1060
+ : this.explanation;
1061
+
1062
+ this.message = `${this.name} (${this.code}): ${msg}`;
1063
+ }
1064
+ }
1065
+
1066
+ /**
1067
+ * @public
1068
+ * ClientErrors.BusyHere error.
1069
+ * Error code `31486`.
1070
+ */
1071
+ export class BusyHere extends TwilioError {
1072
+ /**
1073
+ * Not applicable.
1074
+ */
1075
+ causes: string[] = [];
1076
+ /**
1077
+ * Busy Here (SIP)
1078
+ */
1079
+ description: string = 'Busy Here (SIP)';
1080
+ /**
1081
+ * The callee is busy.
1082
+ */
1083
+ explanation: string = 'The callee is busy.';
1084
+ /**
1085
+ * BusyHere
1086
+ */
1087
+ name: string = 'BusyHere';
1088
+ /**
1089
+ * Not applicable.
1090
+ */
1091
+ solutions: string[] = [];
1092
+
1093
+ constructor(message: string) {
1094
+ super(message, 31486);
1095
+ Object.setPrototypeOf(this, ClientErrors.BusyHere.prototype);
1096
+
1097
+ const msg: string = typeof message === 'string'
1098
+ ? message
1099
+ : this.explanation;
1100
+
1101
+ this.message = `${this.name} (${this.code}): ${msg}`;
1102
+ }
1103
+ }
1104
+
1105
+ /**
1106
+ * @public
1107
+ * ClientErrors.RequestTerminated error.
1108
+ * Error code `31487`.
1109
+ */
1110
+ export class RequestTerminated extends TwilioError {
1111
+ /**
1112
+ * Not applicable.
1113
+ */
1114
+ causes: string[] = [];
1115
+ /**
1116
+ * Request Terminated (SIP)
1117
+ */
1118
+ description: string = 'Request Terminated (SIP)';
1119
+ /**
1120
+ * The request has terminated as a result of a bye or cancel.
1121
+ */
1122
+ explanation: string = 'The request has terminated as a result of a bye or cancel.';
1123
+ /**
1124
+ * RequestTerminated
1125
+ */
1126
+ name: string = 'RequestTerminated';
1127
+ /**
1128
+ * Not applicable.
1129
+ */
1130
+ solutions: string[] = [];
1131
+
1132
+ constructor(message: string) {
1133
+ super(message, 31487);
1134
+ Object.setPrototypeOf(this, ClientErrors.RequestTerminated.prototype);
1135
+
1136
+ const msg: string = typeof message === 'string'
1137
+ ? message
1138
+ : this.explanation;
1139
+
1140
+ this.message = `${this.name} (${this.code}): ${msg}`;
1141
+ }
1142
+ }
1143
+ }
1144
+
1145
+ /**
1146
+ * @public
1147
+ * Server errors.
1148
+ */
1149
+ export namespace ServerErrors {
1150
+ /**
1151
+ * @public
1152
+ * ServerErrors.InternalServerError error.
1153
+ * Error code `31500`.
1154
+ */
1155
+ export class InternalServerError extends TwilioError {
1156
+ /**
1157
+ * Not applicable.
1158
+ */
1159
+ causes: string[] = [];
1160
+ /**
1161
+ * Internal Server Error (HTTP/SIP)
1162
+ */
1163
+ description: string = 'Internal Server Error (HTTP/SIP)';
1164
+ /**
1165
+ * The server could not fulfill the request due to some unexpected condition.
1166
+ */
1167
+ explanation: string = 'The server could not fulfill the request due to some unexpected condition.';
1168
+ /**
1169
+ * InternalServerError
1170
+ */
1171
+ name: string = 'InternalServerError';
1172
+ /**
1173
+ * Not applicable.
1174
+ */
1175
+ solutions: string[] = [];
1176
+
1177
+ constructor(message: string) {
1178
+ super(message, 31500);
1179
+ Object.setPrototypeOf(this, ServerErrors.InternalServerError.prototype);
1180
+
1181
+ const msg: string = typeof message === 'string'
1182
+ ? message
1183
+ : this.explanation;
1184
+
1185
+ this.message = `${this.name} (${this.code}): ${msg}`;
1186
+ }
1187
+ }
1188
+
1189
+ /**
1190
+ * @public
1191
+ * ServerErrors.BadGateway error.
1192
+ * Error code `31502`.
1193
+ */
1194
+ export class BadGateway extends TwilioError {
1195
+ /**
1196
+ * Not applicable.
1197
+ */
1198
+ causes: string[] = [];
1199
+ /**
1200
+ * Bad Gateway (HTTP/SIP)
1201
+ */
1202
+ description: string = 'Bad Gateway (HTTP/SIP)';
1203
+ /**
1204
+ * The server is acting as a gateway or proxy, and received an invalid response from a downstream server while attempting to fulfill the request.
1205
+ */
1206
+ explanation: string = 'The server is acting as a gateway or proxy, and received an invalid response from a downstream server while attempting to fulfill the request.';
1207
+ /**
1208
+ * BadGateway
1209
+ */
1210
+ name: string = 'BadGateway';
1211
+ /**
1212
+ * Not applicable.
1213
+ */
1214
+ solutions: string[] = [];
1215
+
1216
+ constructor(message: string) {
1217
+ super(message, 31502);
1218
+ Object.setPrototypeOf(this, ServerErrors.BadGateway.prototype);
1219
+
1220
+ const msg: string = typeof message === 'string'
1221
+ ? message
1222
+ : this.explanation;
1223
+
1224
+ this.message = `${this.name} (${this.code}): ${msg}`;
1225
+ }
1226
+ }
1227
+
1228
+ /**
1229
+ * @public
1230
+ * ServerErrors.ServiceUnavailable error.
1231
+ * Error code `31503`.
1232
+ */
1233
+ export class ServiceUnavailable extends TwilioError {
1234
+ /**
1235
+ * Not applicable.
1236
+ */
1237
+ causes: string[] = [];
1238
+ /**
1239
+ * Service Unavailable (HTTP/SIP)
1240
+ */
1241
+ description: string = 'Service Unavailable (HTTP/SIP)';
1242
+ /**
1243
+ * The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. This error can also be caused by the Application SID provided in the access token pointing to an inaccessible URL.
1244
+ */
1245
+ explanation: string = 'The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. This error can also be caused by the Application SID provided in the access token pointing to an inaccessible URL.';
1246
+ /**
1247
+ * ServiceUnavailable
1248
+ */
1249
+ name: string = 'ServiceUnavailable';
1250
+ /**
1251
+ * Not applicable.
1252
+ */
1253
+ solutions: string[] = [];
1254
+
1255
+ constructor(message: string) {
1256
+ super(message, 31503);
1257
+ Object.setPrototypeOf(this, ServerErrors.ServiceUnavailable.prototype);
1258
+
1259
+ const msg: string = typeof message === 'string'
1260
+ ? message
1261
+ : this.explanation;
1262
+
1263
+ this.message = `${this.name} (${this.code}): ${msg}`;
1264
+ }
1265
+ }
1266
+
1267
+ /**
1268
+ * @public
1269
+ * ServerErrors.GatewayTimeout error.
1270
+ * Error code `31504`.
1271
+ */
1272
+ export class GatewayTimeout extends TwilioError {
1273
+ /**
1274
+ * Not applicable.
1275
+ */
1276
+ causes: string[] = [];
1277
+ /**
1278
+ * Gateway Timeout (HTTP/SIP)
1279
+ */
1280
+ description: string = 'Gateway Timeout (HTTP/SIP)';
1281
+ /**
1282
+ * The server, while acting as a gateway or proxy, did not receive a timely response from an upstream server.
1283
+ */
1284
+ explanation: string = 'The server, while acting as a gateway or proxy, did not receive a timely response from an upstream server.';
1285
+ /**
1286
+ * GatewayTimeout
1287
+ */
1288
+ name: string = 'GatewayTimeout';
1289
+ /**
1290
+ * Not applicable.
1291
+ */
1292
+ solutions: string[] = [];
1293
+
1294
+ constructor(message: string) {
1295
+ super(message, 31504);
1296
+ Object.setPrototypeOf(this, ServerErrors.GatewayTimeout.prototype);
1297
+
1298
+ const msg: string = typeof message === 'string'
1299
+ ? message
1300
+ : this.explanation;
1301
+
1302
+ this.message = `${this.name} (${this.code}): ${msg}`;
1303
+ }
1304
+ }
1305
+
1306
+ /**
1307
+ * @public
1308
+ * ServerErrors.DNSResolutionError error.
1309
+ * Error code `31530`.
1310
+ */
1311
+ export class DNSResolutionError extends TwilioError {
1312
+ /**
1313
+ * Not applicable.
1314
+ */
1315
+ causes: string[] = [];
1316
+ /**
1317
+ * DNS Resolution Error (HTTP/SIP)
1318
+ */
1319
+ description: string = 'DNS Resolution Error (HTTP/SIP)';
1320
+ /**
1321
+ * Could not connect to the server.
1322
+ */
1323
+ explanation: string = 'Could not connect to the server.';
1324
+ /**
1325
+ * DNSResolutionError
1326
+ */
1327
+ name: string = 'DNSResolutionError';
1328
+ /**
1329
+ * Not applicable.
1330
+ */
1331
+ solutions: string[] = [];
1332
+
1333
+ constructor(message: string) {
1334
+ super(message, 31530);
1335
+ Object.setPrototypeOf(this, ServerErrors.DNSResolutionError.prototype);
1336
+
1337
+ const msg: string = typeof message === 'string'
1338
+ ? message
1339
+ : this.explanation;
1340
+
1341
+ this.message = `${this.name} (${this.code}): ${msg}`;
1342
+ }
1343
+ }
1344
+ }
1345
+
1346
+ /**
1347
+ * @public
1348
+ * SIPServer errors.
1349
+ */
1350
+ export namespace SIPServerErrors {
1351
+ /**
1352
+ * @public
1353
+ * SIPServerErrors.BusyEverywhere error.
1354
+ * Error code `31600`.
1355
+ */
1356
+ export class BusyEverywhere extends TwilioError {
1357
+ /**
1358
+ * Not applicable.
1359
+ */
1360
+ causes: string[] = [];
1361
+ /**
1362
+ * Busy Everywhere (SIP)
1363
+ */
1364
+ description: string = 'Busy Everywhere (SIP)';
1365
+ /**
1366
+ * All possible destinations are busy.
1367
+ */
1368
+ explanation: string = 'All possible destinations are busy.';
1369
+ /**
1370
+ * BusyEverywhere
1371
+ */
1372
+ name: string = 'BusyEverywhere';
1373
+ /**
1374
+ * Not applicable.
1375
+ */
1376
+ solutions: string[] = [];
1377
+
1378
+ constructor(message: string) {
1379
+ super(message, 31600);
1380
+ Object.setPrototypeOf(this, SIPServerErrors.BusyEverywhere.prototype);
1381
+
1382
+ const msg: string = typeof message === 'string'
1383
+ ? message
1384
+ : this.explanation;
1385
+
1386
+ this.message = `${this.name} (${this.code}): ${msg}`;
1387
+ }
1388
+ }
1389
+
1390
+ /**
1391
+ * @public
1392
+ * SIPServerErrors.Decline error.
1393
+ * Error code `31603`.
1394
+ */
1395
+ export class Decline extends TwilioError {
1396
+ /**
1397
+ * Not applicable.
1398
+ */
1399
+ causes: string[] = [];
1400
+ /**
1401
+ * Decline (SIP)
1402
+ */
1403
+ description: string = 'Decline (SIP)';
1404
+ /**
1405
+ * The callee does not wish to participate in the call.
1406
+ */
1407
+ explanation: string = 'The callee does not wish to participate in the call.';
1408
+ /**
1409
+ * Decline
1410
+ */
1411
+ name: string = 'Decline';
1412
+ /**
1413
+ * Not applicable.
1414
+ */
1415
+ solutions: string[] = [];
1416
+
1417
+ constructor(message: string) {
1418
+ super(message, 31603);
1419
+ Object.setPrototypeOf(this, SIPServerErrors.Decline.prototype);
1420
+
1421
+ const msg: string = typeof message === 'string'
1422
+ ? message
1423
+ : this.explanation;
1424
+
1425
+ this.message = `${this.name} (${this.code}): ${msg}`;
1426
+ }
1427
+ }
1428
+
1429
+ /**
1430
+ * @public
1431
+ * SIPServerErrors.DoesNotExistAnywhere error.
1432
+ * Error code `31604`.
1433
+ */
1434
+ export class DoesNotExistAnywhere extends TwilioError {
1435
+ /**
1436
+ * Not applicable.
1437
+ */
1438
+ causes: string[] = [];
1439
+ /**
1440
+ * Does Not Exist Anywhere (SIP)
1441
+ */
1442
+ description: string = 'Does Not Exist Anywhere (SIP)';
1443
+ /**
1444
+ * The requested callee does not exist anywhere.
1445
+ */
1446
+ explanation: string = 'The requested callee does not exist anywhere.';
1447
+ /**
1448
+ * DoesNotExistAnywhere
1449
+ */
1450
+ name: string = 'DoesNotExistAnywhere';
1451
+ /**
1452
+ * Not applicable.
1453
+ */
1454
+ solutions: string[] = [];
1455
+
1456
+ constructor(message: string) {
1457
+ super(message, 31604);
1458
+ Object.setPrototypeOf(this, SIPServerErrors.DoesNotExistAnywhere.prototype);
1459
+
1460
+ const msg: string = typeof message === 'string'
1461
+ ? message
1462
+ : this.explanation;
1463
+
1464
+ this.message = `${this.name} (${this.code}): ${msg}`;
1465
+ }
1466
+ }
1467
+ }
1468
+
1469
+ /**
1470
+ * @public
1471
+ * TwiML errors.
1472
+ */
1473
+ export namespace TwiMLErrors {
1474
+ /**
1475
+ * @public
1476
+ * TwiMLErrors.InvalidApplicationSid error.
1477
+ * Error code `21218`.
1478
+ */
1479
+ export class InvalidApplicationSid extends TwilioError {
1480
+ /**
1481
+ * Not applicable.
1482
+ */
1483
+ causes: string[] = [];
1484
+ /**
1485
+ * Invalid ApplicationSid
1486
+ */
1487
+ description: string = 'Invalid ApplicationSid';
1488
+ /**
1489
+ * You attempted to initiate an outbound phone call with an invalid ApplicationSid. The application may not exist anymore or may not be available within your account
1490
+ */
1491
+ explanation: string = 'You attempted to initiate an outbound phone call with an invalid ApplicationSid. The application may not exist anymore or may not be available within your account';
1492
+ /**
1493
+ * InvalidApplicationSid
1494
+ */
1495
+ name: string = 'InvalidApplicationSid';
1496
+ /**
1497
+ * Not applicable.
1498
+ */
1499
+ solutions: string[] = [];
1500
+
1501
+ constructor(message: string) {
1502
+ super(message, 21218);
1503
+ Object.setPrototypeOf(this, TwiMLErrors.InvalidApplicationSid.prototype);
1504
+
1505
+ const msg: string = typeof message === 'string'
1506
+ ? message
1507
+ : this.explanation;
1508
+
1509
+ this.message = `${this.name} (${this.code}): ${msg}`;
1510
+ }
1511
+ }
1512
+ }
1513
+
1514
+ /**
1515
+ * @public
1516
+ * General errors.
1517
+ */
1518
+ export namespace GeneralErrors {
1519
+ /**
1520
+ * @public
1521
+ * GeneralErrors.ConnectionError error.
1522
+ * Error code `31005`.
1523
+ */
1524
+ export class ConnectionError extends TwilioError {
1525
+ /**
1526
+ * Not applicable.
1527
+ */
1528
+ causes: string[] = [];
1529
+ /**
1530
+ * Connection error
1531
+ */
1532
+ description: string = 'Connection error';
1533
+ /**
1534
+ * A connection error occurred during the call
1535
+ */
1536
+ explanation: string = 'A connection error occurred during the call';
1537
+ /**
1538
+ * ConnectionError
1539
+ */
1540
+ name: string = 'ConnectionError';
1541
+ /**
1542
+ * Not applicable.
1543
+ */
1544
+ solutions: string[] = [];
1545
+
1546
+ constructor(message: string) {
1547
+ super(message, 31005);
1548
+ Object.setPrototypeOf(this, GeneralErrors.ConnectionError.prototype);
1549
+
1550
+ const msg: string = typeof message === 'string'
1551
+ ? message
1552
+ : this.explanation;
1553
+
1554
+ this.message = `${this.name} (${this.code}): ${msg}`;
1555
+ }
1556
+ }
1557
+
1558
+ /**
1559
+ * @public
1560
+ * GeneralErrors.CallCancelledError error.
1561
+ * Error code `31008`.
1562
+ */
1563
+ export class CallCancelledError extends TwilioError {
1564
+ /**
1565
+ * The incoming call was cancelled because it was not answered in time or it was accepted/rejected by another application instance registered with the same identity.
1566
+ */
1567
+ causes: string[] = [
1568
+ 'The incoming call was cancelled because it was not answered in time or it was accepted/rejected by another application instance registered with the same identity.',
1569
+ ];
1570
+ /**
1571
+ * Call cancelled
1572
+ */
1573
+ description: string = 'Call cancelled';
1574
+ /**
1575
+ * Unable to answer because the call has ended
1576
+ */
1577
+ explanation: string = 'Unable to answer because the call has ended';
1578
+ /**
1579
+ * CallCancelledError
1580
+ */
1581
+ name: string = 'CallCancelledError';
1582
+ /**
1583
+ * Not applicable.
1584
+ */
1585
+ solutions: string[] = [];
1586
+
1587
+ constructor(message: string) {
1588
+ super(message, 31008);
1589
+ Object.setPrototypeOf(this, GeneralErrors.CallCancelledError.prototype);
1590
+
1591
+ const msg: string = typeof message === 'string'
1592
+ ? message
1593
+ : this.explanation;
1594
+
1595
+ this.message = `${this.name} (${this.code}): ${msg}`;
1596
+ }
1597
+ }
1598
+
1599
+ /**
1600
+ * @public
1601
+ * GeneralErrors.TransportError error.
1602
+ * Error code `31009`.
1603
+ */
1604
+ export class TransportError extends TwilioError {
1605
+ /**
1606
+ * Not applicable.
1607
+ */
1608
+ causes: string[] = [];
1609
+ /**
1610
+ * Transport error
1611
+ */
1612
+ description: string = 'Transport error';
1613
+ /**
1614
+ * No transport available to send or receive messages
1615
+ */
1616
+ explanation: string = 'No transport available to send or receive messages';
1617
+ /**
1618
+ * TransportError
1619
+ */
1620
+ name: string = 'TransportError';
1621
+ /**
1622
+ * Not applicable.
1623
+ */
1624
+ solutions: string[] = [];
1625
+
1626
+ constructor(message: string) {
1627
+ super(message, 31009);
1628
+ Object.setPrototypeOf(this, GeneralErrors.TransportError.prototype);
1629
+
1630
+ const msg: string = typeof message === 'string'
1631
+ ? message
1632
+ : this.explanation;
1633
+
1634
+ this.message = `${this.name} (${this.code}): ${msg}`;
1635
+ }
1636
+ }
1637
+ }
1638
+
1639
+ /**
1640
+ * @public
1641
+ * MalformedRequest errors.
1642
+ */
1643
+ export namespace MalformedRequestErrors {
1644
+ /**
1645
+ * @public
1646
+ * MalformedRequestErrors.MalformedRequestError error.
1647
+ * Error code `31100`.
1648
+ */
1649
+ export class MalformedRequestError extends TwilioError {
1650
+ /**
1651
+ * Invalid content or MessageType passed to sendMessage method.
1652
+ */
1653
+ causes: string[] = [
1654
+ 'Invalid content or MessageType passed to sendMessage method.',
1655
+ ];
1656
+ /**
1657
+ * The request had malformed syntax.
1658
+ */
1659
+ description: string = 'The request had malformed syntax.';
1660
+ /**
1661
+ * The request could not be understood due to malformed syntax.
1662
+ */
1663
+ explanation: string = 'The request could not be understood due to malformed syntax.';
1664
+ /**
1665
+ * MalformedRequestError
1666
+ */
1667
+ name: string = 'MalformedRequestError';
1668
+ /**
1669
+ * Ensure content and MessageType passed to sendMessage method are valid.
1670
+ */
1671
+ solutions: string[] = [
1672
+ 'Ensure content and MessageType passed to sendMessage method are valid.',
1673
+ ];
1674
+
1675
+ constructor(message: string) {
1676
+ super(message, 31100);
1677
+ Object.setPrototypeOf(this, MalformedRequestErrors.MalformedRequestError.prototype);
1678
+
1679
+ const msg: string = typeof message === 'string'
1680
+ ? message
1681
+ : this.explanation;
1682
+
1683
+ this.message = `${this.name} (${this.code}): ${msg}`;
1684
+ }
1685
+ }
1686
+ }
1687
+
1688
+ /**
1689
+ * @public
1690
+ * Registration errors.
1691
+ */
1692
+ export namespace RegistrationErrors {
1693
+ /**
1694
+ * @public
1695
+ * RegistrationErrors.RegistrationError error.
1696
+ * Error code `31301`.
1697
+ */
1698
+ export class RegistrationError extends TwilioError {
1699
+ /**
1700
+ * Not applicable.
1701
+ */
1702
+ causes: string[] = [];
1703
+ /**
1704
+ * Registration error
1705
+ */
1706
+ description: string = 'Registration error';
1707
+ /**
1708
+ *
1709
+ */
1710
+ explanation: string = '';
1711
+ /**
1712
+ * RegistrationError
1713
+ */
1714
+ name: string = 'RegistrationError';
1715
+ /**
1716
+ * Not applicable.
1717
+ */
1718
+ solutions: string[] = [];
1719
+
1720
+ constructor(message: string) {
1721
+ super(message, 31301);
1722
+ Object.setPrototypeOf(this, RegistrationErrors.RegistrationError.prototype);
1723
+
1724
+ const msg: string = typeof message === 'string'
1725
+ ? message
1726
+ : this.explanation;
1727
+
1728
+ this.message = `${this.name} (${this.code}): ${msg}`;
1729
+ }
1730
+ }
1731
+
1732
+ /**
1733
+ * @public
1734
+ * RegistrationErrors.UnsupportedCancelMessageError error.
1735
+ * Error code `31302`.
1736
+ */
1737
+ export class UnsupportedCancelMessageError extends TwilioError {
1738
+ /**
1739
+ * The identity associated with the Twilio Voice SDK is still registered to receive cancel push notification messages.
1740
+ */
1741
+ causes: string[] = [
1742
+ 'The identity associated with the Twilio Voice SDK is still registered to receive cancel push notification messages.',
1743
+ ];
1744
+ /**
1745
+ * Unsupported Cancel Message Error
1746
+ */
1747
+ description: string = 'Unsupported Cancel Message Error';
1748
+ /**
1749
+ * This version of the SDK no longer supports processing cancel push notification messages. You must register via Voice.register(...) on Android or [TwilioVoice registerWithAccessToken:deviceToken:completion:] on iOS with this version of the SDK to stop receiving cancel push notification messages. Cancellations are now handled internally and reported to you on behalf of the SDK.
1750
+ */
1751
+ explanation: string = 'This version of the SDK no longer supports processing cancel push notification messages. You must register via Voice.register(...) on Android or [TwilioVoice registerWithAccessToken:deviceToken:completion:] on iOS with this version of the SDK to stop receiving cancel push notification messages. Cancellations are now handled internally and reported to you on behalf of the SDK.';
1752
+ /**
1753
+ * UnsupportedCancelMessageError
1754
+ */
1755
+ name: string = 'UnsupportedCancelMessageError';
1756
+ /**
1757
+ * The application must register via Voice.register(...) on Android or [TwilioVoice registerWithAccessToken:deviceToken:completion:] on iOS to stop receiving cancel push notification messages.
1758
+ */
1759
+ solutions: string[] = [
1760
+ 'The application must register via Voice.register(...) on Android or [TwilioVoice registerWithAccessToken:deviceToken:completion:] on iOS to stop receiving cancel push notification messages.',
1761
+ ];
1762
+
1763
+ constructor(message: string) {
1764
+ super(message, 31302);
1765
+ Object.setPrototypeOf(this, RegistrationErrors.UnsupportedCancelMessageError.prototype);
1766
+
1767
+ const msg: string = typeof message === 'string'
1768
+ ? message
1769
+ : this.explanation;
1770
+
1771
+ this.message = `${this.name} (${this.code}): ${msg}`;
1772
+ }
1773
+ }
1774
+ }
1775
+
1776
+ /**
1777
+ * @public
1778
+ * UserMedia errors.
1779
+ */
1780
+ export namespace UserMediaErrors {
1781
+ /**
1782
+ * @public
1783
+ * UserMediaErrors.PermissionDeniedError error.
1784
+ * Error code `31401`.
1785
+ */
1786
+ export class PermissionDeniedError extends TwilioError {
1787
+ /**
1788
+ * The user denied the getUserMedia request.
1789
+ * The browser denied the getUserMedia request.
1790
+ * The application has not been configured with the proper permissions.
1791
+ */
1792
+ causes: string[] = [
1793
+ 'The user denied the getUserMedia request.',
1794
+ 'The browser denied the getUserMedia request.',
1795
+ 'The application has not been configured with the proper permissions.',
1796
+ ];
1797
+ /**
1798
+ * UserMedia Permission Denied Error
1799
+ */
1800
+ description: string = 'UserMedia Permission Denied Error';
1801
+ /**
1802
+ * The browser or end-user denied permissions to user media. Therefore we were unable to acquire input audio.
1803
+ */
1804
+ explanation: string = 'The browser or end-user denied permissions to user media. Therefore we were unable to acquire input audio.';
1805
+ /**
1806
+ * PermissionDeniedError
1807
+ */
1808
+ name: string = 'PermissionDeniedError';
1809
+ /**
1810
+ * The user should accept the request next time prompted. If the browser saved the deny, the user should change that permission in their browser.
1811
+ * The user should to verify that the browser has permission to access the microphone at this address.
1812
+ * The user should ensure that the proper permissions have been granted in the mobile device OS.
1813
+ */
1814
+ solutions: string[] = [
1815
+ 'The user should accept the request next time prompted. If the browser saved the deny, the user should change that permission in their browser.',
1816
+ 'The user should to verify that the browser has permission to access the microphone at this address.',
1817
+ 'The user should ensure that the proper permissions have been granted in the mobile device OS.',
1818
+ ];
1819
+
1820
+ constructor(message: string) {
1821
+ super(message, 31401);
1822
+ Object.setPrototypeOf(this, UserMediaErrors.PermissionDeniedError.prototype);
1823
+
1824
+ const msg: string = typeof message === 'string'
1825
+ ? message
1826
+ : this.explanation;
1827
+
1828
+ this.message = `${this.name} (${this.code}): ${msg}`;
1829
+ }
1830
+ }
1831
+ }
1832
+
1833
+ /**
1834
+ * @public
1835
+ * Signaling errors.
1836
+ */
1837
+ export namespace SignalingErrors {
1838
+ /**
1839
+ * @public
1840
+ * SignalingErrors.ConnectionDisconnected error.
1841
+ * Error code `53001`.
1842
+ */
1843
+ export class ConnectionDisconnected extends TwilioError {
1844
+ /**
1845
+ * The device running your application lost its Internet connection.
1846
+ */
1847
+ causes: string[] = [
1848
+ 'The device running your application lost its Internet connection.',
1849
+ ];
1850
+ /**
1851
+ * Signaling connection disconnected
1852
+ */
1853
+ description: string = 'Signaling connection disconnected';
1854
+ /**
1855
+ * Raised whenever the signaling connection is unexpectedly disconnected.
1856
+ */
1857
+ explanation: string = 'Raised whenever the signaling connection is unexpectedly disconnected.';
1858
+ /**
1859
+ * ConnectionDisconnected
1860
+ */
1861
+ name: string = 'ConnectionDisconnected';
1862
+ /**
1863
+ * Ensure the device running your application has access to a stable Internet connection.
1864
+ */
1865
+ solutions: string[] = [
1866
+ 'Ensure the device running your application has access to a stable Internet connection.',
1867
+ ];
1868
+
1869
+ constructor(message: string) {
1870
+ super(message, 53001);
1871
+ Object.setPrototypeOf(this, SignalingErrors.ConnectionDisconnected.prototype);
1872
+
1873
+ const msg: string = typeof message === 'string'
1874
+ ? message
1875
+ : this.explanation;
1876
+
1877
+ this.message = `${this.name} (${this.code}): ${msg}`;
1878
+ }
1879
+ }
1880
+ }
1881
+
1882
+ /**
1883
+ * @public
1884
+ * Media errors.
1885
+ */
1886
+ export namespace MediaErrors {
1887
+ /**
1888
+ * @public
1889
+ * MediaErrors.ClientLocalDescFailed error.
1890
+ * Error code `53400`.
1891
+ */
1892
+ export class ClientLocalDescFailed extends TwilioError {
1893
+ /**
1894
+ * The Client may not be using a supported WebRTC implementation.
1895
+ * The Client may not have the necessary resources to create or apply a new media description.
1896
+ */
1897
+ causes: string[] = [
1898
+ 'The Client may not be using a supported WebRTC implementation.',
1899
+ 'The Client may not have the necessary resources to create or apply a new media description.',
1900
+ ];
1901
+ /**
1902
+ * Client is unable to create or apply a local media description
1903
+ */
1904
+ description: string = 'Client is unable to create or apply a local media description';
1905
+ /**
1906
+ * Raised whenever a Client is unable to create or apply a local media description.
1907
+ */
1908
+ explanation: string = 'Raised whenever a Client is unable to create or apply a local media description.';
1909
+ /**
1910
+ * ClientLocalDescFailed
1911
+ */
1912
+ name: string = 'ClientLocalDescFailed';
1913
+ /**
1914
+ * If you are experiencing this error using the JavaScript SDK, ensure you are running it with a supported WebRTC implementation.
1915
+ */
1916
+ solutions: string[] = [
1917
+ 'If you are experiencing this error using the JavaScript SDK, ensure you are running it with a supported WebRTC implementation.',
1918
+ ];
1919
+
1920
+ constructor(message: string) {
1921
+ super(message, 53400);
1922
+ Object.setPrototypeOf(this, MediaErrors.ClientLocalDescFailed.prototype);
1923
+
1924
+ const msg: string = typeof message === 'string'
1925
+ ? message
1926
+ : this.explanation;
1927
+
1928
+ this.message = `${this.name} (${this.code}): ${msg}`;
1929
+ }
1930
+ }
1931
+
1932
+ /**
1933
+ * @public
1934
+ * MediaErrors.ServerLocalDescFailed error.
1935
+ * Error code `53401`.
1936
+ */
1937
+ export class ServerLocalDescFailed extends TwilioError {
1938
+ /**
1939
+ * A server-side error has occurred.
1940
+ */
1941
+ causes: string[] = [
1942
+ 'A server-side error has occurred.',
1943
+ ];
1944
+ /**
1945
+ * Server is unable to create or apply a local media description
1946
+ */
1947
+ description: string = 'Server is unable to create or apply a local media description';
1948
+ /**
1949
+ * Raised whenever the Server is unable to create or apply a local media description.
1950
+ */
1951
+ explanation: string = 'Raised whenever the Server is unable to create or apply a local media description.';
1952
+ /**
1953
+ * ServerLocalDescFailed
1954
+ */
1955
+ name: string = 'ServerLocalDescFailed';
1956
+ /**
1957
+ * If the problem persists, try connecting to another region.
1958
+ */
1959
+ solutions: string[] = [
1960
+ 'If the problem persists, try connecting to another region.',
1961
+ ];
1962
+
1963
+ constructor(message: string) {
1964
+ super(message, 53401);
1965
+ Object.setPrototypeOf(this, MediaErrors.ServerLocalDescFailed.prototype);
1966
+
1967
+ const msg: string = typeof message === 'string'
1968
+ ? message
1969
+ : this.explanation;
1970
+
1971
+ this.message = `${this.name} (${this.code}): ${msg}`;
1972
+ }
1973
+ }
1974
+
1975
+ /**
1976
+ * @public
1977
+ * MediaErrors.ClientRemoteDescFailed error.
1978
+ * Error code `53402`.
1979
+ */
1980
+ export class ClientRemoteDescFailed extends TwilioError {
1981
+ /**
1982
+ * The Client may not be using a supported WebRTC implementation.
1983
+ * The Client may be connecting peer-to-peer with another Participant that is not using a supported WebRTC implementation.
1984
+ * The Client may not have the necessary resources to apply a new media description.
1985
+ */
1986
+ causes: string[] = [
1987
+ 'The Client may not be using a supported WebRTC implementation.',
1988
+ 'The Client may be connecting peer-to-peer with another Participant that is not using a supported WebRTC implementation.',
1989
+ 'The Client may not have the necessary resources to apply a new media description.',
1990
+ ];
1991
+ /**
1992
+ * Client is unable to apply a remote media description
1993
+ */
1994
+ description: string = 'Client is unable to apply a remote media description';
1995
+ /**
1996
+ * Raised whenever the Client receives a remote media description but is unable to apply it.
1997
+ */
1998
+ explanation: string = 'Raised whenever the Client receives a remote media description but is unable to apply it.';
1999
+ /**
2000
+ * ClientRemoteDescFailed
2001
+ */
2002
+ name: string = 'ClientRemoteDescFailed';
2003
+ /**
2004
+ * If you are experiencing this error using the JavaScript SDK, ensure you are running it with a supported WebRTC implementation.
2005
+ */
2006
+ solutions: string[] = [
2007
+ 'If you are experiencing this error using the JavaScript SDK, ensure you are running it with a supported WebRTC implementation.',
2008
+ ];
2009
+
2010
+ constructor(message: string) {
2011
+ super(message, 53402);
2012
+ Object.setPrototypeOf(this, MediaErrors.ClientRemoteDescFailed.prototype);
2013
+
2014
+ const msg: string = typeof message === 'string'
2015
+ ? message
2016
+ : this.explanation;
2017
+
2018
+ this.message = `${this.name} (${this.code}): ${msg}`;
2019
+ }
2020
+ }
2021
+
2022
+ /**
2023
+ * @public
2024
+ * MediaErrors.ServerRemoteDescFailed error.
2025
+ * Error code `53403`.
2026
+ */
2027
+ export class ServerRemoteDescFailed extends TwilioError {
2028
+ /**
2029
+ * The Client may not be using a supported WebRTC implementation.
2030
+ * The Client may not have the necessary resources to apply a new media description.
2031
+ * A Server-side error may have caused the Server to generate an invalid media description.
2032
+ */
2033
+ causes: string[] = [
2034
+ 'The Client may not be using a supported WebRTC implementation.',
2035
+ 'The Client may not have the necessary resources to apply a new media description.',
2036
+ 'A Server-side error may have caused the Server to generate an invalid media description.',
2037
+ ];
2038
+ /**
2039
+ * Server is unable to apply a remote media description
2040
+ */
2041
+ description: string = 'Server is unable to apply a remote media description';
2042
+ /**
2043
+ * Raised whenever the Server receives a remote media description but is unable to apply it.
2044
+ */
2045
+ explanation: string = 'Raised whenever the Server receives a remote media description but is unable to apply it.';
2046
+ /**
2047
+ * ServerRemoteDescFailed
2048
+ */
2049
+ name: string = 'ServerRemoteDescFailed';
2050
+ /**
2051
+ * If you are experiencing this error using the JavaScript SDK, ensure you are running it with a supported WebRTC implementation.
2052
+ * If the problem persists, try connecting to another region.
2053
+ */
2054
+ solutions: string[] = [
2055
+ 'If you are experiencing this error using the JavaScript SDK, ensure you are running it with a supported WebRTC implementation.',
2056
+ 'If the problem persists, try connecting to another region.',
2057
+ ];
2058
+
2059
+ constructor(message: string) {
2060
+ super(message, 53403);
2061
+ Object.setPrototypeOf(this, MediaErrors.ServerRemoteDescFailed.prototype);
2062
+
2063
+ const msg: string = typeof message === 'string'
2064
+ ? message
2065
+ : this.explanation;
2066
+
2067
+ this.message = `${this.name} (${this.code}): ${msg}`;
2068
+ }
2069
+ }
2070
+
2071
+ /**
2072
+ * @public
2073
+ * MediaErrors.NoSupportedCodec error.
2074
+ * Error code `53404`.
2075
+ */
2076
+ export class NoSupportedCodec extends TwilioError {
2077
+ /**
2078
+ * The C++ SDK was built without the recommended set of codecs.
2079
+ * The JavaScript SDK is running in a browser that does not implement the recommended set of codecs.
2080
+ */
2081
+ causes: string[] = [
2082
+ 'The C++ SDK was built without the recommended set of codecs.',
2083
+ 'The JavaScript SDK is running in a browser that does not implement the recommended set of codecs.',
2084
+ ];
2085
+ /**
2086
+ * No supported codec
2087
+ */
2088
+ description: string = 'No supported codec';
2089
+ /**
2090
+ * Raised whenever the intersection of codecs supported by the Client and the Server (or, in peer-to-peer, the Client and another Participant) is empty.
2091
+ */
2092
+ explanation: string = 'Raised whenever the intersection of codecs supported by the Client and the Server (or, in peer-to-peer, the Client and another Participant) is empty.';
2093
+ /**
2094
+ * NoSupportedCodec
2095
+ */
2096
+ name: string = 'NoSupportedCodec';
2097
+ /**
2098
+ * If you are experiencing this error using the C++ SDK, ensure you build it with the recommended set of codecs.
2099
+ * If you are experiencing this error using the JavaScript SDK, ensure you are using a compatible browser.
2100
+ */
2101
+ solutions: string[] = [
2102
+ 'If you are experiencing this error using the C++ SDK, ensure you build it with the recommended set of codecs.',
2103
+ 'If you are experiencing this error using the JavaScript SDK, ensure you are using a compatible browser.',
2104
+ ];
2105
+
2106
+ constructor(message: string) {
2107
+ super(message, 53404);
2108
+ Object.setPrototypeOf(this, MediaErrors.NoSupportedCodec.prototype);
2109
+
2110
+ const msg: string = typeof message === 'string'
2111
+ ? message
2112
+ : this.explanation;
2113
+
2114
+ this.message = `${this.name} (${this.code}): ${msg}`;
2115
+ }
2116
+ }
2117
+
2118
+ /**
2119
+ * @public
2120
+ * MediaErrors.ConnectionError error.
2121
+ * Error code `53405`.
2122
+ */
2123
+ export class ConnectionError extends TwilioError {
2124
+ /**
2125
+ * The Client was unable to establish a media connection.
2126
+ * A media connection which was active failed liveliness checks.
2127
+ */
2128
+ causes: string[] = [
2129
+ 'The Client was unable to establish a media connection.',
2130
+ 'A media connection which was active failed liveliness checks.',
2131
+ ];
2132
+ /**
2133
+ * Media connection failed
2134
+ */
2135
+ description: string = 'Media connection failed';
2136
+ /**
2137
+ * Raised by the Client or Server whenever a media connection fails.
2138
+ */
2139
+ explanation: string = 'Raised by the Client or Server whenever a media connection fails.';
2140
+ /**
2141
+ * ConnectionError
2142
+ */
2143
+ name: string = 'ConnectionError';
2144
+ /**
2145
+ * If the problem persists, try connecting to another region.
2146
+ * Check your Client's network connectivity.
2147
+ * If you've provided custom ICE Servers then ensure that the URLs and credentials are valid.
2148
+ */
2149
+ solutions: string[] = [
2150
+ 'If the problem persists, try connecting to another region.',
2151
+ 'Check your Client\'s network connectivity.',
2152
+ 'If you\'ve provided custom ICE Servers then ensure that the URLs and credentials are valid.',
2153
+ ];
2154
+
2155
+ constructor(message: string) {
2156
+ super(message, 53405);
2157
+ Object.setPrototypeOf(this, MediaErrors.ConnectionError.prototype);
2158
+
2159
+ const msg: string = typeof message === 'string'
2160
+ ? message
2161
+ : this.explanation;
2162
+
2163
+ this.message = `${this.name} (${this.code}): ${msg}`;
2164
+ }
2165
+ }
2166
+
2167
+ /**
2168
+ * @public
2169
+ * MediaErrors.MediaDtlsTransportFailedError error.
2170
+ * Error code `53407`.
2171
+ */
2172
+ export class MediaDtlsTransportFailedError extends TwilioError {
2173
+ /**
2174
+ * One or both of the DTLS peers have an invalid certificate.
2175
+ * One or both of the DTLS peers have an outdated version of DTLS.
2176
+ * One or both of the DTLS peers lost internet connectivity while performing a DTLS handshake.
2177
+ */
2178
+ causes: string[] = [
2179
+ 'One or both of the DTLS peers have an invalid certificate.',
2180
+ 'One or both of the DTLS peers have an outdated version of DTLS.',
2181
+ 'One or both of the DTLS peers lost internet connectivity while performing a DTLS handshake.',
2182
+ ];
2183
+ /**
2184
+ * The media connection failed due to DTLS handshake failure
2185
+ */
2186
+ description: string = 'The media connection failed due to DTLS handshake failure';
2187
+ /**
2188
+ * There was a problem while negotiating with the remote DTLS peer. Therefore the Client will not be able to establish the media connection.
2189
+ */
2190
+ explanation: string = 'There was a problem while negotiating with the remote DTLS peer. Therefore the Client will not be able to establish the media connection.';
2191
+ /**
2192
+ * MediaDtlsTransportFailedError
2193
+ */
2194
+ name: string = 'MediaDtlsTransportFailedError';
2195
+ /**
2196
+ * Ensure that your certificate is valid.
2197
+ * Ensure that you have a stable internet connection.
2198
+ * Ensure that the browser or the Mobile SDK supports newer versions of DTLS.
2199
+ */
2200
+ solutions: string[] = [
2201
+ 'Ensure that your certificate is valid.',
2202
+ 'Ensure that you have a stable internet connection.',
2203
+ 'Ensure that the browser or the Mobile SDK supports newer versions of DTLS.',
2204
+ ];
2205
+
2206
+ constructor(message: string) {
2207
+ super(message, 53407);
2208
+ Object.setPrototypeOf(this, MediaErrors.MediaDtlsTransportFailedError.prototype);
2209
+
2210
+ const msg: string = typeof message === 'string'
2211
+ ? message
2212
+ : this.explanation;
2213
+
2214
+ this.message = `${this.name} (${this.code}): ${msg}`;
2215
+ }
2216
+ }
2217
+ }
2218
+
2219
+ /**
2220
+ * @internal
2221
+ */
2222
+ export const errorsByCode: ReadonlyMap<number, typeof TwilioError> = new Map([
2223
+ [20101, AuthorizationErrors.AccessTokenInvalid],
2224
+ [20102, AuthorizationErrors.AccessTokenHeaderInvalid],
2225
+ [20103, AuthorizationErrors.AccessTokenIssuerInvalid],
2226
+ [20104, AuthorizationErrors.AccessTokenExpired],
2227
+ [20105, AuthorizationErrors.AccessTokenNotYetValid],
2228
+ [20106, AuthorizationErrors.AccessTokenGrantsInvalid],
2229
+ [20107, AuthorizationErrors.AccessTokenSignatureInvalid],
2230
+ [20151, AuthorizationErrors.AuthenticationFailed],
2231
+ [20157, AuthorizationErrors.ExpirationTimeExceedsMaxTimeAllowed],
2232
+ [20403, ForbiddenErrors.Forbidden],
2233
+ [21218, TwiMLErrors.InvalidApplicationSid],
2234
+ [31005, GeneralErrors.ConnectionError],
2235
+ [31008, GeneralErrors.CallCancelledError],
2236
+ [31009, GeneralErrors.TransportError],
2237
+ [31100, MalformedRequestErrors.MalformedRequestError],
2238
+ [31201, AuthorizationErrors.AuthorizationError],
2239
+ [31206, AuthorizationErrors.RateExceededError],
2240
+ [31210, AuthorizationErrors.CallMessageEventTypeInvalidError],
2241
+ [31211, AuthorizationErrors.CallMessageUnexpectedStateError],
2242
+ [31212, AuthorizationErrors.PayloadSizeExceededError],
2243
+ [31301, RegistrationErrors.RegistrationError],
2244
+ [31302, RegistrationErrors.UnsupportedCancelMessageError],
2245
+ [31400, ClientErrors.BadRequest],
2246
+ [31401, UserMediaErrors.PermissionDeniedError],
2247
+ [31403, ClientErrors.Forbidden],
2248
+ [31404, ClientErrors.NotFound],
2249
+ [31408, ClientErrors.RequestTimeout],
2250
+ [31409, ClientErrors.Conflict],
2251
+ [31426, ClientErrors.UpgradeRequired],
2252
+ [31429, ClientErrors.TooManyRequests],
2253
+ [31480, ClientErrors.TemporarilyUnavailable],
2254
+ [31481, ClientErrors.CallTransactionDoesNotExist],
2255
+ [31484, ClientErrors.AddressIncomplete],
2256
+ [31486, ClientErrors.BusyHere],
2257
+ [31487, ClientErrors.RequestTerminated],
2258
+ [31500, ServerErrors.InternalServerError],
2259
+ [31502, ServerErrors.BadGateway],
2260
+ [31503, ServerErrors.ServiceUnavailable],
2261
+ [31504, ServerErrors.GatewayTimeout],
2262
+ [31530, ServerErrors.DNSResolutionError],
2263
+ [31600, SIPServerErrors.BusyEverywhere],
2264
+ [31603, SIPServerErrors.Decline],
2265
+ [31604, SIPServerErrors.DoesNotExistAnywhere],
2266
+ [51007, AuthorizationErrors.AccessTokenRejected],
2267
+ [53001, SignalingErrors.ConnectionDisconnected],
2268
+ [53400, MediaErrors.ClientLocalDescFailed],
2269
+ [53401, MediaErrors.ServerLocalDescFailed],
2270
+ [53402, MediaErrors.ClientRemoteDescFailed],
2271
+ [53403, MediaErrors.ServerRemoteDescFailed],
2272
+ [53404, MediaErrors.NoSupportedCodec],
2273
+ [53405, MediaErrors.ConnectionError],
2274
+ [53407, MediaErrors.MediaDtlsTransportFailedError],
2275
+ ]);
2276
+
2277
+ Object.freeze(errorsByCode);