@sentdm/sentdm 0.46.0 → 0.48.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 (113) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/client.d.mts +3 -1
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +3 -1
  5. package/client.d.ts.map +1 -1
  6. package/client.js.map +1 -1
  7. package/client.mjs.map +1 -1
  8. package/core/pagination.d.mts +25 -0
  9. package/core/pagination.d.mts.map +1 -1
  10. package/core/pagination.d.ts +25 -0
  11. package/core/pagination.d.ts.map +1 -1
  12. package/core/pagination.js +28 -1
  13. package/core/pagination.js.map +1 -1
  14. package/core/pagination.mjs +26 -0
  15. package/core/pagination.mjs.map +1 -1
  16. package/package.json +1 -1
  17. package/resources/channels/voice.d.mts +68 -19
  18. package/resources/channels/voice.d.mts.map +1 -1
  19. package/resources/channels/voice.d.ts +68 -19
  20. package/resources/channels/voice.d.ts.map +1 -1
  21. package/resources/channels/voice.js +31 -12
  22. package/resources/channels/voice.js.map +1 -1
  23. package/resources/channels/voice.mjs +31 -12
  24. package/resources/channels/voice.mjs.map +1 -1
  25. package/resources/profiles/campaigns.d.mts +3 -2
  26. package/resources/profiles/campaigns.d.mts.map +1 -1
  27. package/resources/profiles/campaigns.d.ts +3 -2
  28. package/resources/profiles/campaigns.d.ts.map +1 -1
  29. package/resources/profiles/campaigns.js +3 -2
  30. package/resources/profiles/campaigns.js.map +1 -1
  31. package/resources/profiles/campaigns.mjs +3 -2
  32. package/resources/profiles/campaigns.mjs.map +1 -1
  33. package/resources/voice/agents.d.mts +524 -0
  34. package/resources/voice/agents.d.mts.map +1 -0
  35. package/resources/voice/agents.d.ts +524 -0
  36. package/resources/voice/agents.d.ts.map +1 -0
  37. package/resources/voice/agents.js +193 -0
  38. package/resources/voice/agents.js.map +1 -0
  39. package/resources/voice/agents.mjs +189 -0
  40. package/resources/voice/agents.mjs.map +1 -0
  41. package/resources/voice/calls/calls.d.mts +87 -15
  42. package/resources/voice/calls/calls.d.mts.map +1 -1
  43. package/resources/voice/calls/calls.d.ts +87 -15
  44. package/resources/voice/calls/calls.d.ts.map +1 -1
  45. package/resources/voice/calls/calls.js +18 -11
  46. package/resources/voice/calls/calls.js.map +1 -1
  47. package/resources/voice/calls/calls.mjs +18 -11
  48. package/resources/voice/calls/calls.mjs.map +1 -1
  49. package/resources/voice/calls/participants.d.mts +2 -0
  50. package/resources/voice/calls/participants.d.mts.map +1 -1
  51. package/resources/voice/calls/participants.d.ts +2 -0
  52. package/resources/voice/calls/participants.d.ts.map +1 -1
  53. package/resources/voice/calls/participants.js +2 -0
  54. package/resources/voice/calls/participants.js.map +1 -1
  55. package/resources/voice/calls/participants.mjs +2 -0
  56. package/resources/voice/calls/participants.mjs.map +1 -1
  57. package/resources/voice/catalogue.d.mts +86 -0
  58. package/resources/voice/catalogue.d.mts.map +1 -0
  59. package/resources/voice/catalogue.d.ts +86 -0
  60. package/resources/voice/catalogue.d.ts.map +1 -0
  61. package/resources/voice/catalogue.js +40 -0
  62. package/resources/voice/catalogue.js.map +1 -0
  63. package/resources/voice/catalogue.mjs +36 -0
  64. package/resources/voice/catalogue.mjs.map +1 -0
  65. package/resources/voice/index.d.mts +2 -0
  66. package/resources/voice/index.d.mts.map +1 -1
  67. package/resources/voice/index.d.ts +2 -0
  68. package/resources/voice/index.d.ts.map +1 -1
  69. package/resources/voice/index.js +5 -1
  70. package/resources/voice/index.js.map +1 -1
  71. package/resources/voice/index.mjs +2 -0
  72. package/resources/voice/index.mjs.map +1 -1
  73. package/resources/voice/tokens.d.mts +2 -0
  74. package/resources/voice/tokens.d.mts.map +1 -1
  75. package/resources/voice/tokens.d.ts +2 -0
  76. package/resources/voice/tokens.d.ts.map +1 -1
  77. package/resources/voice/tokens.js +2 -0
  78. package/resources/voice/tokens.js.map +1 -1
  79. package/resources/voice/tokens.mjs +2 -0
  80. package/resources/voice/tokens.mjs.map +1 -1
  81. package/resources/voice/voice.d.mts +8 -0
  82. package/resources/voice/voice.d.mts.map +1 -1
  83. package/resources/voice/voice.d.ts +8 -0
  84. package/resources/voice/voice.d.ts.map +1 -1
  85. package/resources/voice/voice.js +8 -0
  86. package/resources/voice/voice.js.map +1 -1
  87. package/resources/voice/voice.mjs +8 -0
  88. package/resources/voice/voice.mjs.map +1 -1
  89. package/resources/webhooks.d.mts +151 -29
  90. package/resources/webhooks.d.mts.map +1 -1
  91. package/resources/webhooks.d.ts +151 -29
  92. package/resources/webhooks.d.ts.map +1 -1
  93. package/resources/webhooks.js +51 -11
  94. package/resources/webhooks.js.map +1 -1
  95. package/resources/webhooks.mjs +51 -11
  96. package/resources/webhooks.mjs.map +1 -1
  97. package/src/client.ts +8 -0
  98. package/src/core/pagination.ts +64 -0
  99. package/src/resources/channels/voice.ts +72 -19
  100. package/src/resources/profiles/campaigns.ts +3 -2
  101. package/src/resources/voice/agents.ts +729 -0
  102. package/src/resources/voice/calls/calls.ts +98 -15
  103. package/src/resources/voice/calls/participants.ts +2 -0
  104. package/src/resources/voice/catalogue.ts +118 -0
  105. package/src/resources/voice/index.ts +33 -0
  106. package/src/resources/voice/tokens.ts +2 -0
  107. package/src/resources/voice/voice.ts +74 -0
  108. package/src/resources/webhooks.ts +159 -29
  109. package/src/version.ts +1 -1
  110. package/version.d.mts +1 -1
  111. package/version.d.ts +1 -1
  112. package/version.js +1 -1
  113. package/version.mjs +1 -1
