telnyx 7.18.0 → 7.20.0

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 (128) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +90 -0
  3. package/client.d.mts +3 -6
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +3 -6
  6. package/client.d.ts.map +1 -1
  7. package/client.js +3 -6
  8. package/client.js.map +1 -1
  9. package/client.mjs +3 -6
  10. package/client.mjs.map +1 -1
  11. package/lib/webhooks.d.mts +1 -1
  12. package/lib/webhooks.d.mts.map +1 -1
  13. package/lib/webhooks.d.ts +1 -1
  14. package/lib/webhooks.d.ts.map +1 -1
  15. package/lib/webhooks.js +74 -39
  16. package/lib/webhooks.js.map +1 -1
  17. package/lib/webhooks.mjs +52 -17
  18. package/lib/webhooks.mjs.map +1 -1
  19. package/package.json +3 -5
  20. package/resources/ai/assistants/assistants.d.mts +49 -20
  21. package/resources/ai/assistants/assistants.d.mts.map +1 -1
  22. package/resources/ai/assistants/assistants.d.ts +49 -20
  23. package/resources/ai/assistants/assistants.d.ts.map +1 -1
  24. package/resources/ai/assistants/assistants.js.map +1 -1
  25. package/resources/ai/assistants/assistants.mjs.map +1 -1
  26. package/resources/calls/actions.d.mts +8 -0
  27. package/resources/calls/actions.d.mts.map +1 -1
  28. package/resources/calls/actions.d.ts +8 -0
  29. package/resources/calls/actions.d.ts.map +1 -1
  30. package/resources/calls/calls.d.mts +8 -0
  31. package/resources/calls/calls.d.mts.map +1 -1
  32. package/resources/calls/calls.d.ts +8 -0
  33. package/resources/calls/calls.d.ts.map +1 -1
  34. package/resources/calls/calls.js.map +1 -1
  35. package/resources/calls/calls.mjs.map +1 -1
  36. package/resources/credential-connections/actions.d.mts +9 -9
  37. package/resources/credential-connections/actions.d.mts.map +1 -1
  38. package/resources/credential-connections/actions.d.ts +9 -9
  39. package/resources/credential-connections/actions.d.ts.map +1 -1
  40. package/resources/credential-connections/actions.js +3 -3
  41. package/resources/credential-connections/actions.mjs +3 -3
  42. package/resources/credential-connections/credential-connections.d.mts +2 -2
  43. package/resources/credential-connections/credential-connections.d.ts +2 -2
  44. package/resources/external-requirements/external-requirements.d.mts +10 -0
  45. package/resources/external-requirements/external-requirements.d.mts.map +1 -0
  46. package/resources/external-requirements/external-requirements.d.ts +10 -0
  47. package/resources/external-requirements/external-requirements.d.ts.map +1 -0
  48. package/resources/external-requirements/external-requirements.js +17 -0
  49. package/resources/external-requirements/external-requirements.js.map +1 -0
  50. package/resources/external-requirements/external-requirements.mjs +12 -0
  51. package/resources/external-requirements/external-requirements.mjs.map +1 -0
  52. package/resources/external-requirements/index.d.mts +3 -0
  53. package/resources/external-requirements/index.d.mts.map +1 -0
  54. package/resources/external-requirements/index.d.ts +3 -0
  55. package/resources/external-requirements/index.d.ts.map +1 -0
  56. package/resources/external-requirements/index.js +9 -0
  57. package/resources/external-requirements/index.js.map +1 -0
  58. package/resources/external-requirements/index.mjs +4 -0
  59. package/resources/external-requirements/index.mjs.map +1 -0
  60. package/resources/external-requirements/sub-number-orders.d.mts +151 -0
  61. package/resources/external-requirements/sub-number-orders.d.mts.map +1 -0
  62. package/resources/external-requirements/sub-number-orders.d.ts +151 -0
  63. package/resources/external-requirements/sub-number-orders.d.ts.map +1 -0
  64. package/resources/external-requirements/sub-number-orders.js +61 -0
  65. package/resources/external-requirements/sub-number-orders.js.map +1 -0
  66. package/resources/external-requirements/sub-number-orders.mjs +57 -0
  67. package/resources/external-requirements/sub-number-orders.mjs.map +1 -0
  68. package/resources/external-requirements.d.mts +2 -0
  69. package/resources/external-requirements.d.mts.map +1 -0
  70. package/resources/external-requirements.d.ts +2 -0
  71. package/resources/external-requirements.d.ts.map +1 -0
  72. package/resources/external-requirements.js +6 -0
  73. package/resources/external-requirements.js.map +1 -0
  74. package/resources/external-requirements.mjs +3 -0
  75. package/resources/external-requirements.mjs.map +1 -0
  76. package/resources/index.d.mts +1 -1
  77. package/resources/index.d.mts.map +1 -1
  78. package/resources/index.d.ts +1 -1
  79. package/resources/index.d.ts.map +1 -1
  80. package/resources/index.js +5 -5
  81. package/resources/index.js.map +1 -1
  82. package/resources/index.mjs +1 -1
  83. package/resources/index.mjs.map +1 -1
  84. package/resources/outbound-voice-profiles.d.mts +30 -30
  85. package/resources/outbound-voice-profiles.d.ts +30 -30
  86. package/resources/uac-connections/actions.d.mts +9 -9
  87. package/resources/uac-connections/actions.d.mts.map +1 -1
  88. package/resources/uac-connections/actions.d.ts +9 -9
  89. package/resources/uac-connections/actions.d.ts.map +1 -1
  90. package/resources/uac-connections/actions.js +3 -3
  91. package/resources/uac-connections/actions.mjs +3 -3
  92. package/resources/webhooks.d.mts +1 -1
  93. package/resources/webhooks.d.mts.map +1 -1
  94. package/resources/webhooks.d.ts +1 -1
  95. package/resources/webhooks.d.ts.map +1 -1
  96. package/resources/webhooks.js +4 -11
  97. package/resources/webhooks.js.map +1 -1
  98. package/resources/webhooks.mjs +4 -11
  99. package/resources/webhooks.mjs.map +1 -1
  100. package/src/client.ts +5 -16
  101. package/src/lib/webhooks.ts +59 -18
  102. package/src/resources/ai/assistants/assistants.ts +52 -19
  103. package/src/resources/calls/actions.ts +9 -0
  104. package/src/resources/calls/calls.ts +9 -0
  105. package/src/resources/credential-connections/actions.ts +9 -9
  106. package/src/resources/credential-connections/credential-connections.ts +2 -2
  107. package/src/resources/external-requirements/external-requirements.ts +27 -0
  108. package/src/resources/external-requirements/index.ts +10 -0
  109. package/src/resources/external-requirements/sub-number-orders.ts +202 -0
  110. package/src/resources/external-requirements.ts +3 -0
  111. package/src/resources/index.ts +1 -5
  112. package/src/resources/outbound-voice-profiles.ts +30 -30
  113. package/src/resources/uac-connections/actions.ts +9 -9
  114. package/src/resources/webhooks.ts +5 -11
  115. package/src/version.ts +1 -1
  116. package/version.d.mts +1 -1
  117. package/version.d.ts +1 -1
  118. package/version.js +1 -1
  119. package/version.mjs +1 -1
  120. package/resources/sip-registration-status.d.mts +0 -142
  121. package/resources/sip-registration-status.d.mts.map +0 -1
  122. package/resources/sip-registration-status.d.ts +0 -142
  123. package/resources/sip-registration-status.d.ts.map +0 -1
  124. package/resources/sip-registration-status.js +0 -32
  125. package/resources/sip-registration-status.js.map +0 -1
  126. package/resources/sip-registration-status.mjs +0 -28
  127. package/resources/sip-registration-status.mjs.map +0 -1
  128. package/src/resources/sip-registration-status.ts +0 -181
