telnyx 6.70.0 → 6.72.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 (170) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/client.d.mts +13 -6
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +13 -6
  5. package/client.d.ts.map +1 -1
  6. package/client.js +6 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +6 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/ai/ai.d.mts +1 -1
  12. package/resources/ai/ai.d.mts.map +1 -1
  13. package/resources/ai/ai.d.ts +1 -1
  14. package/resources/ai/ai.d.ts.map +1 -1
  15. package/resources/ai/ai.js +2 -2
  16. package/resources/ai/ai.js.map +1 -1
  17. package/resources/ai/ai.mjs +2 -2
  18. package/resources/ai/ai.mjs.map +1 -1
  19. package/resources/calls/actions.d.mts +260 -247
  20. package/resources/calls/actions.d.mts.map +1 -1
  21. package/resources/calls/actions.d.ts +260 -247
  22. package/resources/calls/actions.d.ts.map +1 -1
  23. package/resources/calls/actions.js.map +1 -1
  24. package/resources/calls/actions.mjs.map +1 -1
  25. package/resources/calls/calls.d.mts +210 -3
  26. package/resources/calls/calls.d.mts.map +1 -1
  27. package/resources/calls/calls.d.ts +210 -3
  28. package/resources/calls/calls.d.ts.map +1 -1
  29. package/resources/calls/calls.js.map +1 -1
  30. package/resources/calls/calls.mjs.map +1 -1
  31. package/resources/calls/index.d.mts +2 -2
  32. package/resources/calls/index.d.mts.map +1 -1
  33. package/resources/calls/index.d.ts +2 -2
  34. package/resources/calls/index.d.ts.map +1 -1
  35. package/resources/calls/index.js.map +1 -1
  36. package/resources/calls/index.mjs.map +1 -1
  37. package/resources/conferences/actions.d.mts +1 -9
  38. package/resources/conferences/actions.d.mts.map +1 -1
  39. package/resources/conferences/actions.d.ts +1 -9
  40. package/resources/conferences/actions.d.ts.map +1 -1
  41. package/resources/index.d.mts +4 -3
  42. package/resources/index.d.mts.map +1 -1
  43. package/resources/index.d.ts +4 -3
  44. package/resources/index.d.ts.map +1 -1
  45. package/resources/index.js +4 -2
  46. package/resources/index.js.map +1 -1
  47. package/resources/index.mjs +1 -0
  48. package/resources/index.mjs.map +1 -1
  49. package/resources/shared.d.mts +6 -0
  50. package/resources/shared.d.mts.map +1 -1
  51. package/resources/shared.d.ts +6 -0
  52. package/resources/shared.d.ts.map +1 -1
  53. package/resources/speech-to-text/index.d.mts +3 -3
  54. package/resources/speech-to-text/index.d.mts.map +1 -1
  55. package/resources/speech-to-text/index.d.ts +3 -3
  56. package/resources/speech-to-text/index.d.ts.map +1 -1
  57. package/resources/speech-to-text/index.js +1 -5
  58. package/resources/speech-to-text/index.js.map +1 -1
  59. package/resources/speech-to-text/index.mjs +0 -2
  60. package/resources/speech-to-text/index.mjs.map +1 -1
  61. package/resources/speech-to-text/internal-base.d.mts +42 -11
  62. package/resources/speech-to-text/internal-base.d.mts.map +1 -1
  63. package/resources/speech-to-text/internal-base.d.ts +42 -11
  64. package/resources/speech-to-text/internal-base.d.ts.map +1 -1
  65. package/resources/speech-to-text/internal-base.js +5 -9
  66. package/resources/speech-to-text/internal-base.js.map +1 -1
  67. package/resources/speech-to-text/internal-base.mjs +5 -9
  68. package/resources/speech-to-text/internal-base.mjs.map +1 -1
  69. package/resources/speech-to-text/speech-to-text.d.mts +79 -100
  70. package/resources/speech-to-text/speech-to-text.d.mts.map +1 -1
  71. package/resources/speech-to-text/speech-to-text.d.ts +79 -100
  72. package/resources/speech-to-text/speech-to-text.d.ts.map +1 -1
  73. package/resources/speech-to-text/speech-to-text.js +16 -19
  74. package/resources/speech-to-text/speech-to-text.js.map +1 -1
  75. package/resources/speech-to-text/speech-to-text.mjs +16 -19
  76. package/resources/speech-to-text/speech-to-text.mjs.map +1 -1
  77. package/resources/speech-to-text/ws-base.d.mts +106 -0
  78. package/resources/speech-to-text/ws-base.d.mts.map +1 -0
  79. package/resources/speech-to-text/ws-base.d.ts +106 -0
  80. package/resources/speech-to-text/ws-base.d.ts.map +1 -0
  81. package/resources/speech-to-text/ws-base.js +476 -0
  82. package/resources/speech-to-text/ws-base.js.map +1 -0
  83. package/resources/speech-to-text/ws-base.mjs +472 -0
  84. package/resources/speech-to-text/ws-base.mjs.map +1 -0
  85. package/resources/speech-to-text/ws.d.mts +9 -28
  86. package/resources/speech-to-text/ws.d.mts.map +1 -1
  87. package/resources/speech-to-text/ws.d.ts +9 -28
  88. package/resources/speech-to-text/ws.d.ts.map +1 -1
  89. package/resources/speech-to-text/ws.js +17 -97
  90. package/resources/speech-to-text/ws.js.map +1 -1
  91. package/resources/speech-to-text/ws.mjs +17 -97
  92. package/resources/speech-to-text/ws.mjs.map +1 -1
  93. package/resources/speech-to-text.d.mts +2 -0
  94. package/resources/speech-to-text.d.mts.map +1 -0
  95. package/resources/speech-to-text.d.ts +2 -0
  96. package/resources/speech-to-text.d.ts.map +1 -0
  97. package/resources/speech-to-text.js +6 -0
  98. package/resources/speech-to-text.js.map +1 -0
  99. package/resources/speech-to-text.mjs +3 -0
  100. package/resources/speech-to-text.mjs.map +1 -0
  101. package/resources/texml/accounts/calls/calls.d.mts +31 -465
  102. package/resources/texml/accounts/calls/calls.d.mts.map +1 -1
  103. package/resources/texml/accounts/calls/calls.d.ts +31 -465
  104. package/resources/texml/accounts/calls/calls.d.ts.map +1 -1
  105. package/resources/texml/accounts/calls/calls.js +7 -1
  106. package/resources/texml/accounts/calls/calls.js.map +1 -1
  107. package/resources/texml/accounts/calls/calls.mjs +7 -1
  108. package/resources/texml/accounts/calls/calls.mjs.map +1 -1
  109. package/resources/text-to-speech/index.d.mts +1 -1
  110. package/resources/text-to-speech/index.d.mts.map +1 -1
  111. package/resources/text-to-speech/index.d.ts +1 -1
  112. package/resources/text-to-speech/index.d.ts.map +1 -1
  113. package/resources/text-to-speech/index.js.map +1 -1
  114. package/resources/text-to-speech/index.mjs.map +1 -1
  115. package/resources/text-to-speech/text-to-speech.d.mts +79 -13
  116. package/resources/text-to-speech/text-to-speech.d.mts.map +1 -1
  117. package/resources/text-to-speech/text-to-speech.d.ts +79 -13
  118. package/resources/text-to-speech/text-to-speech.d.ts.map +1 -1
  119. package/resources/text-to-speech/text-to-speech.js +33 -1
  120. package/resources/text-to-speech/text-to-speech.js.map +1 -1
  121. package/resources/text-to-speech/text-to-speech.mjs +33 -1
  122. package/resources/text-to-speech/text-to-speech.mjs.map +1 -1
  123. package/resources/voice-sdk-call-reports.d.mts +30 -105
  124. package/resources/voice-sdk-call-reports.d.mts.map +1 -1
  125. package/resources/voice-sdk-call-reports.d.ts +30 -105
  126. package/resources/voice-sdk-call-reports.d.ts.map +1 -1
  127. package/resources/voice-sdk-call-reports.js.map +1 -1
  128. package/resources/voice-sdk-call-reports.mjs.map +1 -1
  129. package/resources/whatsapp/index.d.mts +1 -1
  130. package/resources/whatsapp/index.d.mts.map +1 -1
  131. package/resources/whatsapp/index.d.ts +1 -1
  132. package/resources/whatsapp/index.d.ts.map +1 -1
  133. package/resources/whatsapp/index.js.map +1 -1
  134. package/resources/whatsapp/index.mjs.map +1 -1
  135. package/resources/whatsapp/user-data.d.mts +16 -33
  136. package/resources/whatsapp/user-data.d.mts.map +1 -1
  137. package/resources/whatsapp/user-data.d.ts +16 -33
  138. package/resources/whatsapp/user-data.d.ts.map +1 -1
  139. package/resources/whatsapp/whatsapp.d.mts +2 -2
  140. package/resources/whatsapp/whatsapp.d.mts.map +1 -1
  141. package/resources/whatsapp/whatsapp.d.ts +2 -2
  142. package/resources/whatsapp/whatsapp.d.ts.map +1 -1
  143. package/resources/whatsapp/whatsapp.js.map +1 -1
  144. package/resources/whatsapp/whatsapp.mjs.map +1 -1
  145. package/src/client.ts +33 -4
  146. package/src/resources/ai/ai.ts +3 -3
  147. package/src/resources/calls/actions.ts +331 -320
  148. package/src/resources/calls/calls.ts +272 -0
  149. package/src/resources/calls/index.ts +4 -0
  150. package/src/resources/conferences/actions.ts +1 -10
  151. package/src/resources/index.ts +13 -2
  152. package/src/resources/shared.ts +7 -0
  153. package/src/resources/speech-to-text/index.ts +6 -9
  154. package/src/resources/speech-to-text/internal-base.ts +49 -22
  155. package/src/resources/speech-to-text/speech-to-text.ts +102 -128
  156. package/src/resources/speech-to-text/ws-base.ts +619 -0
  157. package/src/resources/speech-to-text/ws.ts +26 -111
  158. package/src/resources/speech-to-text.ts +3 -0
  159. package/src/resources/texml/accounts/calls/calls.ts +36 -564
  160. package/src/resources/text-to-speech/index.ts +3 -2
  161. package/src/resources/text-to-speech/text-to-speech.ts +100 -16
  162. package/src/resources/voice-sdk-call-reports.ts +33 -116
  163. package/src/resources/whatsapp/index.ts +1 -0
  164. package/src/resources/whatsapp/user-data.ts +17 -38
  165. package/src/resources/whatsapp/whatsapp.ts +2 -0
  166. package/src/version.ts +1 -1
  167. package/version.d.mts +1 -1
  168. package/version.d.ts +1 -1
  169. package/version.js +1 -1
  170. package/version.mjs +1 -1