@@ -26,14 +26,18 @@ import { path } from '../../../internal/utils/path';
26
26
  * `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent asks what to do with each call on it, and `POST /v3/voice/tokens` mints a short-lived token that lets a user of your app place and receive calls as that number. When a call arrives or a caller presses a key, a signed question is POSTed to the callback URL and the answer decides the call; `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need before a real call reaches it, and `POST /v3/channels/voice/{number}/rotate-secret` replaces the signing secret. The call events themselves (`call.completed` and the rest) arrive through your webhooks.
27
27
  *
28
28
  * Every call is a record under `/v3/voice/calls`: read it, list its recordings once one is ready, hang it up, start or stop recording, and add, mute or remove conference participants while it is live. A leg to a phone number runs for at most what your balance affords at the destination's rate.
29
+ *
30
+ * **Voice agents.** `POST /v3/voice/agents` creates an agent that answers calls through the Sent Voice Gateway: `session_type` says whether Sent carries the call as text (speech recognised and spoken for the agent) or as audio, `websocket_url` is where the gateway dials the agent for each call (leave it out and the agent dials in with your API key), and `tools`, `transfer_targets`, `fallback` and `limits` say what it may do on a call. The agent's `signing_secret` is shown on create and on `POST /v3/voice/agents/{id}/rotate-secret` only. Voices and languages for text sessions come from `GET /v3/voice/voices`. A number takes calls to an agent once it is bound to it on `/v3/channels/voice`.
29
31
  */