@@ -1,3 +1,5 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
1
3
  /**
2
4
  * Telnyx webhook verification using native Ed25519.
3
5
  *
@@ -32,7 +34,7 @@ export class TelnyxWebhookVerificationError extends TelnyxError {
32
34
 
33
35
  export interface WebhookUnwrapOptions {
34
36
  headers?: Record<string, string>;
35
- key?: string | Uint8Array;
37
+ key?: string | Uint8Array | undefined;
36
38
  }
37
39
 
38
40
  export function unsafeUnwrapWebhook<T>(body: string): T {
@@ -44,19 +46,51 @@ export async function unwrapWebhook<T>(
44
46
  options: WebhookUnwrapOptions | undefined,
45
47
  clientPublicKey: string | null,
46
48
  ): Promise<T> {
47
- if (options?.headers) {
48
- const key = options.key || clientPublicKey;
49
- if (!key) {
50
- throw new TelnyxWebhookVerificationError('No public key provided for webhook verification');
51
- }
49
+ if (!options?.headers) {
50
+ throw new TelnyxWebhookVerificationError('Webhook headers are required for verification');
51
+ }
52
52
 
53
- const webhook = new TelnyxWebhook(key);
54
- await webhook.verify(body, options.headers);
53
+ const key = options.key || clientPublicKey;
54
+ if (!key) {
55
+ throw new TelnyxWebhookVerificationError('No public key provided for webhook verification');
55
56
  }
56
57
 
58
+ const webhook = new TelnyxWebhook(key);
59
+ await webhook.verify(body, options.headers);
57
60
  return unsafeUnwrapWebhook<T>(body);
58
61
  }
59
62
 
63
+ const BASE64_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
64
+
65
+ /** Decode strict, padded base64 without relying on Node's Buffer global. */
66
+ function decodeBase64(value: string): Uint8Array {
67
+ if (value.length === 0 || value.length % 4 !== 0 || !/^[A-Za-z0-9+/]*={0,2}$/.test(value)) {
68
+ throw new Error('Invalid base64');
69
+ }
70
+
71
+ const padding =
72
+ value.endsWith('==') ? 2
73
+ : value.endsWith('=') ? 1
74
+ : 0;
75
+ const output = new Uint8Array((value.length / 4) * 3 - padding);
76
+ let outputIndex = 0;
77
+
78
+ for (let index = 0; index < value.length; index += 4) {
79
+ const a = BASE64_ALPHABET.indexOf(value[index]!);
80
+ const b = BASE64_ALPHABET.indexOf(value[index + 1]!);
81
+ const c = value[index + 2] === '=' ? 0 : BASE64_ALPHABET.indexOf(value[index + 2]!);
82
+ const d = value[index + 3] === '=' ? 0 : BASE64_ALPHABET.indexOf(value[index + 3]!);
83
+ if (a < 0 || b < 0 || c < 0 || d < 0) throw new Error('Invalid base64');
84
+
85
+ const chunk = (a << 18) | (b << 12) | (c << 6) | d;
86
+ if (outputIndex < output.length) output[outputIndex++] = (chunk >> 16) & 0xff;
87
+ if (outputIndex < output.length) output[outputIndex++] = (chunk >> 8) & 0xff;
88
+ if (outputIndex < output.length) output[outputIndex++] = chunk & 0xff;
89
+ }
90
+
91
+ return output;
92
+ }
93
+
60
94
  // Type for the SubtleCrypto interface we need