@@ -1,6 +1,7 @@
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 CallsAPI from './calls';
4
5
  import * as Shared from '../shared';
5
6
  import * as ActionsAPI from './actions';
6
7
  import {
@@ -104,6 +105,8 @@ import {
104
105
  TranscriptionEngineBConfig,
105
106
  TranscriptionEngineDeepgramConfig,
106
107
  TranscriptionEngineGoogleConfig,
108
+ TranscriptionEngineSonioxConfig,
109
+ TranscriptionEngineSpeechmaticsConfig,
107
110
  TranscriptionEngineTelnyxConfig,
108
111
  TranscriptionEngineXaiConfig,
109
112
  TranscriptionStartRequest,
@@ -385,6 +388,112 @@ export namespace CallAssistantRequest {
385
388
  }
386
389
  }
387
390
 
391
+ /**
392
+ * Settings for handling caller interruptions during Conversation Relay speech.
393
+ */
394
+ export interface ConversationRelayInterruptionSettings {
395
+ /**
396
+ * Legacy boolean form. `true` is equivalent to `interruptible=any`; `false` is
397
+ * equivalent to `interruptible=none`.
398
+ */
399
+ enable?: boolean;
400
+
401
+ /**
402
+ * Controls when caller input can interrupt assistant speech. `any` allows speech
403
+ * or DTMF interruptions; `none` disables interruptions; `speech` allows speech
404
+ * only; `dtmf` allows DTMF only.
405
+ */
406
+ interruptible?: 'none' | 'any' | 'speech' | 'dtmf';
407
+
408
+ /**
409
+ * Controls when caller input can interrupt assistant speech. `any` allows speech
410
+ * or DTMF interruptions; `none` disables interruptions; `speech` allows speech
411
+ * only; `dtmf` allows DTMF only.
412
+ */
413
+ interruptible_greeting?: 'none' | 'any' | 'speech' | 'dtmf';
414
+
415
+ /**
416
+ * Controls when caller input can interrupt assistant speech. `any` allows speech
417
+ * or DTMF interruptions; `none` disables interruptions; `speech` allows speech
418
+ * only; `dtmf` allows DTMF only.
419
+ */
420
+ welcome_greeting_interruptible?: 'none' | 'any' | 'speech' | 'dtmf';
421
+ }
422
+
423
+ /**
424
+ * Language-specific TTS and transcription settings for Conversation Relay.
425
+ */
426
+ export interface ConversationRelayLanguage {
427
+ /**
428
+ * BCP 47 language tag for this language configuration.
429
+ */
430
+ language: string;
431
+
432
+ /**
433
+ * Conversation Relay speech model. Prefer
434
+ * `transcription_engine_config.transcription_model` when configuring
435
+ * speech-to-text.
436
+ */
437
+ speech_model?: string;
438
+
439
+ /**
440
+ * Engine to use for speech recognition. Legacy values `A` - `Google`, `B` -
441
+ * `Telnyx` are supported for backward compatibility. When provided in a
442
+ * Conversation Relay language entry, Telnyx derives `transcription_provider` and
443
+ * `speech_model` for that language.
444
+ */
445
+ transcription_engine?:
446
+ | 'Google'
447
+ | 'Telnyx'
448
+ | 'Deepgram'
449
+ | 'Azure'
450
+ | 'xAI'
451
+ | 'AssemblyAI'
452
+ | 'Speechmatics'
453
+ | 'Soniox'
454
+ | 'A'
455
+ | 'B';
456
+
457
+ /**
458
+ * Engine-specific transcription settings for Conversation Relay. This accepts the
459
+ * same provider-specific options used by the Call Transcription Start command,
460
+ * such as `transcription_model`, without requiring the engine discriminator to be
461
+ * repeated inside this object.
462
+ */
463
+ transcription_engine_config?: { [key: string]: unknown };
464
+
465
+ /**
466
+ * Conversation Relay transcription provider name. Prefer `transcription_engine`
467
+ * when configuring speech-to-text.
468
+ */
469
+ transcription_provider?: string;
470
+
471
+ /**
472
+ * Text-to-speech provider for this language. If omitted and `voice` is provided,
473
+ * Telnyx derives the provider from the voice identifier.
474
+ */
475
+ tts_provider?: string;
476
+
477
+ /**
478
+ * Voice identifier for this language.
479
+ */
480
+ voice?: string;
481
+
482
+ /**
483
+ * The settings associated with the voice selected
484
+ */
485
+ voice_settings?:
486
+ | ActionsAPI.ElevenLabsVoiceSettings
487
+ | ActionsAPI.TelnyxVoiceSettings
488
+ | ActionsAPI.AwsVoiceSettings
489
+ | Shared.MinimaxVoiceSettings
490
+ | Shared.AzureVoiceSettings
491
+ | Shared.RimeVoiceSettings
492
+ | Shared.ResembleVoiceSettings
493
+ | Shared.InworldVoiceSettings
494
+ | Shared.XaiVoiceSettings;
495
+ }
496
+
388
497
  export interface CustomSipHeader {
389
498
  /**
390
499
  * The name of the header to add.
@@ -701,6 +810,16 @@ export interface CallDialParams {
701
810
  */
702
811
  conference_config?: CallDialParams.ConferenceConfig;
703
812
 
813
+ /**
814
+ * Starts a Conversation Relay session automatically when the answered/dialed call
815
+ * is answered. This embedded shape is supported on `answer` and `dial`. It uses
816
+ * public field names (`url`, `dtmf_detection`, `greeting`, `voice`, `language`,
817
+ * etc.) and maps them to the underlying Conversation Relay action. `client_state`,
818
+ * `tts_language`, and `transcription_language` inside this object are ignored; use
819
+ * the parent command's `client_state` and `command_id` fields instead.
820
+ */
821
+ conversation_relay_config?: CallDialParams.ConversationRelayConfig;
822
+
704
823
  /**
705
824
  * Custom headers to be added to the SIP INVITE.
706
825
  */
@@ -1160,6 +1279,155 @@ export namespace CallDialParams {
1160
1279
  whisper_call_control_ids?: Array<string>;
1161
1280
  }
1162
1281
 
1282
+ /**
1283
+ * Starts a Conversation Relay session automatically when the answered/dialed call
1284
+ * is answered. This embedded shape is supported on `answer` and `dial`. It uses
1285
+ * public field names (`url`, `dtmf_detection`, `greeting`, `voice`, `language`,
1286
+ * etc.) and maps them to the underlying Conversation Relay action. `client_state`,
1287
+ * `tts_language`, and `transcription_language` inside this object are ignored; use
1288
+ * the parent command's `client_state` and `command_id` fields instead.
1289
+ */
1290
+ export interface ConversationRelayConfig {
1291
+ /**
1292
+ * WebSocket URL for your Conversation Relay server. Must start with `ws://` or
1293
+ * `wss://`.
1294
+ */
1295
+ url: string;
1296
+
1297
+ /**
1298
+ * Custom key-value parameters forwarded to the relay session as assistant dynamic
1299
+ * variables.
1300
+ */
1301
+ custom_parameters?: { [key: string]: unknown };
1302
+
1303
+ /**
1304
+ * Enable DTMF detection for the relay session.
1305
+ */
1306
+ dtmf_detection?: boolean;
1307
+
1308
+ /**
1309
+ * Text played when the relay session starts.
1310
+ */
1311
+ greeting?: string;
1312
+
1313
+ /**
1314
+ * Controls when caller input can interrupt assistant speech. `any` allows speech
1315
+ * or DTMF interruptions; `none` disables interruptions; `speech` allows speech
1316
+ * only; `dtmf` allows DTMF only.
1317
+ */
1318
+ interruptible?: 'none' | 'any' | 'speech' | 'dtmf';
1319
+
1320
+ /**
1321
+ * Controls when caller input can interrupt assistant speech. `any` allows speech
1322
+ * or DTMF interruptions; `none` disables interruptions; `speech` allows speech
1323
+ * only; `dtmf` allows DTMF only.
1324
+ */
1325
+ interruptible_greeting?: 'none' | 'any' | 'speech' | 'dtmf';
1326
+
1327
+ /**
1328
+ * Settings for handling caller interruptions during Conversation Relay speech.
1329
+ */
1330
+ interruption_settings?: CallsAPI.ConversationRelayInterruptionSettings;
1331
+
1332
+ /**
1333
+ * Default language for both text-to-speech and speech recognition.
1334
+ */
1335
+ language?: string;
1336
+
1337
+ /**
1338
+ * Per-language TTS and transcription settings.
1339
+ */
1340
+ languages?: Array<CallsAPI.ConversationRelayLanguage>;
1341
+
1342
+ /**
1343
+ * Structured voice provider. Must be supplied together with `structured_provider`.
1344
+ */
1345
+ provider?: string;
1346
+
1347
+ /**
1348
+ * Provider-specific structured voice settings. Must be supplied together with
1349
+ * `provider`; Telnyx sends the value as the nested provider configuration for
1350
+ * Conversation Relay.
1351
+ */
1352
+ structured_provider?: { [key: string]: unknown };
1353
+
1354
+ /**
1355
+ * Engine to use for speech recognition. Legacy values `A` - `Google`, `B` -
1356
+ * `Telnyx` are supported for backward compatibility. For Conversation Relay, use
1357
+ * this field with `transcription_engine_config`; the `transcription` object is not
1358
+ * supported.
1359
+ */
1360
+ transcription_engine?:
1361
+ | 'Google'
1362
+ | 'Telnyx'
1363
+ | 'Deepgram'
1364
+ | 'Azure'
1365
+ | 'xAI'
1366
+ | 'AssemblyAI'
1367
+ | 'Speechmatics'
1368
+ | 'Soniox'
1369
+ | 'A'
1370
+ | 'B';
1371
+
1372
+ /**
1373
+ * Engine-specific transcription settings for Conversation Relay. This accepts the
1374
+ * same provider-specific options used by the Call Transcription Start command,
1375
+ * such as `transcription_model`, without requiring the engine discriminator to be
1376
+ * repeated inside this object.
1377
+ */
1378
+ transcription_engine_config?: { [key: string]: unknown };
1379
+
1380
+ /**
1381
+ * Text-to-speech provider. If omitted, Telnyx derives it from `voice` or
1382
+ * `provider`.
1383
+ */
1384
+ tts_provider?: string;
1385
+
1386
+ /**
1387
+ * The voice to be used by the voice assistant. Currently we support ElevenLabs,
1388
+ * Telnyx and AWS voices.
1389
+ *
1390
+ * **Supported Providers:**
1391
+ *
1392
+ * - **AWS:** Use `AWS.Polly.<VoiceId>` (e.g., `AWS.Polly.Joanna`). For neural
1393
+ * voices, which provide more realistic, human-like speech, append `-Neural` to
1394
+ * the `VoiceId` (e.g., `AWS.Polly.Joanna-Neural`). Check the
1395
+ * [available voices](https://docs.aws.amazon.com/polly/latest/dg/available-voices.html)
1396
+ * for compatibility.
1397
+ * - **Azure:** Use `Azure.<VoiceId>. (e.g. Azure.en-CA-ClaraNeural,
1398
+ * Azure.en-CA-LiamNeural, Azure.en-US-BrianMultilingualNeural,
1399
+ * Azure.en-US-Ava:DragonHDLatestNeural. For a complete list of voices, go to
1400
+ * [Azure Voice Gallery](https://speech.microsoft.com/portal/voicegallery).)
1401
+ * - **ElevenLabs:** Use `ElevenLabs.<ModelId>.<VoiceId>` (e.g.,
1402
+ * `ElevenLabs.BaseModel.John`). The `ModelId` part is optional. To use
1403
+ * ElevenLabs, you must provide your ElevenLabs API key as an integration secret
1404
+ * under `"voice_settings": {"api_key_ref": "<secret_id>"}`. See
1405
+ * [integration secrets documentation](https://developers.telnyx.com/api/secrets-manager/integration-secrets/create-integration-secret)
1406
+ * for details. Check
1407
+ * [available voices](https://elevenlabs.io/docs/api-reference/get-voices).
1408
+ * - **Telnyx:** Use `Telnyx.<model_id>.<voice_id>`
1409
+ * - **Inworld:** Use `Inworld.<ModelId>.<VoiceId>` (e.g., `Inworld.Mini.Loretta`,
1410
+ * `Inworld.Max.Oliver`). Supported models: `Mini`, `Max`.
1411
+ * - **xAI:** Use `xAI.<VoiceId>` (e.g., `xAI.eve`). Available voices: `eve`,
1412
+ * `ara`, `rex`, `sal`, `leo`.
1413
+ */
1414
+ voice?: string;
1415
+
1416
+ /**
1417
+ * The settings associated with the voice selected
1418
+ */
1419
+ voice_settings?:
1420
+ | ActionsAPI.ElevenLabsVoiceSettings
1421
+ | ActionsAPI.TelnyxVoiceSettings
1422
+ | ActionsAPI.AwsVoiceSettings
1423
+ | Shared.MinimaxVoiceSettings
1424
+ | Shared.AzureVoiceSettings
1425
+ | Shared.RimeVoiceSettings
1426
+ | Shared.ResembleVoiceSettings
1427
+ | Shared.InworldVoiceSettings
1428
+ | Shared.XaiVoiceSettings;
1429
+ }
1430
+
1163
1431
  /**
1164
1432
  * Enables deepfake detection on the call. When enabled, audio from the remote
1165
1433
  * party is streamed to a detection service that analyzes whether the voice is
@@ -1198,6 +1466,8 @@ Calls.Actions = Actions;
1198
1466
  export declare namespace Calls {
1199
1467
  export {
1200
1468
  type CallAssistantRequest as CallAssistantRequest,
1469
+ type ConversationRelayInterruptionSettings as ConversationRelayInterruptionSettings,
1470
+ type ConversationRelayLanguage as ConversationRelayLanguage,
1201
1471
  type CustomSipHeader as CustomSipHeader,
1202
1472
  type DialogflowConfig as DialogflowConfig,
1203
1473
  type SipHeader as SipHeader,
@@ -1233,6 +1503,8 @@ export declare namespace Calls {
1233
1503
  type TranscriptionEngineBConfig as TranscriptionEngineBConfig,
1234
1504
  type TranscriptionEngineDeepgramConfig as TranscriptionEngineDeepgramConfig,
1235
1505
  type TranscriptionEngineGoogleConfig as TranscriptionEngineGoogleConfig,
1506
+ type TranscriptionEngineSonioxConfig as TranscriptionEngineSonioxConfig,
1507
+ type TranscriptionEngineSpeechmaticsConfig as TranscriptionEngineSpeechmaticsConfig,
1236
1508
  type TranscriptionEngineTelnyxConfig as TranscriptionEngineTelnyxConfig,
1237
1509
  type TranscriptionEngineXaiConfig as TranscriptionEngineXaiConfig,
1238
1510
  type TranscriptionStartRequest as TranscriptionStartRequest,
@@ -21,6 +21,8 @@ export {
21
21
  type TranscriptionEngineBConfig,
22
22
  type TranscriptionEngineDeepgramConfig,
23
23
  type TranscriptionEngineGoogleConfig,
24
+ type TranscriptionEngineSonioxConfig,
25
+ type TranscriptionEngineSpeechmaticsConfig,
24
26
  type TranscriptionEngineTelnyxConfig,
25
27
  type TranscriptionEngineXaiConfig,
26
28
  type TranscriptionStartRequest,
@@ -108,6 +110,8 @@ export {
108
110
  export {
109
111
  Calls,
110
112
  type CallAssistantRequest,
113
+ type ConversationRelayInterruptionSettings,
114
+ type ConversationRelayLanguage,
111
115
  type CustomSipHeader,
112
116
  type DialogflowConfig,
113
117
  type SipHeader,
@@ -1019,19 +1019,10 @@ export interface ActionSpeakParams {
1019
1019
  | Shared.AzureVoiceSettings
1020
1020
  | Shared.RimeVoiceSettings
1021
1021
  | Shared.ResembleVoiceSettings
1022
- | ActionSpeakParams.InworldVoiceSettings
1022
+ | Shared.InworldVoiceSettings
1023
1023
  | Shared.XaiVoiceSettings;
1024
1024
  }
1025
1025
 
1026
- export namespace ActionSpeakParams {
1027
- export interface InworldVoiceSettings {
1028
- /**
1029
- * Voice settings provider type
1030
- */
1031
- type: 'inworld';
1032
- }
1033
- }
1034
-
1035
1026
  export interface ActionStopParams {
1036
1027
  /**
1037
1028
  * List of call control ids identifying participants the audio file should stop be
@@ -132,6 +132,8 @@ export {
132
132
  export {
133
133
  Calls,
134
134
  type CallAssistantRequest,
135
+ type ConversationRelayInterruptionSettings,
136
+ type ConversationRelayLanguage,
135
137
  type CustomSipHeader,
136
138
  type DialogflowConfig,
137
139
  type SipHeader,
@@ -1169,6 +1171,13 @@ export {
1169
1171
  type SiprecConnectorCreateParams,
1170
1172
  type SiprecConnectorUpdateParams,
1171
1173
  } from './siprec-connectors';
1174
+ export {
1175
+ SpeechToText,
1176
+ type SpeechToTextListProvidersResponse,
1177
+ type TranscribeClientEvent,
1178
+ type TranscribeServerEvent,
1179
+ type SpeechToTextListProvidersParams,
1180
+ } from './speech-to-text';
1172
1181
  export { Storage, type StorageListMigrationSourceCoverageResponse } from './storage/storage';
1173
1182
  export {
1174
1183
  SubNumberOrders,
@@ -1227,11 +1236,12 @@ export {
1227
1236
  } from './texml-applications';
1228
1237
  export {
1229
1238
  TextToSpeech,
1230
- type TextToSpeechGenerateResponse,
1239
+ type TextToSpeechCreateSpeechResponse,
1231
1240
  type TextToSpeechListVoicesResponse,
1232
1241
  type StreamClientEvent,
1233
1242
  type StreamServerEvent,
1234
- type TextToSpeechGenerateParams,
1243
+ type TextToSpeechCreateSpeechParams,
1244
+ type TextToSpeechGenerateSpeechParams,
1235
1245
  type TextToSpeechListVoicesParams,
1236
1246
  type TextToSpeechStreamParams,
1237
1247
  } from './text-to-speech';
@@ -1364,6 +1374,7 @@ export {
1364
1374
  } from './voice-designs';
1365
1375
  export {
1366
1376
  VoiceSDKCallReports,
1377
+ type VoiceSDKCallReportLogEntry,
1367
1378
  type VoiceSDKCallReportRetrieveResponse,
1368
1379
  type VoiceSDKCallReportListResponse,
1369
1380
  type VoiceSDKCallReportListParams,
@@ -630,6 +630,13 @@ export namespace InboundMessagePayload {
630
630
  }
631
631
  }
632
632
 
633
+ export interface InworldVoiceSettings {
634
+ /**
635
+ * Voice settings provider type
636
+ */
637
+ type: 'inworld';
638
+ }
639
+
633
640
  /**
634
641
  * The set of features available for a specific messaging use case (SMS or MMS).
635
642
  * Features can vary depending on the characteristics the phone number, as well as
@@ -2,13 +2,10 @@
2
2
 
3
3
  export {
4
4
  SpeechToText,
5
- type SpeechToTextTranscribeParams,
6
- type SpeechToTextStreamParams,
7
- type SttClientEvent,
8
- type SttServerEvent,
9
- type TranscriptFrame,
10
- type SttErrorFrame,
5
+ type SpeechToTextListProvidersResponse,
6
+ type TranscribeClientEvent,
7
+ type TranscribeServerEvent,
8
+ type SpeechToTextListProvidersParams,
11
9
  } from './speech-to-text';
12
-
13
- export { SpeechToTextWS } from './ws';
14
- export { WebSocketError } from './internal-base';
10
+ export { type SpeechToTextWSClientOptions } from './ws';
11
+ export { type SpeechToTextWSReconnectOptions } from './ws-base';
@@ -2,18 +2,32 @@
2
2
 
3
3
  import * as SpeechToTextAPI from './speech-to-text';
4
4
  import { Telnyx } from '../../client';
5
-
6
5
  import { EventEmitter } from '../../core/EventEmitter';
7
6
  import { TelnyxError } from '../../core/error';
8
- import { stringifyQuery } from '../../internal/utils';
7
+
8
+ import type { RawWebSocketData, ReconnectingEvent, UnsentMessage } from '../../internal/ws';
9
+
10
+ export type SpeechToTextStreamMessage =
11
+ | { type: 'connecting' | 'open' | 'closing' }
12
+ | {
13
+ type: 'close';
14
+ code: number;
15
+ reason: string;
16
+ unsent: UnsentMessage<SpeechToTextAPI.TranscribeClientEvent>[];
17
+ }
18
+ | { type: 'reconnecting'; reconnect: ReconnectingEvent }
19
+ | { type: 'reconnected' }
20
+ | { type: 'message'; message: SpeechToTextAPI.TranscribeServerEvent }
21
+ | { type: 'raw'; data: RawWebSocketData }
22
+ | { type: 'error'; error: WebSocketError };
9
23
 
10
24
  export class WebSocketError extends TelnyxError {
11
25
  /**
12
26
  * The error data that the API sent back in an error event.
13
27
  */