30
32
  export class Calls extends APIResource {
31
33
  participants: ParticipantsAPI.Participants = new ParticipantsAPI.Participants(this._client);
32
34
 
33
35
  /**
34
- * Retrieves one of your calls by id: the parties, the owning number, the current
35
- * status with its failure reason, duration, price, recording availability, and a
36
- * timeline of when the call entered each status.
36
+ * Retrieves one of your calls by id: the parties, the owning number, the phone
37
+ * number the call was connected to and the caller id it showed, the current status
38
+ * with its failure reason, duration, price with the billed legs and what each
39
+ * cost, recording availability, and a timeline of when the call entered each
40
+ * status.
37
41
  *
38
42
  * @example
39
43
  * ```ts
@@ -59,9 +63,12 @@ export class Calls extends APIResource {
59
63
 
60
64
  /**
61
65
  * Retrieves a paginated list of your calls, most recent first. Filter by
62
- * direction, status, the owning number, and the time the call started (from and to
63
- * are inclusive). Use the call webhooks for real-time updates; this list is for
64
- * looking calls up afterwards.
66
+ * direction, status, the owning number, the mode (inapp, or agent for calls your
67
+ * voice agents answered), the agent that answered, and the time the call started
68
+ * (from and to are inclusive). Each call carries the phone number it was connected
69
+ * to, the caller id it showed, and the billed legs with what each cost. Use the
70
+ * call webhooks for real-time updates; this list is for looking calls up
71
+ * afterwards.
65
72
  *
66
73
  * @example
67
74
  * ```ts
@@ -90,8 +97,8 @@ export class Calls extends APIResource {
90
97
  * Ends one of your live calls. The call then ends the way any other call does once
91
98
  * the disconnect is reported: an answered call as COMPLETED with call.completed, a
92
99
  * call still ringing as NO_ANSWER, REJECTED or FAILED with call.failed. A call
93
- * that has already ended answers 409, and so does a call with no phone leg, such
94
- * as one between two app users.
100
+ * that has already ended answers 409, as do a call with no phone leg, such as one
101
+ * between two app users, and a call one of your voice agents answers.
95
102
  *
96
103
  * @example
97
104
  * ```ts
@@ -151,9 +158,9 @@ export class Calls extends APIResource {
151
158
  /**
152
159
  * Starts or stops recording one of your live calls. Use start to begin recording
153
160
  * mid-call, or stop to end a recording, whether it was started here or by a
154
- * connect answer with record set. A call that has already ended answers 409, and
155
- * so does a call with no phone leg, such as one between two app users, which can't
156
- * be recorded.
161
+ * connect answer with record set. A call that has already ended answers 409, as do
162
+ * a call with no phone leg, such as one between two app users, and a call one of
163
+ * your voice agents answers, neither of which can be recorded this way.
157
164
  *
158
165
  * @example
159
166
  * ```ts
@@ -266,12 +273,32 @@ export interface Call {
266
273
  */
267
274
  id?: string;
268
275
 
276
+ /**
277
+ * The voice agent that answered the call, such as
278
+ * agent_9f2ab000-0000-4000-8000-000000000001. Null for an inapp call
279
+ */
280
+ agent_id?: string | null;
281
+
269
282
  /**
270
283
  * When the call was answered (UTC). Null until then, and always null for a call
271
284
  * between two of your app users
272
285
  */
273
286
  answered_at?: string | null;
274
287
 
288
+ /**
289
+ * The caller id shown on the phone leg, in E.164 format: the one your answer
290
+ * chose, or the owning number when it chose none. Null for a call with no phone
291
+ * leg
292
+ */
293
+ caller_id_used?: string | null;
294
+
295
+ /**
296
+ * The phone number the call was connected to, in E.164 format: the number your
297
+ * answer dialed, or the fallback number a call to one of your voice agents
298
+ * reached. Null when the call was not connected to a phone number
299
+ */
300
+ connected_number?: string | null;
301
+
275
302
  /**
276
303
  * outbound for a call placed from your app, inbound for a call to one of your
277
304
  * numbers
@@ -290,9 +317,9 @@ export interface Call {
290
317
 
291
318
  /**
292
319
  * Why the call did not complete: callback_timeout, invalid_answer,
293
- * insufficient_balance, destination_blocked, callback_not_configured, rejected or
294
- * no_answer. Null while the call is live, when it completed, and when it failed
295
- * without a recorded reason
320
+ * insufficient_balance, destination_blocked, callback_not_configured, rejected,
321
+ * no_answer, or for an agent call agent_busy or agent_unreachable. Null while the
322
+ * call is live, when it completed, and when it failed without a recorded reason
296
323
  */
297
324
  failure_reason?: string | null;
298
325
 
@@ -301,9 +328,18 @@ export interface Call {
301
328
  */
302
329
  from?: CallParty;
303
330
 
331
+ /**
332
+ * The legs the price covers, one entry per billed leg, each with its own cost: a
333
+ * call your answer connected to a phone number ran the caller's leg to your number
334
+ * and the leg to the connected number at once, and both are billed. Null until the
335
+ * call has been priced
336
+ */
337
+ legs?: Array<Call.Leg> | null;
338
+
304
339
  /**
305
340
  * The calling mode: inapp for a call between people in your app and phone numbers,
306
- * routed by your number's callback URL
341
+ * routed by your number's callback URL; agent for a call one of your voice agents
342
+ * answered
307
343
  */
308
344
  mode?: string;
309
345
 
@@ -345,6 +381,41 @@ export interface Call {
345
381
  to?: CallParty;
346
382
  }
347
383
 
384
+ export namespace Call {
385
+ /**
386
+ * One leg of a call the price covers
387
+ */
388
+ export interface Leg {
389
+ /**
390
+ * The whole minutes the leg was billed for
391
+ */
392
+ billed_minutes?: number;
393
+
394
+ /**
395
+ * What the leg cost, in the same unit as the call's price
396
+ */
397
+ cost?: number;
398
+
399
+ /**
400
+ * The currency of the cost: USD
401
+ */
402
+ currency?: string;
403
+
404
+ /**
405
+ * inbound for the caller's leg to your number, outbound for a leg placed on your
406
+ * behalf
407
+ */
408
+ direction?: string;
409
+
410
+ /**
411
+ * The phone number the leg reached, in E.164 format: your number for the inbound
412
+ * leg, the number dialed for an outbound one. Null for a leg to one of your app
413
+ * users or a room
414
+ */
415
+ number?: string | null;
416
+ }
417
+ }
418
+
348
419
  /**
349
420
  * One end of a call
350
421
  */
@@ -434,6 +505,12 @@ export interface CallRetrieveParams {
434
505
  }
435
506
 
436
507
  export interface CallListParams extends CallsPageParams {
508
+ /**
509
+ * Query param: Optional filter on the voice agent that answered the call, such as
510
+ * agent_9f2ab000-0000-4000-8000-000000000001
511
+ */
512
+ agent_id?: string | null;
513
+
437
514
  /**
438
515
  * Query param: Optional direction filter: outbound for calls placed from your app,
439
516
  * inbound for calls to one of your numbers
@@ -445,6 +522,12 @@ export interface CallListParams extends CallsPageParams {
445
522
  */
446
523
  from?: string | null;
447
524
 
525
+ /**
526
+ * Query param: Optional mode filter: inapp for calls routed by your number's
527
+ * callback URL, agent for calls one of your voice agents answered
528
+ */
529
+ mode?: string | null;
530
+
448
531
  /**
449
532
  * Query param: Optional filter on the number that owns the call, one of your
450
533
  * voice-enabled numbers in E.164 format
@@ -14,6 +14,8 @@ import { path } from '../../../internal/utils/path';
14
14
  * `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent asks what to do with each call on it, and `POST /v3/voice/tokens` mints a short-lived token that lets a user of your app place and receive calls as that number. When a call arrives or a caller presses a key, a signed question is POSTed to the callback URL and the answer decides the call; `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need before a real call reaches it, and `POST /v3/channels/voice/{number}/rotate-secret` replaces the signing secret. The call events themselves (`call.completed` and the rest) arrive through your webhooks.
15
15
  *
16
16
  * Every call is a record under `/v3/voice/calls`: read it, list its recordings once one is ready, hang it up, start or stop recording, and add, mute or remove conference participants while it is live. A leg to a phone number runs for at most what your balance affords at the destination's rate.
17
+ *
18
+ * **Voice agents.** `POST /v3/voice/agents` creates an agent that answers calls through the Sent Voice Gateway: `session_type` says whether Sent carries the call as text (speech recognised and spoken for the agent) or as audio, `websocket_url` is where the gateway dials the agent for each call (leave it out and the agent dials in with your API key), and `tools`, `transfer_targets`, `fallback` and `limits` say what it may do on a call. The agent's `signing_secret` is shown on create and on `POST /v3/voice/agents/{id}/rotate-secret` only. Voices and languages for text sessions come from `GET /v3/voice/voices`. A number takes calls to an agent once it is bound to it on `/v3/channels/voice`.
17
19
  */
18
20
  export class Participants extends APIResource {
19
21
  /**
@@ -0,0 +1,118 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as WebhooksAPI from '../webhooks';
5
+ import { APIPromise } from '../../core/api-promise';
6
+ import { buildHeaders } from '../../internal/headers';
7
+ import { RequestOptions } from '../../internal/request-options';
8
+
9
+ /**
10
+ * Phone calls from the numbers you hold, driven by your own callback URL.
11
+ *
12
+ * `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent asks what to do with each call on it, and `POST /v3/voice/tokens` mints a short-lived token that lets a user of your app place and receive calls as that number. When a call arrives or a caller presses a key, a signed question is POSTed to the callback URL and the answer decides the call; `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need before a real call reaches it, and `POST /v3/channels/voice/{number}/rotate-secret` replaces the signing secret. The call events themselves (`call.completed` and the rest) arrive through your webhooks.
13
+ *
14
+ * Every call is a record under `/v3/voice/calls`: read it, list its recordings once one is ready, hang it up, start or stop recording, and add, mute or remove conference participants while it is live. A leg to a phone number runs for at most what your balance affords at the destination's rate.
15
+ *
16
+ * **Voice agents.** `POST /v3/voice/agents` creates an agent that answers calls through the Sent Voice Gateway: `session_type` says whether Sent carries the call as text (speech recognised and spoken for the agent) or as audio, `websocket_url` is where the gateway dials the agent for each call (leave it out and the agent dials in with your API key), and `tools`, `transfer_targets`, `fallback` and `limits` say what it may do on a call. The agent's `signing_secret` is shown on create and on `POST /v3/voice/agents/{id}/rotate-secret` only. Voices and languages for text sessions come from `GET /v3/voice/voices`. A number takes calls to an agent once it is bound to it on `/v3/channels/voice`.
17
+ */
18
+ export class Catalogue extends APIResource {
19
+ /**
20
+ * The names a voice agent's `speech.voice` and `speech.language` accept, with the
21
+ * default marked. The list grows as voices are added; a name is never removed
22
+ * without notice.
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * const apiResponseOfVoiceCatalogue =
27
+ * await client.voice.catalogue.list();
28
+ * ```
29
+ */
30
+ list(
31
+ params: CatalogueListParams | null | undefined = {},
32
+ options?: RequestOptions,
33
+ ): APIPromise<APIResponseOfVoiceCatalogue> {
34
+ const { 'x-profile-id': xProfileID } = params ?? {};
35
+ return this._client.get('/v3/voice/voices', {
36
+ ...options,
37
+ headers: buildHeaders([
38
+ { ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
39
+ options?.headers,
40
+ ]),
41
+ });
42
+ }
43
+ }
44
+
45
+ /**
46
+ * Standard API response envelope for all v3 endpoints
47
+ */
48
+ export interface APIResponseOfVoiceCatalogue {
49
+ /**
50
+ * The voices and languages a text-session agent may name in its speech settings:
51
+ * what GET /v3/voice/voices and the admin GET /voice/voices answer, in one shape.
52
+ */
53
+ data?: VoiceCatalogue | null;
54
+
55
+ /**
56
+ * Error information
57
+ */
58
+ error?: WebhooksAPI.ErrorDetail | null;
59
+
60
+ /**
61
+ * Request and response metadata
62
+ */
63
+ meta?: WebhooksAPI.APIMeta;
64
+
65
+ /**
66
+ * Indicates whether the request was successful
67
+ */
68
+ success?: boolean;
69
+ }
70
+
71
+ /**
72
+ * The voices and languages a text-session agent may name in its speech settings:
73
+ * what GET /v3/voice/voices and the admin GET /voice/voices answer, in one shape.
74
+ */
75
+ export interface VoiceCatalogue {
76
+ /**
77
+ * BCP 47 tags accepted as speech.language.
78
+ */
79
+ languages?: Array<string>;
80
+
81
+ voices?: Array<VoiceCatalogueVoice>;
82
+ }
83
+
84
+ export interface VoiceCatalogueVoice {
85
+ /**
86
+ * Whether this is the voice used when an agent names none.
87
+ */
88
+ default?: boolean;
89
+
90
+ description?: string;
91
+
92
+ /**
93
+ * The language the voice speaks.
94
+ */
95
+ language?: string;
96
+
97
+ /**
98
+ * The value to send as speech.voice.
99
+ */
100
+ name?: string;
101
+ }
102
+
103
+ export interface CatalogueListParams {
104
+ /**
105
+ * Profile UUID to scope the request to a child profile. Only organization API keys
106
+ * can use this header. The profile must belong to the calling organization.
107
+ */
108
+ 'x-profile-id'?: string;
109
+ }
110
+
111
+ export declare namespace Catalogue {
112
+ export {
113
+ type APIResponseOfVoiceCatalogue as APIResponseOfVoiceCatalogue,
114
+ type VoiceCatalogue as VoiceCatalogue,
115
+ type VoiceCatalogueVoice as VoiceCatalogueVoice,
116
+ type CatalogueListParams as CatalogueListParams,
117
+ };
118
+ }
@@ -1,5 +1,31 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
+ export {
4
+ Agents,
5
+ type APIResponseOfVoiceAgent,
6
+ type APIResponseOfVoiceAgentSecret,
7
+ type APIResponseOfVoiceAgentsList,
8
+ type VoiceAgent,
9
+ type VoiceAgentAudio,
10
+ type VoiceAgentAudioSpec,
11
+ type VoiceAgentLimits,
12
+ type VoiceAgentLimitsSpec,
13
+ type VoiceAgentParty,
14
+ type VoiceAgentPartySpec,
15
+ type VoiceAgentSecret,
16
+ type VoiceAgentSpeech,
17
+ type VoiceAgentSpeechSpec,
18
+ type VoiceAgentTranscripts,
19
+ type VoiceAgentTranscriptsSpec,
20
+ type VoiceAgentsList,
21
+ type AgentCreateParams,
22
+ type AgentRetrieveParams,
23
+ type AgentUpdateParams,
24
+ type AgentListParams,
25
+ type AgentDeleteParams,
26
+ type AgentRotateSecretParams,
27
+ type VoiceAgentsVoiceAgentsPage,
28
+ } from './agents';
3
29
  export {
4
30
  Calls,
5
31
  type APIResponseOfCall,
@@ -18,5 +44,12 @@ export {
18
44
  type CallRecordParams,
19
45
  type CallsCallsPage,
20
46
  } from './calls/index';
47
+ export {
48
+ Catalogue,
49
+ type APIResponseOfVoiceCatalogue,
50
+ type VoiceCatalogue,
51
+ type VoiceCatalogueVoice,
52
+ type CatalogueListParams,
53
+ } from './catalogue';
21
54
  export { Tokens, type APIResponseOfVoiceToken, type VoiceToken, type TokenCreateParams } from './tokens';
22
55
  export { Voice } from './voice';
@@ -12,6 +12,8 @@ import { RequestOptions } from '../../internal/request-options';
12
12
  * `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent asks what to do with each call on it, and `POST /v3/voice/tokens` mints a short-lived token that lets a user of your app place and receive calls as that number. When a call arrives or a caller presses a key, a signed question is POSTed to the callback URL and the answer decides the call; `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need before a real call reaches it, and `POST /v3/channels/voice/{number}/rotate-secret` replaces the signing secret. The call events themselves (`call.completed` and the rest) arrive through your webhooks.
13
13
  *
14
14
  * Every call is a record under `/v3/voice/calls`: read it, list its recordings once one is ready, hang it up, start or stop recording, and add, mute or remove conference participants while it is live. A leg to a phone number runs for at most what your balance affords at the destination's rate.
15
+ *
16
+ * **Voice agents.** `POST /v3/voice/agents` creates an agent that answers calls through the Sent Voice Gateway: `session_type` says whether Sent carries the call as text (speech recognised and spoken for the agent) or as audio, `websocket_url` is where the gateway dials the agent for each call (leave it out and the agent dials in with your API key), and `tools`, `transfer_targets`, `fallback` and `limits` say what it may do on a call. The agent's `signing_secret` is shown on create and on `POST /v3/voice/agents/{id}/rotate-secret` only. Voices and languages for text sessions come from `GET /v3/voice/voices`. A number takes calls to an agent once it is bound to it on `/v3/channels/voice`.
15
17
  */
16
18
  export class Tokens extends APIResource {
17
19
  /**
@@ -1,6 +1,41 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../../core/resource';
4
+ import * as AgentsAPI from './agents';
5
+ import {
6
+ APIResponseOfVoiceAgent,
7
+ APIResponseOfVoiceAgentSecret,
8
+ APIResponseOfVoiceAgentsList,
9
+ AgentCreateParams,
10
+ AgentDeleteParams,
11
+ AgentListParams,
12
+ AgentRetrieveParams,
13
+ AgentRotateSecretParams,
14
+ AgentUpdateParams,
15
+ Agents,
16
+ VoiceAgent,
17
+ VoiceAgentAudio,
18
+ VoiceAgentAudioSpec,
19
+ VoiceAgentLimits,
20
+ VoiceAgentLimitsSpec,
21
+ VoiceAgentParty,
22
+ VoiceAgentPartySpec,
23
+ VoiceAgentSecret,
24
+ VoiceAgentSpeech,
25
+ VoiceAgentSpeechSpec,
26
+ VoiceAgentTranscripts,
27
+ VoiceAgentTranscriptsSpec,
28
+ VoiceAgentsList,
29
+ VoiceAgentsVoiceAgentsPage,
30
+ } from './agents';
31
+ import * as CatalogueAPI from './catalogue';
32
+ import {
33
+ APIResponseOfVoiceCatalogue,
34
+ Catalogue,
35
+ CatalogueListParams,
36
+ VoiceCatalogue,
37
+ VoiceCatalogueVoice,
38
+ } from './catalogue';
4
39
  import * as TokensAPI from './tokens';
5
40
  import { APIResponseOfVoiceToken, TokenCreateParams, Tokens, VoiceToken } from './tokens';
6
41
  import * as CallsAPI from './calls/calls';
@@ -26,10 +61,14 @@ import {
26
61
  export class Voice extends APIResource {
27
62
  calls: CallsAPI.Calls = new CallsAPI.Calls(this._client);
28
63
  tokens: TokensAPI.Tokens = new TokensAPI.Tokens(this._client);
64
+ agents: AgentsAPI.Agents = new AgentsAPI.Agents(this._client);
65
+ catalogue: CatalogueAPI.Catalogue = new CatalogueAPI.Catalogue(this._client);
29
66
  }
30
67
 
31
68
  Voice.Calls = Calls;
32
69
  Voice.Tokens = Tokens;
70
+ Voice.Agents = Agents;
71
+ Voice.Catalogue = Catalogue;
33
72
 
34
73
  export declare namespace Voice {
35
74
  export {
@@ -57,4 +96,39 @@ export declare namespace Voice {
57
96
  type VoiceToken as VoiceToken,
58
97
  type TokenCreateParams as TokenCreateParams,
59
98
  };
99
+
100
+ export {
101
+ Agents as Agents,
102
+ type APIResponseOfVoiceAgent as APIResponseOfVoiceAgent,
103
+ type APIResponseOfVoiceAgentSecret as APIResponseOfVoiceAgentSecret,
104
+ type APIResponseOfVoiceAgentsList as APIResponseOfVoiceAgentsList,
105
+ type VoiceAgent as VoiceAgent,
106
+ type VoiceAgentAudio as VoiceAgentAudio,
107
+ type VoiceAgentAudioSpec as VoiceAgentAudioSpec,
108
+ type VoiceAgentLimits as VoiceAgentLimits,
109
+ type VoiceAgentLimitsSpec as VoiceAgentLimitsSpec,
110
+ type VoiceAgentParty as VoiceAgentParty,
111
+ type VoiceAgentPartySpec as VoiceAgentPartySpec,
112
+ type VoiceAgentSecret as VoiceAgentSecret,
113
+ type VoiceAgentSpeech as VoiceAgentSpeech,
114
+ type VoiceAgentSpeechSpec as VoiceAgentSpeechSpec,
115
+ type VoiceAgentTranscripts as VoiceAgentTranscripts,
116
+ type VoiceAgentTranscriptsSpec as VoiceAgentTranscriptsSpec,
117
+ type VoiceAgentsList as VoiceAgentsList,
118
+ type VoiceAgentsVoiceAgentsPage as VoiceAgentsVoiceAgentsPage,
119
+ type AgentCreateParams as AgentCreateParams,
120
+ type AgentRetrieveParams as AgentRetrieveParams,
121
+ type AgentUpdateParams as AgentUpdateParams,
122
+ type AgentListParams as AgentListParams,
123
+ type AgentDeleteParams as AgentDeleteParams,
124
+ type AgentRotateSecretParams as AgentRotateSecretParams,
125
+ };
126
+
127
+ export {
128
+ Catalogue as Catalogue,
129
+ type APIResponseOfVoiceCatalogue as APIResponseOfVoiceCatalogue,
130
+ type VoiceCatalogue as VoiceCatalogue,
131
+ type VoiceCatalogueVoice as VoiceCatalogueVoice,
132
+ type CatalogueListParams as CatalogueListParams,
133
+ };
60
134
  }