@wildix/wilma-voice-client 0.0.25 → 0.0.27

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.
@@ -1,4 +1,29 @@
1
- import type { VoiceAudioEncoding, VoiceCommandType, VoiceControlAction, VoiceEventType, VoiceInputMode } from "./enums";
1
+ import type { DocumentType as __DocumentType } from "@smithy/types";
2
+ import type { VoiceAudioEncoding, VoiceCommandType, VoiceControlAction, VoiceEventType, VoiceInputMode, VoicePronunciationEncoding } from "./enums";
3
+ /**
4
+ * A pronunciation rule for one phrase. Belongs to a LANGUAGE, not to the agent: 'Wildix' is
5
+ * respelled differently for an Italian and a German voice, so one list shared ACROSS languages
6
+ * would fight itself. That is why the rules hang off the language and nowhere else — there is no
7
+ * company-wide dictionary above them to inherit from, or to disagree with.
8
+ * @public
9
+ */
10
+ export interface VoicePronunciation {
11
+ /**
12
+ * The phrase as it appears in the text, e.g. 'Wildix'. Bounded because every rule is compiled into ONE regular expression — see the list below.
13
+ * @public
14
+ */
15
+ phrase: string;
16
+ /**
17
+ * Respelling (ALIAS) or phonetic transcription (IPA), e.g. 'Wil-dix'.
18
+ * @public
19
+ */
20
+ as: string;
21
+ /**
22
+ * Defaults to ALIAS.
23
+ * @public
24
+ */
25
+ encoding?: VoicePronunciationEncoding | undefined;
26
+ }
2
27
  /**
3
28
  * A chunk of raw caller audio, base64-encoded in the session's negotiated input format
4
29
  * (inputAudio from the connect handshake). Used by web/app clients in AUDIO input mode; the
@@ -117,7 +142,7 @@ export interface VoiceAudioFormat {
117
142
  */