14
- error?: SpeechToTextAPI.SttServerEvent.ErrorFrame | undefined;
28
+ error?: SpeechToTextAPI.TranscribeServerEvent.SttErrorFrame | undefined;
15
29
 
16
- constructor(message: string, event: SpeechToTextAPI.SttServerEvent.ErrorFrame | null) {
30
+ constructor(message: string, event: SpeechToTextAPI.TranscribeServerEvent.SttErrorFrame | null) {
17
31
  super(message);
18
32
 
19
33
  this.error = event ?? undefined;
@@ -22,32 +36,48 @@ export class WebSocketError extends TelnyxError {
22
36
 
23
37
  type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
24
38
 
25
- type WebsocketEvents = Simplify<
39
+ type WebSocketEvents = Simplify<
26
40
  {
27
- event: (event: SpeechToTextAPI.SttServerEvent) => void;
41
+ event: (event: SpeechToTextAPI.TranscribeServerEvent) => void;
42
+ raw: (data: RawWebSocketData) => void;
28
43
  error: (error: WebSocketError) => void;
44
+ close: (
45
+ code: number,
46
+ reason: string,
47
+ unsent: UnsentMessage<SpeechToTextAPI.TranscribeClientEvent>[],
48
+ ) => void;
49
+ reconnecting: (event: ReconnectingEvent) => void;
50
+ reconnected: () => void;
29
51
  } & {
30
- [EventType in Exclude<NonNullable<SpeechToTextAPI.SttServerEvent['type']>, 'error'>]: (
31
- event: Extract<SpeechToTextAPI.SttServerEvent, { type?: EventType }>,
52
+ [EventType in Exclude<NonNullable<SpeechToTextAPI.TranscribeServerEvent['type']>, 'error'>]: (
53
+ event: Extract<SpeechToTextAPI.TranscribeServerEvent, { type?: EventType }>,
32
54
  ) => unknown;
33
55
  }
34
56
  >;
35
57
 
36
- export abstract class SpeechToTextEmitter extends EventEmitter<WebsocketEvents> {
58
+ export abstract class SpeechToTextEmitter extends EventEmitter<WebSocketEvents> {
59
+ /**
60
+ * Send an event to the API.
61
+ */
62
+ abstract send(event: SpeechToTextAPI.TranscribeClientEvent): void;
63
+
37
64
  /**
38
- * Send binary audio data to the API.
65
+ * Send raw data over the WebSocket without JSON serialization.
39
66
  */
40
- abstract send(data: SpeechToTextAPI.SttClientEvent): void;
67
+ abstract sendRaw(data: RawWebSocketData): void;
41
68
 
42
69
  /**
43
- * Close the websocket connection.
70
+ * Close the WebSocket connection.
44
71
  */
45
72
  abstract close(props?: { code: number; reason: string }): void;
46
73
 
47
74
  protected _onError(event: null, message: string, cause: any): void;
48
- protected _onError(event: SpeechToTextAPI.SttServerEvent.ErrorFrame, message?: string | undefined): void;
49
75
  protected _onError(
50
- event: SpeechToTextAPI.SttServerEvent.ErrorFrame | null,
76
+ event: SpeechToTextAPI.TranscribeServerEvent.SttErrorFrame,
77
+ message?: string | undefined,
78
+ ): void;
79
+ protected _onError(
80
+ event: SpeechToTextAPI.TranscribeServerEvent.SttErrorFrame | null,
51
81
  message?: string | undefined,
52
82
  cause?: any,
53
83
  ): void {
@@ -73,14 +103,11 @@ export abstract class SpeechToTextEmitter extends EventEmitter<WebsocketEvents>
73
103
  }
74
104
  }
75
105
 
76
- export function buildURL(client: Telnyx, query?: SpeechToTextAPI.SpeechToTextStreamParams | null): URL {
77
- const path = '/speech-to-text/transcription';
78
- const baseURL = client.baseURL;
79
- const url = new URL(baseURL + (baseURL.endsWith('/') ? path.slice(1) : path));
80
- if (query) {
81
- url.search = stringifyQuery(query);
82
- }
83
- url.protocol = 'wss';
106
+ export function buildURL(client: Telnyx, parameters: Record<string, unknown>): URL {
107
+ const { ...query } = parameters;
108
+ const endpoint = '/speech-to-text/transcription';
109
+ const url = new URL(client.buildURL(endpoint, query, undefined));
110
+ url.protocol = url.protocol === 'http:' || url.protocol === 'ws:' ? 'ws:' : 'wss:';
84
111
  return url;
85
112
  }
86
113