61
95
  // Using unknown for key type to avoid CryptoKey dependency
62
96
  interface SubtleCryptoLike {
@@ -97,13 +131,13 @@ export class TelnyxWebhook {
97
131
  if (typeof key === 'string') {
98
132
  try {
99
133
  // Telnyx provides keys in base64 format
100
- const keyBytes = Buffer.from(key, 'base64');
134
+ const keyBytes = decodeBase64(key);
101
135
  if (keyBytes.length !== 32) {
102
136
  throw new TelnyxWebhookVerificationError(
103
137
  `Invalid public key: expected 32 bytes, got ${keyBytes.length} bytes`,
104
138
  );
105
139
  }
106
- this.verifyKey = new Uint8Array(keyBytes);
140
+ this.verifyKey = keyBytes;
107
141
  } catch (exc) {
108
142
  if (exc instanceof TelnyxWebhookVerificationError) {
109
143
  throw exc;
@@ -111,6 +145,11 @@ export class TelnyxWebhook {
111
145
  throw new TelnyxWebhookVerificationError(`Invalid key format: ${key}`);
112
146
  }
113
147
  } else {
148
+ if (key.length !== 32) {
149
+ throw new TelnyxWebhookVerificationError(
150
+ `Invalid public key: expected 32 bytes, got ${key.length} bytes`,
151
+ );
152
+ }
114
153
  this.verifyKey = key;
115
154
  }
116
155
  }
@@ -138,7 +177,13 @@ export class TelnyxWebhook {
138
177
 
139
178
  // Validate timestamp format and prevent replay attacks
140
179
  try {
141
- const webhookTime = parseInt(timestampHeader, 10);
180
+ if (!/^\d+$/.test(timestampHeader)) {
181
+ throw new TelnyxWebhookVerificationError(`Invalid timestamp format: ${timestampHeader}`);
182
+ }
183
+ const webhookTime = Number(timestampHeader);
184
+ if (!Number.isSafeInteger(webhookTime)) {
185
+ throw new TelnyxWebhookVerificationError(`Invalid timestamp format: ${timestampHeader}`);
186
+ }
142
187
  const currentTime = Math.floor(Date.now() / 1000);
143
188
 
144
189
  // Allow 5 minutes tolerance
@@ -155,7 +200,7 @@ export class TelnyxWebhook {
155
200
  // Decode the signature from base64
156
201
  let signature: Uint8Array;
157
202
  try {
158
- const signatureBuffer = Buffer.from(signatureHeader, 'base64');
203
+ const signatureBuffer = decodeBase64(signatureHeader);
159
204
 
160
205
  if (signatureBuffer.length !== 64) {
161
206
  throw new Error(`Invalid signature length: expected 64 bytes, got ${signatureBuffer.length} bytes`);
@@ -166,13 +211,9 @@ export class TelnyxWebhook {
166
211
  throw new TelnyxWebhookVerificationError(`Invalid signature format: ${signatureHeader}`);
167
212
  }
168
213
 
169
- // Create the signed payload: timestamp|payload
214
+ // Create the exact signed payload: timestamp|unmodified payload
170
215
  const encoder = new TextEncoder();
171
- const signedPayload = new Uint8Array([
172
- ...encoder.encode(timestampHeader),
173
- ...encoder.encode('|'),
174
- ...encoder.encode(payload),
175
- ]);
216
+ const signedPayload = encoder.encode(`${timestampHeader}|${payload}`);
176
217
 
177
218
  // Verify the signature using native crypto
178
219
  let isValid: boolean;
@@ -559,6 +559,16 @@ export namespace AssistantTool {
559
559
  */
560
560
  description?: string;
561
561
 
562
+ /**
563
+ * The number the inbound call was received on, forwarded so an unverified
564
+ * non-Telnyx `from` can be used as the caller id -- typically to transfer out as
565
+ * the original caller by pairing `from: "{{telnyx_end_user_target}}"` with
566
+ * `diversion: "{{telnyx_agent_target}}"`. The caller id is only accepted while
567
+ * that number is still on an active inbound call to this `diversion` number, and
568
+ * the `diversion` number must be one you own or have verified.
569
+ */
570
+ diversion?: string;
571
+
562
572
  /**
563
573
  * Configuration for voicemail detection (AMD - Answering Machine Detection) on the
564
574
  * transferred call. Allows the assistant to detect when a voicemail system answers
@@ -2701,17 +2711,19 @@ export interface TranscriptionSettings {
2701
2711
  * supported models will automatically detect the language. For `deepgram/flux`,
2702
2712
  * supported values are: `auto` (Telnyx language detection controls the language
2703
2713
  * hint), `multi` (no language hint), and language-specific hints `en`, `es`, `fr`,
2704
- * `de`, `hi`, `ru`, `pt`, `ja`, `it`, and `nl`. For `soniox/stt-rt-v4`, `auto`
2705
- * omits the language hint and lets Soniox auto-detect; ISO 639-1 codes (e.g. `en`,
2706
- * `es`) bias detection toward that language. For `humain/realtime`, supported
2707
- * values are `ar`, `en`, `codeswitch` (Arabic/English code-switching), and `auto`
2708
- * (resolves server-side to code-switching). Unlike other models, `humain/realtime`
2709
- * does not fall back to `auto` when `language` is omitted — omitting it applies
2710
- * `en` instead. For `reson8/turns`, supported values are `auto` (or unset) for
2711
- * automatic language detection, and the language codes `nl`, `en`, `fr`, `fy`,
2712
- * `de`, `it`, `pl`, `pt`, `es`, and `sv` to fix the transcription language. For
2713
- * `cohere/ar-stt`, supported values are `ar` and `en`; unlike other models, this
2714
- * model does not auto-detect and defaults to `ar` when `language` is omitted.
2714
+ * `de`, `hi`, `ru`, `pt`, `ja`, `it`, and `nl`. For `soniox/stt-rt-v4` and
2715
+ * `soniox/stt-rt-v5`, `auto` omits the language hint and lets Soniox auto-detect;
2716
+ * ISO 639-1 codes (e.g. `en`, `es`) bias detection toward that language;
2717
+ * `settings.language_hints` can pin multiple languages at once instead. For
2718
+ * `humain/realtime`, supported values are `ar`, `en`, `codeswitch` (Arabic/English
2719
+ * code-switching), and `auto` (resolves server-side to code-switching). Unlike
2720
+ * other models, `humain/realtime` does not fall back to `auto` when `language` is
2721
+ * omitted — omitting it applies `en` instead. For `reson8/turns`, supported values
2722
+ * are `auto` (or unset) for automatic language detection, and the language codes
2723
+ * `nl`, `en`, `fr`, `fy`, `de`, `it`, `pl`, `pt`, `es`, and `sv` to fix the
2724
+ * transcription language. For `cohere/ar-stt`, supported values are `ar` and `en`;
2725
+ * unlike other models, this model does not auto-detect and defaults to `ar` when
2726
+ * `language` is omitted.
2715
2727
  */
2716
2728
  language?: string;
2717
2729
 
@@ -2726,8 +2738,9 @@ export interface TranscriptionSettings {
2726
2738
  * - `assemblyai/universal-streaming` is a multilingual streaming model with
2727
2739
  * configurable turn detection.
2728
2740
  * - `xai/grok-stt` is a multilingual Grok STT model.
2729
- * - `soniox/stt-rt-v4` is a multilingual streaming model with automatic language
2730
- * detection and configurable endpointing.
2741
+ * - `soniox/stt-rt-v4` and `soniox/stt-rt-v5` are multilingual streaming models
2742
+ * with automatic language detection, configurable endpointing, term biasing
2743
+ * (`context`), and `language_hints`.
2731
2744
  * - `nvidia/parakeet-v3` is a multilingual transcription model with automatic
2732
2745
  * language detection.
2733
2746
  * - `humain/realtime` is a streaming model with native Arabic and Arabic/English
@@ -2744,6 +2757,7 @@ export interface TranscriptionSettings {
2744
2757
  | 'assemblyai/universal-streaming'
2745
2758
  | 'xai/grok-stt'
2746
2759
  | 'soniox/stt-rt-v4'
2760
+ | 'soniox/stt-rt-v5'
2747
2761
  | 'nvidia/parakeet-v3'
2748
2762
  | 'humain/realtime'
2749
2763
  | 'reson8/turns'
@@ -2761,6 +2775,17 @@ export interface TranscriptionSettings {
2761
2775
  }
2762
2776
 
2763
2777
  export interface TranscriptionSettingsConfig {
2778
+ /**
2779
+ * Available only for soniox/stt-rt-v4 and soniox/stt-rt-v5. A comma-separated list
2780
+ * of terms to boost for recognition during transcription, for staff names,
2781
+ * building names, or other domain-specific vocabulary. This field may be templated
2782
+ * with
2783
+ * [dynamic variables](https://developers.telnyx.com/docs/inference/ai-assistants/dynamic-variables)
2784
+ * using mustache syntax (e.g. `Telnyx,{{customer_name}},VoIP`). Variables are
2785
+ * resolved at call time before the value is sent to Soniox.
2786
+ */
2787
+ context?: string;
2788
+
2764
2789
  /**
2765
2790
  * Available only for deepgram/flux. Confidence threshold for eager end of turn
2766
2791
  * detection. Must be lower than or equal to eot_threshold. Setting this equal to
@@ -2769,8 +2794,9 @@ export interface TranscriptionSettingsConfig {
2769
2794
  eager_eot_threshold?: number;
2770
2795
 
2771
2796
  /**
2772
- * Available only for soniox/stt-rt-v4. When true, Soniox emits end-of-utterance
2773
- * events at the cadence configured by `max_endpoint_delay_ms`.
2797
+ * Available only for soniox/stt-rt-v4 and soniox/stt-rt-v5. When true, Soniox
2798
+ * emits end-of-utterance events at the cadence configured by
2799
+ * `max_endpoint_delay_ms`.
2774
2800
  */
2775
2801
  enable_endpoint_detection?: boolean;
2776
2802
 
@@ -2794,8 +2820,8 @@ export interface TranscriptionSettingsConfig {
2794
2820
  eot_timeout_ms?: number;
2795
2821
 
2796
2822
  /**
2797
- * Available only for soniox/stt-rt-v4. When true, Soniox streams interim
2798
- * (non-final) results in addition to finalized transcripts.
2823
+ * Available only for soniox/stt-rt-v4 and soniox/stt-rt-v5. When true, Soniox
2824
+ * streams interim (non-final) results in addition to finalized transcripts.
2799
2825
  */
2800
2826
  interim_results?: boolean;
2801
2827
 
@@ -2811,8 +2837,15 @@ export interface TranscriptionSettingsConfig {
2811
2837
  keyterm?: string;
2812
2838
 
2813
2839
  /**
2814
- * Available only for soniox/stt-rt-v4. Maximum silence (in milliseconds) before
2815
- * Soniox emits an end-of-utterance event. Only honored when
2840
+ * Available only for soniox/stt-rt-v4 and soniox/stt-rt-v5. A list of ISO 639-1
2841
+ * language codes (e.g. `["nl", "fr"]`) to pin recognition to multiple languages at
2842
+ * once, overriding the single hint derived from `language`.
2843
+ */
2844
+ language_hints?: Array<string>;
2845
+
2846
+ /**
2847
+ * Available only for soniox/stt-rt-v4 and soniox/stt-rt-v5. Maximum silence (in
2848
+ * milliseconds) before Soniox emits an end-of-utterance event. Only honored when
2816
2849
  * `enable_endpoint_detection` is true.
2817
2850
  */
2818
2851
  max_endpoint_delay_ms?: number;
@@ -4791,6 +4791,15 @@ export interface ActionTransferParams {
4791
4791
  */
4792
4792
  custom_headers?: Array<CallsAPI.CustomSipHeader>;
4793
4793
 
4794
+ /**
4795
+ * The number the inbound call being transferred was originally received on, in
4796
+ * +E164 format. Supplying it lets an unverified non-Telnyx `from` be used as the
4797
+ * caller id, provided that number is still on an active inbound call to this
4798
+ * `diversion` number for your account. The `diversion` number itself must be one
4799
+ * you own or have verified.
4800
+ */
4801
+ diversion?: string;
4802
+
4794
4803
  /**
4795
4804
  * If set to false, early media will not be passed to the originating leg.
4796
4805
  */
@@ -1005,6 +1005,15 @@ export interface CallDialParams {
1005
1005
 
1006
1006
  dialogflow_config?: DialogflowConfig;
1007
1007
 
1008
+ /**
1009
+ * The number the inbound call being transferred was originally received on, in
1010
+ * +E164 format. Supplying it lets an unverified non-Telnyx `from` be used as the
1011
+ * caller id, provided that number is still on an active inbound call to this
1012
+ * `diversion` number for your account. The `diversion` number itself must be one
1013
+ * you own or have verified.
1014
+ */
1015
+ diversion?: string;
1016
+
1008
1017
  /**
1009
1018
  * Enables Dialogflow for the current call. The default value is false.
1010
1019
  */
@@ -10,9 +10,9 @@ import { path } from '../../internal/utils/path';
10
10
  */
11
11
  export class Actions extends APIResource {
12
12
  /**
13
- * Checks the registration_status for a credential connection,
14
- * (`registration_status`) as well as the timestamp for the last SIP registration
15
- * event (`registration_status_updated_at`)
13
+ * Returns the live SIP registration status for a credential connection. Reports
14
+ * whether the endpoint is currently registered (`status`) and the timestamp of the
15
+ * last SIP registration event (`last_registration`).
16
16
  *
17
17
  * @example
18
18
  * ```ts
@@ -39,17 +39,17 @@ export namespace ActionCheckRegistrationStatusResponse {
39
39
  /**
40
40
  * The ip used during the SIP connection
41
41
  */
42
- ip_address?: string;
42
+ ip_address?: string | null;
43
43
 
44
44
  /**
45
45
  * ISO 8601 formatted date indicating when the resource was last updated.
46
46
  */
47
- last_registration?: string;
47
+ last_registration?: string | null;
48
48
 
49
49
  /**
50
50
  * The port of the SIP connection
51
51
  */
52
- port?: number;
52
+ port?: number | null;
53
53
 
54
54
  /**
55
55
  * Identifies the type of the resource.
@@ -59,7 +59,7 @@ export namespace ActionCheckRegistrationStatusResponse {
59
59
  /**
60
60
  * The user name of the SIP connection
61
61
  */
62
- sip_username?: string;
62
+ sip_username?: string | null;
63
63
 
64
64
  /**
65
65
  * The current registration status of your SIP connection
@@ -69,12 +69,12 @@ export namespace ActionCheckRegistrationStatusResponse {
69
69
  /**
70
70
  * The protocol of the SIP connection
71
71
  */
72
- transport?: string;
72
+ transport?: string | null;
73
73
 
74
74
  /**
75
75
  * The user agent of the SIP connection
76
76
  */
77
- user_agent?: string;
77
+ user_agent?: string | null;
78
78
  }
79
79
  }
80
80
 
@@ -130,8 +130,8 @@ export type ConnectionNoiseSuppression = 'inbound' | 'outbound' | 'both' | 'disa
130
130
 
131
131
  export interface ConnectionRtcpSettings {
132
132
  /**
133
- * BETA - Enable the capture and storage of RTCP messages to create QoS reports on
134
- * the Telnyx Mission Control Portal.
133
+ * Enable the capture and storage of RTCP messages to create QoS reports on the
134
+ * Telnyx Mission Control Portal.
135
135
  */
136
136
  capture_enabled?: boolean;
137
137
 
@@ -0,0 +1,27 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as SubNumberOrdersAPI from './sub-number-orders';
5
+ import {
6
+ SubNumberOrderRetrieveParams,
7
+ SubNumberOrderRetrieveResponse,
8
+ SubNumberOrderUpdateParams,
9
+ SubNumberOrderUpdateResponse,
10
+ SubNumberOrders,
11
+ } from './sub-number-orders';
12
+
13
+ export class ExternalRequirements extends APIResource {
14
+ subNumberOrders: SubNumberOrdersAPI.SubNumberOrders = new SubNumberOrdersAPI.SubNumberOrders(this._client);
15
+ }
16
+
17
+ ExternalRequirements.SubNumberOrders = SubNumberOrders;
18
+
19
+ export declare namespace ExternalRequirements {
20
+ export {
21
+ SubNumberOrders as SubNumberOrders,
22
+ type SubNumberOrderRetrieveResponse as SubNumberOrderRetrieveResponse,
23
+ type SubNumberOrderUpdateResponse as SubNumberOrderUpdateResponse,
24
+ type SubNumberOrderRetrieveParams as SubNumberOrderRetrieveParams,
25
+ type SubNumberOrderUpdateParams as SubNumberOrderUpdateParams,
26
+ };
27
+ }
@@ -0,0 +1,10 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export { ExternalRequirements } from './external-requirements';
4
+ export {
5
+ SubNumberOrders,
6
+ type SubNumberOrderRetrieveResponse,
7
+ type SubNumberOrderUpdateResponse,
8
+ type SubNumberOrderRetrieveParams,
9
+ type SubNumberOrderUpdateParams,
10
+ } from './sub-number-orders';
@@ -0,0 +1,202 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import { APIPromise } from '../../core/api-promise';
5
+ import { RequestOptions } from '../../internal/request-options';
6
+ import { path } from '../../internal/utils/path';
7
+
8
+ /**
9
+ * Requirement Groups
10
+ */
11
+ export class SubNumberOrders extends APIResource {
12
+ /**
13
+ * Returns the input fields an action requirement needs and the current requirement
14
+ * action for a sub number order. Action requirements are fulfilled by an external
15
+ * step rather than by uploading documents. Australia mobile ID verification is
16
+ * currently the only action requirement. Once a verification link has been
17
+ * generated, it is returned in `requirement_action.value`.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * const subNumberOrder =
22
+ * await client.externalRequirements.subNumberOrders.retrieve(
23
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
24
+ * {
25
+ * regulatory_requirement_id:
26
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
27
+ * },
28
+ * );
29
+ * ```
30
+ */
31
+ retrieve(
32
+ subNumberOrderID: string,
33
+ params: SubNumberOrderRetrieveParams,
34
+ options?: RequestOptions,
35
+ ): APIPromise<SubNumberOrderRetrieveResponse> {
36
+ const { regulatory_requirement_id } = params;
37
+ return this._client.get(
38
+ path`/external_requirements/${regulatory_requirement_id}/sub_number_orders/${subNumberOrderID}`,
39
+ options,
40
+ );
41
+ }
42
+
43
+ /**
44
+ * Submits the end user's details to the external verification provider and returns
45
+ * the requirement action. Australia mobile ID verification is currently the only
46
+ * action requirement. It generates a unique Onfido verification link, returned in
47
+ * `requirement_action.value`, which you share with the end user. The end user's
48
+ * `first_name` and `last_name` must be nested inside a `requirement` object;
49
+ * sending them at the top level is rejected.
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * const subNumberOrder =
54
+ * await client.externalRequirements.subNumberOrders.update(
55
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
56
+ * {
57
+ * regulatory_requirement_id:
58
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
59
+ * requirement: { first_name: 'Jane', last_name: 'Doe' },
60
+ * },
61
+ * );
62
+ * ```
63
+ */
64
+ update(
65
+ subNumberOrderID: string,
66
+ params: SubNumberOrderUpdateParams,
67
+ options?: RequestOptions,
68
+ ): APIPromise<SubNumberOrderUpdateResponse> {
69
+ const { regulatory_requirement_id, ...body } = params;
70
+ return this._client.post(
71
+ path`/external_requirements/${regulatory_requirement_id}/sub_number_orders/${subNumberOrderID}`,
72
+ { body, ...options },
73
+ );
74
+ }
75
+ }
76
+
77
+ export interface SubNumberOrderRetrieveResponse {
78
+ data?: SubNumberOrderRetrieveResponse.Data;
79
+ }
80
+
81
+ export namespace SubNumberOrderRetrieveResponse {
82
+ export interface Data {
83
+ /**
84
+ * The fields the end user must provide to fulfill this requirement.
85
+ */
86
+ fields_required?: Array<Data.FieldsRequired>;
87
+
88
+ regulatory_requirement_id?: string;
89
+
90
+ requirement_action?: Data.RequirementAction;
91
+ }
92
+
93
+ export namespace Data {
94
+ export interface FieldsRequired {
95
+ description?: string;
96
+
97
+ /**
98
+ * The field name to send inside the `requirement` object on the POST.
99
+ */
100
+ name?: string;
101
+
102
+ type?: string;
103
+
104
+ /**
105
+ * The value already stored for this field, or null if not yet provided.
106
+ */
107
+ value?: string | null;
108
+ }
109
+
110
+ export interface RequirementAction {
111
+ /**
112
+ * The type of action the end user must complete.
113
+ */
114
+ type?: string;
115
+
116
+ /**
117
+ * The action value. For ID verification this is the verification link URL, or null
118
+ * until it has been generated.
119
+ */
120
+ value?: string | null;
121
+ }
122
+ }
123
+ }
124
+
125
+ export interface SubNumberOrderUpdateResponse {
126
+ data?: SubNumberOrderUpdateResponse.Data;
127
+ }
128
+
129
+ export namespace SubNumberOrderUpdateResponse {
130
+ export interface Data {
131
+ regulatory_requirement_id?: string;
132
+
133
+ requirement_action?: Data.RequirementAction;
134
+
135
+ sub_order_id?: string;
136
+ }
137
+
138
+ export namespace Data {
139
+ export interface RequirementAction {
140
+ type?: string;
141
+
142
+ /**
143
+ * For Australia mobile ID verification, the unique Onfido verification link to
144
+ * share with the end user.
145
+ */
146
+ value?: string | null;
147
+ }
148
+ }
149
+ }
150
+
151
+ export interface SubNumberOrderRetrieveParams {
152
+ /**
153
+ * The ID of the regulatory (action) requirement. For Australia mobile ID
154
+ * verification this is `b7c72fb8-fa08-4529-aaf6-b9117d3f3698`.
155
+ */
156
+ regulatory_requirement_id: string;
157
+ }
158
+
159
+ export interface SubNumberOrderUpdateParams {
160
+ /**
161
+ * Path param: The ID of the regulatory (action) requirement. For Australia mobile
162
+ * ID verification this is `b7c72fb8-fa08-4529-aaf6-b9117d3f3698`.
163
+ */
164
+ regulatory_requirement_id: string;
165
+
166
+ /**
167
+ * Body param: The end user's identity details for the action requirement.
168
+ * Australia mobile ID verification is currently the only action requirement. It
169
+ * requires `first_name` and `last_name`, the same fields the corresponding GET
170
+ * lists in `fields_required`.
171
+ */
172
+ requirement: SubNumberOrderUpdateParams.Requirement;
173
+ }
174
+
175
+ export namespace SubNumberOrderUpdateParams {
176
+ /**
177
+ * The end user's identity details for the action requirement. Australia mobile ID
178
+ * verification is currently the only action requirement. It requires `first_name`
179
+ * and `last_name`, the same fields the corresponding GET lists in
180
+ * `fields_required`.
181
+ */
182
+ export interface Requirement {
183
+ /**
184
+ * The end user's first name.
185
+ */
186
+ first_name: string;
187
+
188
+ /**
189
+ * The end user's last name.
190
+ */
191
+ last_name: string;
192
+ }
193
+ }
194
+
195
+ export declare namespace SubNumberOrders {
196
+ export {
197
+ type SubNumberOrderRetrieveResponse as SubNumberOrderRetrieveResponse,
198
+ type SubNumberOrderUpdateResponse as SubNumberOrderUpdateResponse,
199
+ type SubNumberOrderRetrieveParams as SubNumberOrderRetrieveParams,
200
+ type SubNumberOrderUpdateParams as SubNumberOrderUpdateParams,
201
+ };
202
+ }
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './external-requirements/index';
@@ -459,6 +459,7 @@ export {
459
459
  type ExternalConnectionUpdateLocationParams,
460
460
  type ExternalConnectionsDefaultFlatPagination,
461
461
  } from './external-connections/external-connections';
462
+ export { ExternalRequirements } from './external-requirements/external-requirements';
462
463
  export {
463
464
  FaxApplications,
464
465
  type FaxApplication,
@@ -1314,11 +1315,6 @@ export {
1314
1315
  type SimCardListWirelessConnectivityLogsParams,
1315
1316
  type SimCardListWirelessConnectivityLogsResponsesDefaultFlatPagination,
1316
1317
  } from './sim-cards/sim-cards';
1317
- export {
1318
- SipRegistrationStatus,
1319
- type SipRegistrationStatusRetrieveResponse,
1320
- type SipRegistrationStatusRetrieveParams,
1321
- } from './sip-registration-status';
1322
1318
  export {
1323
1319
  SiprecConnectors,
1324
1320
  type SiprecConnectorResponse,