118
143
  export interface VoiceConnectParams {
119
144
  /**
120
- * Protocol version advertised by the client (query parameter `v`). 0 (or absent) is the legacy PBX protocol; >= 1 enables the sessionStarted event.
145
+ * Protocol version advertised by the client (query parameter `v`). 0 (or absent) is the legacy PBX protocol; >= 1 enables the sessionStarted event; >= 2 additionally means the client WAITS for `started` before opening its recognition stream and honours the `speech` payload on it.
121
146
  * @public
122
147
  */
123
148
  protocolVersion?: number | undefined;
@@ -361,6 +386,11 @@ export interface ReplyEvent {
361
386
  */
362
387
  id: string;
363
388
  text: string;
389
+ /**
390
+ * Language the recogniser identified for this completed utterance. THIS is the one that drives the language switch. When the recogniser reports several languages inside one utterance, the PBX sends the LAST labelled segment's language — it is the one the caller is speaking now.
391
+ * @public
392
+ */
393
+ language?: string | undefined;
364
394
  startTime: number;
365
395
  endTime: number;
366
396
  }
@@ -404,6 +434,11 @@ export interface SayCommandData {
404
434
  * @public
405
435
  */
406
436
  interruptible?: boolean | undefined;
437
+ /**
438
+ * Voice URI the PBX should synthesize with. Set only for a provider whose synthesis runs ON THE PBX (`amazon_polly://`); ElevenLabs and Google are synthesized in the cloud and streamed as PCM through `play` instead, and leave this absent.
439
+ * @public
440
+ */
441
+ voice?: string | undefined;
407
442
  /**
408
443
  * Audio-stream parameters when the server synthesizes the reply itself (TTS provider configured on the agent): the `say` is followed by a stream of `play` frames on this stream id.
409
444
  * @public
@@ -457,6 +492,41 @@ export interface SessionEndedWebsocketEvent {
457
492
  */
458
493
  event: SessionEndedEvent;
459
494
  }
495
+ /**
496
+ * Recognition intent for the call, sent on `started` at protocolVersion >= 2. NOT recogniser
497
+ * parameters: the PBX translates it into its provider's API. Against Amazon Transcribe with
498
+ * autoDetect true that is identify-multiple-languages plus language-options and
499
+ * preferred-language; with autoDetect false, a single-language stream on preferredLanguage.
500
+ *
501
+ * Both members the server can get wrong are RESOLVED here rather than forwarded: `engine` is
502
+ * always concrete (an absent one would let the PBX apply a different default than the console
503
+ * built its language list for), and `autoDetect` is clamped to false whenever the language count
504
+ * is below the recogniser's minimum or the recogniser cannot identify languages at all
505
+ * (forwarding true with one candidate makes Amazon reject the stream outright — a dead call).
506
+ * @public
507
+ */
508
+ export interface VoiceSpeechPayload {
509
+ /**
510
+ * Concrete recogniser URI, resolved from the agent or from the platform default; never absent. See TranscriptionUri.
511
+ * @public
512
+ */
513
+ engine: string;
514
+ /**
515
+ * Every configured language, as candidates for identification.
516
+ * @public
517
+ */
518
+ languages: string[];
519
+ /**
520
+ * The language the call starts in, resolved from the channel. Always a member of `languages`.
521
+ * @public
522
+ */
523
+ preferredLanguage: string;
524
+ /**
525
+ * Whether to identify the spoken language per utterance. Already clamped by the server — see the shape's documentation.
526
+ * @public
527
+ */
528
+ autoDetect: boolean;
529
+ }
460
530
  /**
461
531
  * Emitted once right after the handshake to confirm the session and the agent it is bound to. Sent only when the client advertises protocol version >= 1.
462
532
  * @public
@@ -509,6 +579,28 @@ export interface SessionStartedEvent {
509
579
  * @public
510
580
  */
511
581
  groupId?: string | undefined;
582
+ /**
583
+ * Recognition intent for the call. Sent only at protocolVersion >= 2 and only when the agent has `speech` configured. A v2 client that receives `started` WITHOUT this member falls back to exactly its pre-v2 behavior: a single-language stream on the channel's own `language`.
584
+ * @public
585
+ */
586
+ speech?: VoiceSpeechPayload | undefined;
587
+ /**
588
+ * Music-on-hold class the PBX should play under the call as ambient background.
589
+ *
590
+ * A BARE NAME, not the configuration object `VoiceBackgroundSoundSettings`: this is the RESOLVED
591
+ * outcome. The server has already applied `enabled` and the class default, so the PBX gets a name
592
+ * to play or nothing at all and needs no resolution rule of its own.
593
+ *
594
+ * TOP LEVEL, NOT INSIDE `speech`, because it is not recognition intent and must not inherit
595
+ * `speech`'s conditions: a call with no configured languages carries no `speech` payload and can
596
+ * still have background audio.
597
+ *
598
+ * ABSENT MEANS OFF, and absence is the only way to say it — there is no value for 'none'. A bot
599
+ * whose administrator never touched the setting sends nothing here, which is exactly what every
600
+ * call sent before it existed, so the PBX needs no new case.
601
+ * @public
602
+ */
603
+ backgroundSound?: string | undefined;
512
604
  /**
513
605
  * Negotiated format of caller `audio` chunks the client should send (AUDIO mode).
514
606
  * @public
@@ -576,6 +668,11 @@ export interface TranscriptionEvent {
576
668
  * @public
577
669
  */
578
670
  final?: boolean | undefined;
671
+ /**
672
+ * Language the recogniser identified for this chunk. Recorded in the trace only — it drives no behavior, so an operator can see what the recogniser thought during an utterance that never became a turn.
673
+ * @public
674
+ */
675
+ language?: string | undefined;
579
676
  time: number;
580
677
  }
581
678
  /**
@@ -700,6 +797,72 @@ export interface DescribeVoiceProtocolOutput {
700
797
  */
701
798
  transferWebsocketCommand?: TransferWebsocketCommand | undefined;
702
799
  }
800
+ /**
801
+ * @public
802
+ */
803
+ export interface ListVoicesInput {
804
+ /**
805
+ * Provider whose catalog to read: 'elevenlabs', 'google', 'amazon_polly'. This is the scheme of the URIs answered on `voices`.
806
+ * @public
807
+ */
808
+ provider: string;
809
+ /**
810
+ * Server-side filter for language-bound providers: only voices whose language SET CONTAINS this code. Ignored for ElevenLabs, whose voices are not language bound.
811
+ * @public
812
+ */
813
+ language?: string | undefined;
814
+ search?: string | undefined;
815
+ /**
816
+ * The company's own provider credential to read the catalog with, so the picker lists that
817
+ * account's voices including cloned ones. Absent means the platform key.
818
+ *
819
+ * EITHER A REFERENCE OR THE KEY ITSELF: `secrets:\{secretId\}` for a stored credential, resolved
820
+ * under the CALLER's company — an id that does not resolve there is rejected — or the provider
821
+ * key, for an account being configured whose key is not stored yet, which is the case this
822
+ * operation has to serve before there is anything to reference.
823
+ *
824
+ * A STORED VOICE URI is not the same latitude: its `apiKey` carries a reference, and a literal
825
+ * key in one is the legacy dialplan form that nothing new writes.
826
+ *
827
+ * A PLAIN KEY HERE IS IN A URL. `@sensitive` keeps it out of the generated clients' and servers'
828
+ * log filters, but it cannot keep it out of an access log, a proxy or a browser history, and the
829
+ * service must not put it in a cache identity. Send a reference wherever one exists.
830
+ * @public
831
+ */
832
+ credential?: string | undefined;
833
+ }
834
+ /**
835
+ * One voice a provider offers: the URI to store it by, a name to show, and the provider's own
836
+ * metadata.
837
+ *
838
+ * `uri` IS THE RESULT. It is exactly what goes into `VoiceLanguage.voice`, so a form stores what
839
+ * it was given instead of assembling a string out of a provider name and an id — the one place a
840
+ * client could get the convention wrong.
841
+ * @public
842
+ */
843
+ export interface Voice {
844
+ /**
845
+ * Voice URI, ready to store as `VoiceLanguage.voice` or send to TextToSpeech. Carries no parameters — the caller appends the synthesis parameters and, where applicable, the `apiKey=secrets:\{secretId\}` reference it wants.
846
+ * @public
847
+ */
848
+ uri: string;
849
+ /**
850
+ * Display name as the provider publishes it, e.g. 'Rachel'. A member rather than part of `options` because it is the one thing every provider has and every picker shows.
851
+ * @public
852
+ */
853
+ name: string;
854
+ /**
855
+ * The provider's own metadata for this voice, for rendering and filtering only. See VoiceOptions.
856
+ * @public
857
+ */
858
+ options?: __DocumentType | undefined;
859
+ }
860
+ /**
861
+ * @public
862
+ */
863
+ export interface ListVoicesOutput {
864
+ voices: Voice[];
865
+ }
703
866
  /**
704
867
  * Terminate the session and hang up the call.
705
868
  * @public
@@ -760,6 +923,11 @@ export interface SendSayInput {
760
923
  * @public
761
924
  */
762
925
  interruptible?: boolean | undefined;
926
+ /**
927
+ * Voice URI the PBX should synthesize with. Set only for a provider whose synthesis runs ON THE PBX (`amazon_polly://`); ElevenLabs and Google are synthesized in the cloud and streamed as PCM through `play` instead, and leave this absent.
928
+ * @public
929
+ */
930
+ voice?: string | undefined;
763
931
  /**
764
932
  * Audio-stream parameters when the server synthesizes the reply itself (TTS provider configured on the agent): the `say` is followed by a stream of `play` frames on this stream id.
765
933
  * @public
@@ -809,3 +977,38 @@ export interface SendTransferInput {
809
977
  */
810
978
  export interface SendTransferOutput {
811
979
  }
980
+ /**
981
+ * @public
982
+ */
983
+ export interface TextToSpeechInput {
984
+ /**
985
+ * Voice to speak with, as the URI a call would use — provider, voice id, synthesis parameters and, for a company's own account, `apiKey=secrets:\{secretId\}`. Passing the call's own value is what keeps an audition from diverging from the call it is auditioning.
986
+ * @public
987
+ */
988
+ voice: string;
989
+ /**
990
+ * Language the phrase is in. Reaches the provider as the synthesis language, and is the language `pronunciations` was written for.
991
+ * @public
992
+ */
993
+ language: string;
994
+ /**
995
+ * Text to speak, BEFORE pronunciation rules are applied.
996
+ * @public
997
+ */
998
+ text: string;
999
+ /**
1000
+ * Rules to apply to `text`, applied SERVER-SIDE by the same helper the call path uses — never pre-applied by the caller, or the form reimplements a rule the server owns and can silently diverge from the call. Pass the language's own list to hear exactly what a call would say.
1001
+ * @public
1002
+ */
1003
+ pronunciations?: VoicePronunciation[] | undefined;
1004
+ }
1005
+ /**
1006
+ * @public
1007
+ */
1008
+ export interface TextToSpeechOutput {
1009
+ /**
1010
+ * audio/mpeg. The call path streams raw PCM to the PBX; this returns MP3 so a browser <audio> element plays it with no client-side decoding.
1011
+ * @public
1012
+ */
1013
+ audio: Uint8Array;
1014
+ }
@@ -10,6 +10,7 @@ export declare var ValidationException$: StaticErrorSchema;
10
10
  *
11
11
  */
12
12
  export declare const errorTypeRegistries: TypeRegistry[];
13
+ export declare var VoicePronunciation$: StaticStructureSchema;
13
14
  export declare var AudioEvent$: StaticStructureSchema;
14
15
  export declare var AudioWebsocketEvent$: StaticStructureSchema;
15
16
  export declare var CompleteEvent$: StaticStructureSchema;
@@ -23,6 +24,8 @@ export declare var HangupCommandData$: StaticStructureSchema;
23
24
  export declare var HangupWebsocketCommand$: StaticStructureSchema;
24
25
  export declare var InterruptionEvent$: StaticStructureSchema;
25
26
  export declare var InterruptionWebsocketEvent$: StaticStructureSchema;
27
+ export declare var ListVoicesInput$: StaticStructureSchema;
28
+ export declare var ListVoicesOutput$: StaticStructureSchema;
26
29
  export declare var PlaybackEvent$: StaticStructureSchema;
27
30
  export declare var PlaybackWebsocketEvent$: StaticStructureSchema;
28
31
  export declare var PlayCommandData$: StaticStructureSchema;
@@ -48,16 +51,22 @@ export declare var SessionStartedEvent$: StaticStructureSchema;
48
51
  export declare var SessionStartedWebsocketEvent$: StaticStructureSchema;
49
52
  export declare var StopCommandData$: StaticStructureSchema;
50
53
  export declare var StopWebsocketCommand$: StaticStructureSchema;
54
+ export declare var TextToSpeechInput$: StaticStructureSchema;
55
+ export declare var TextToSpeechOutput$: StaticStructureSchema;
51
56
  export declare var TranscriptionEvent$: StaticStructureSchema;
52
57
  export declare var TranscriptionWebsocketEvent$: StaticStructureSchema;
53
58
  export declare var TransferCommandData$: StaticStructureSchema;
54
59
  export declare var TransferWebsocketCommand$: StaticStructureSchema;
60
+ export declare var Voice$: StaticStructureSchema;
55
61
  export declare var VoiceAudioFormat$: StaticStructureSchema;
56
62
  export declare var VoiceConnectParams$: StaticStructureSchema;
57
63
  export declare var VoiceErrorEvent$: StaticStructureSchema;
64
+ export declare var VoiceSpeechPayload$: StaticStructureSchema;
58
65
  export declare var DescribeVoiceProtocol$: StaticOperationSchema;
66
+ export declare var ListVoices$: StaticOperationSchema;
59
67
  export declare var SendHangup$: StaticOperationSchema;
60
68
  export declare var SendPlay$: StaticOperationSchema;
61
69
  export declare var SendSay$: StaticOperationSchema;
62
70
  export declare var SendStop$: StaticOperationSchema;
63
71
  export declare var SendTransfer$: StaticOperationSchema;
72
+ export declare var TextToSpeech$: StaticOperationSchema;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wildix/wilma-voice-client",
3
3
  "description": "@wildix/wilma-voice-client client",
4
- "version": "0.0.25",
4
+ "version": "0.0.27",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
7
7
  "build:cjs": "tsc -p tsconfig.cjs.json",
@@ -56,4 +56,4 @@
56
56
  "browser": {
57
57
  "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser"
58
58
  }
59
- }
59
+ }