@wildix/wilma-voice-client 0.0.1
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.
- package/dist-cjs/WilmaVoice.js +23 -0
- package/dist-cjs/WilmaVoiceClient.js +49 -0
- package/dist-cjs/auth/httpAuthExtensionConfiguration.js +43 -0
- package/dist-cjs/auth/httpAuthSchemeProvider.js +58 -0
- package/dist-cjs/commands/DescribeVoiceProtocolCommand.js +20 -0
- package/dist-cjs/commands/SendHangupCommand.js +20 -0
- package/dist-cjs/commands/SendPlayCommand.js +20 -0
- package/dist-cjs/commands/SendSayCommand.js +20 -0
- package/dist-cjs/commands/SendStopCommand.js +20 -0
- package/dist-cjs/commands/SendTransferCommand.js +20 -0
- package/dist-cjs/commands/index.js +9 -0
- package/dist-cjs/endpoint/EndpointParameters.js +16 -0
- package/dist-cjs/endpoint/bdd.js +28 -0
- package/dist-cjs/endpoint/endpointResolver.js +16 -0
- package/dist-cjs/extensionConfiguration.js +2 -0
- package/dist-cjs/index.js +13 -0
- package/dist-cjs/models/WilmaVoiceServiceException.js +12 -0
- package/dist-cjs/models/enums.js +37 -0
- package/dist-cjs/models/errors.js +45 -0
- package/dist-cjs/models/models_0.js +2 -0
- package/dist-cjs/runtimeConfig.browser.js +32 -0
- package/dist-cjs/runtimeConfig.js +41 -0
- package/dist-cjs/runtimeConfig.native.js +15 -0
- package/dist-cjs/runtimeConfig.shared.js +41 -0
- package/dist-cjs/runtimeExtensions.js +12 -0
- package/dist-cjs/schemas/schemas_0.js +404 -0
- package/dist-es/WilmaVoice.js +19 -0
- package/dist-es/WilmaVoiceClient.js +45 -0
- package/dist-es/auth/httpAuthExtensionConfiguration.js +38 -0
- package/dist-es/auth/httpAuthSchemeProvider.js +52 -0
- package/dist-es/commands/DescribeVoiceProtocolCommand.js +16 -0
- package/dist-es/commands/SendHangupCommand.js +16 -0
- package/dist-es/commands/SendPlayCommand.js +16 -0
- package/dist-es/commands/SendSayCommand.js +16 -0
- package/dist-es/commands/SendStopCommand.js +16 -0
- package/dist-es/commands/SendTransferCommand.js +16 -0
- package/dist-es/commands/index.js +6 -0
- package/dist-es/endpoint/EndpointParameters.js +12 -0
- package/dist-es/endpoint/bdd.js +25 -0
- package/dist-es/endpoint/endpointResolver.js +12 -0
- package/dist-es/extensionConfiguration.js +1 -0
- package/dist-es/index.js +8 -0
- package/dist-es/models/WilmaVoiceServiceException.js +8 -0
- package/dist-es/models/enums.js +34 -0
- package/dist-es/models/errors.js +39 -0
- package/dist-es/models/models_0.js +1 -0
- package/dist-es/runtimeConfig.browser.js +27 -0
- package/dist-es/runtimeConfig.js +36 -0
- package/dist-es/runtimeConfig.native.js +11 -0
- package/dist-es/runtimeConfig.shared.js +37 -0
- package/dist-es/runtimeExtensions.js +8 -0
- package/dist-es/schemas/schemas_0.js +400 -0
- package/dist-types/WilmaVoice.d.ts +70 -0
- package/dist-types/WilmaVoiceClient.d.ts +185 -0
- package/dist-types/auth/httpAuthExtensionConfiguration.d.ts +29 -0
- package/dist-types/auth/httpAuthSchemeProvider.d.ts +81 -0
- package/dist-types/commands/DescribeVoiceProtocolCommand.d.ts +252 -0
- package/dist-types/commands/SendHangupCommand.d.ts +79 -0
- package/dist-types/commands/SendPlayCommand.d.ts +81 -0
- package/dist-types/commands/SendSayCommand.d.ts +85 -0
- package/dist-types/commands/SendStopCommand.d.ts +78 -0
- package/dist-types/commands/SendTransferCommand.d.ts +80 -0
- package/dist-types/commands/index.d.ts +6 -0
- package/dist-types/endpoint/EndpointParameters.d.ts +41 -0
- package/dist-types/endpoint/bdd.d.ts +2 -0
- package/dist-types/endpoint/endpointResolver.d.ts +8 -0
- package/dist-types/extensionConfiguration.d.ts +8 -0
- package/dist-types/index.d.ts +33 -0
- package/dist-types/models/WilmaVoiceServiceException.d.ts +14 -0
- package/dist-types/models/enums.d.ts +101 -0
- package/dist-types/models/errors.d.ts +36 -0
- package/dist-types/models/models_0.d.ts +805 -0
- package/dist-types/runtimeConfig.browser.d.ts +55 -0
- package/dist-types/runtimeConfig.d.ts +55 -0
- package/dist-types/runtimeConfig.native.d.ts +54 -0
- package/dist-types/runtimeConfig.shared.d.ts +32 -0
- package/dist-types/runtimeExtensions.d.ts +17 -0
- package/dist-types/schemas/schemas_0.d.ts +63 -0
- package/package.json +57 -0
|
@@ -0,0 +1,805 @@
|
|
|
1
|
+
import type { VoiceAudioEncoding, VoiceCommandType, VoiceControlAction, VoiceEventType, VoiceInputMode } from "./enums";
|
|
2
|
+
/**
|
|
3
|
+
* A chunk of raw caller audio, base64-encoded in the session's negotiated input format
|
|
4
|
+
* (inputAudio from the connect handshake). Used by web/app clients in AUDIO input mode; the
|
|
5
|
+
* service buffers and transcribes it server-side. Not used in TRANSCRIPTION mode.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export interface AudioEvent {
|
|
9
|
+
/**
|
|
10
|
+
* Discriminator for the inner payload of an `event` frame.
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
type: VoiceEventType;
|
|
14
|
+
data: string;
|
|
15
|
+
/**
|
|
16
|
+
* Optional monotonic chunk sequence number, for gap detection.
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
seq?: number | undefined;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Envelope of a WebSocket event frame: `\{ "type": "event", "event": \{ ... \} \}`.
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export interface AudioWebsocketEvent {
|
|
26
|
+
type: string;
|
|
27
|
+
/**
|
|
28
|
+
* A chunk of raw caller audio, base64-encoded in the session's negotiated input format
|
|
29
|
+
* (inputAudio from the connect handshake). Used by web/app clients in AUDIO input mode; the
|
|
30
|
+
* service buffers and transcribes it server-side. Not used in TRANSCRIPTION mode.
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
event: AudioEvent;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The call/conversation completed (e.g. the caller hung up or the call was transferred away).
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
|
+
export interface CompleteEvent {
|
|
40
|
+
/**
|
|
41
|
+
* Discriminator for the inner payload of an `event` frame.
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
type: VoiceEventType;
|
|
45
|
+
reason: string;
|
|
46
|
+
time: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Envelope of a WebSocket event frame: `\{ "type": "event", "event": \{ ... \} \}`.
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
export interface CompleteWebsocketEvent {
|
|
53
|
+
type: string;
|
|
54
|
+
/**
|
|
55
|
+
* The call/conversation completed (e.g. the caller hung up or the call was transferred away).
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
event: CompleteEvent;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* A lightweight control frame from the client (AUDIO mode).
|
|
62
|
+
* @public
|
|
63
|
+
*/
|
|
64
|
+
export interface ControlEvent {
|
|
65
|
+
/**
|
|
66
|
+
* Discriminator for the inner payload of an `event` frame.
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
69
|
+
type: VoiceEventType;
|
|
70
|
+
/**
|
|
71
|
+
* A client control action on the audio input (AUDIO mode).
|
|
72
|
+
* @public
|
|
73
|
+
*/
|
|
74
|
+
action: VoiceControlAction;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Envelope of a WebSocket event frame: `\{ "type": "event", "event": \{ ... \} \}`.
|
|
78
|
+
* @public
|
|
79
|
+
*/
|
|
80
|
+
export interface ControlWebsocketEvent {
|
|
81
|
+
type: string;
|
|
82
|
+
/**
|
|
83
|
+
* A lightweight control frame from the client (AUDIO mode).
|
|
84
|
+
* @public
|
|
85
|
+
*/
|
|
86
|
+
event: ControlEvent;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* @public
|
|
90
|
+
*/
|
|
91
|
+
export interface DescribeVoiceProtocolInput {
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* A PCM/compressed audio format description.
|
|
95
|
+
* @public
|
|
96
|
+
*/
|
|
97
|
+
export interface VoiceAudioFormat {
|
|
98
|
+
/**
|
|
99
|
+
* Encoding of raw audio carried over the connection (client `audio` chunks and server `play` frames).
|
|
100
|
+
* @public
|
|
101
|
+
*/
|
|
102
|
+
encoding: VoiceAudioEncoding;
|
|
103
|
+
/**
|
|
104
|
+
* Samples per second, e.g. 8000, 16000 or 24000.
|
|
105
|
+
* @public
|
|
106
|
+
*/
|
|
107
|
+
sampleRate: number;
|
|
108
|
+
/**
|
|
109
|
+
* Channel count. Defaults to 1 (mono).
|
|
110
|
+
* @public
|
|
111
|
+
*/
|
|
112
|
+
channels?: number | undefined;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Parameters supplied on the WebSocket connect (upgrade) request, as query-string parameters.
|
|
116
|
+
* @public
|
|
117
|
+
*/
|
|
118
|
+
export interface VoiceConnectParams {
|
|
119
|
+
/**
|
|
120
|
+
* Protocol version advertised by the client (wim-voicebots `v`). 0 (or absent) is the legacy PBX protocol; >= 1 enables the sessionStarted event.
|
|
121
|
+
* @public
|
|
122
|
+
*/
|
|
123
|
+
protocolVersion?: number | undefined;
|
|
124
|
+
/**
|
|
125
|
+
* Caller-supplied session id, unique per connection.
|
|
126
|
+
* @public
|
|
127
|
+
*/
|
|
128
|
+
sessionId: string;
|
|
129
|
+
/**
|
|
130
|
+
* Agent to run on this session.
|
|
131
|
+
* @public
|
|
132
|
+
*/
|
|
133
|
+
agentId: string;
|
|
134
|
+
/**
|
|
135
|
+
* Deployment used to resolve the published agent version. Defaults to 'production'. Mutually exclusive with agentVersion and agentDraft.
|
|
136
|
+
* @public
|
|
137
|
+
*/
|
|
138
|
+
agentDeployment?: string | undefined;
|
|
139
|
+
/**
|
|
140
|
+
* Published agent version to run. Mutually exclusive with agentDeployment and agentDraft.
|
|
141
|
+
* @public
|
|
142
|
+
*/
|
|
143
|
+
agentVersion?: number | undefined;
|
|
144
|
+
/**
|
|
145
|
+
* Run the agent's current draft (for testing). Mutually exclusive with agentDeployment and agentVersion.
|
|
146
|
+
* @public
|
|
147
|
+
*/
|
|
148
|
+
agentDraft?: boolean | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* PBX call id, when the session is bridged to a call.
|
|
151
|
+
* @public
|
|
152
|
+
*/
|
|
153
|
+
callId?: string | undefined;
|
|
154
|
+
/**
|
|
155
|
+
* BCP-47 language of the conversation, e.g. 'en-US'.
|
|
156
|
+
* @public
|
|
157
|
+
*/
|
|
158
|
+
language?: string | undefined;
|
|
159
|
+
callerName?: string | undefined;
|
|
160
|
+
callerNumber?: string | undefined;
|
|
161
|
+
callerEmail?: string | undefined;
|
|
162
|
+
callerCompany?: string | undefined;
|
|
163
|
+
/**
|
|
164
|
+
* Override the TTS voice for this session, as a voice URI, e.g. 'elevenlabs://<voiceId>?apiKey=...'. Defaults to the agent's configured voice.
|
|
165
|
+
* @public
|
|
166
|
+
*/
|
|
167
|
+
voice?: string | undefined;
|
|
168
|
+
/**
|
|
169
|
+
* First message spoken to the caller. Overrides the agent's configured greeting.
|
|
170
|
+
* @public
|
|
171
|
+
*/
|
|
172
|
+
initialMessage?: string | undefined;
|
|
173
|
+
/**
|
|
174
|
+
* Base64-encoded JSON object of agent variables for this session, e.g. base64('\{"orderId":"123"\}').
|
|
175
|
+
* @public
|
|
176
|
+
*/
|
|
177
|
+
variables?: string | undefined;
|
|
178
|
+
/**
|
|
179
|
+
* How caller speech reaches the service. Defaults to TRANSCRIPTION (PBX). Web/app clients use AUDIO.
|
|
180
|
+
* @public
|
|
181
|
+
*/
|
|
182
|
+
inputMode?: VoiceInputMode | undefined;
|
|
183
|
+
/**
|
|
184
|
+
* Format of client `audio` chunks in AUDIO mode.
|
|
185
|
+
* @public
|
|
186
|
+
*/
|
|
187
|
+
inputAudio?: VoiceAudioFormat | undefined;
|
|
188
|
+
/**
|
|
189
|
+
* Preferred format for server-synthesized `play` frames.
|
|
190
|
+
* @public
|
|
191
|
+
*/
|
|
192
|
+
outputAudio?: VoiceAudioFormat | undefined;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* An error surfaced on the connection. Non-terminal unless followed by a SessionEndedEvent.
|
|
196
|
+
* @public
|
|
197
|
+
*/
|
|
198
|
+
export interface VoiceErrorEvent {
|
|
199
|
+
/**
|
|
200
|
+
* Discriminator for the inner payload of an `event` frame.
|
|
201
|
+
* @public
|
|
202
|
+
*/
|
|
203
|
+
type: VoiceEventType;
|
|
204
|
+
/**
|
|
205
|
+
* Stable machine-readable error code.
|
|
206
|
+
* @public
|
|
207
|
+
*/
|
|
208
|
+
code: string;
|
|
209
|
+
message: string;
|
|
210
|
+
time: number;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Envelope of a WebSocket event frame: `\{ "type": "event", "event": \{ ... \} \}`.
|
|
214
|
+
* @public
|
|
215
|
+
*/
|
|
216
|
+
export interface ErrorWebsocketEvent {
|
|
217
|
+
type: string;
|
|
218
|
+
/**
|
|
219
|
+
* An error surfaced on the connection. Non-terminal unless followed by a SessionEndedEvent.
|
|
220
|
+
* @public
|
|
221
|
+
*/
|
|
222
|
+
event: VoiceErrorEvent;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Terminate the session and hang up the call.
|
|
226
|
+
* @public
|
|
227
|
+
*/
|
|
228
|
+
export interface HangupCommandData {
|
|
229
|
+
reason?: string | undefined;
|
|
230
|
+
/**
|
|
231
|
+
* Discriminator for the inner payload of a `command` frame.
|
|
232
|
+
* @public
|
|
233
|
+
*/
|
|
234
|
+
type: VoiceCommandType;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Envelope of a WebSocket command frame: `\{ "type": "command", "command": \{ ... \} \}`.
|
|
238
|
+
* @public
|
|
239
|
+
*/
|
|
240
|
+
export interface HangupWebsocketCommand {
|
|
241
|
+
type: string;
|
|
242
|
+
/**
|
|
243
|
+
* Terminate the session and hang up the call.
|
|
244
|
+
* @public
|
|
245
|
+
*/
|
|
246
|
+
command: HangupCommandData;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* The caller interrupted (barged in over) a reply that was being played.
|
|
250
|
+
* @public
|
|
251
|
+
*/
|
|
252
|
+
export interface InterruptionEvent {
|
|
253
|
+
/**
|
|
254
|
+
* Discriminator for the inner payload of an `event` frame.
|
|
255
|
+
* @public
|
|
256
|
+
*/
|
|
257
|
+
type: VoiceEventType;
|
|
258
|
+
/**
|
|
259
|
+
* Correlates a caller phrase, the agent reply it produced, and the playback/interruption of that reply.
|
|
260
|
+
* @public
|
|
261
|
+
*/
|
|
262
|
+
replyId: string;
|
|
263
|
+
/**
|
|
264
|
+
* Portion of the reply that had been played before the interruption.
|
|
265
|
+
* @public
|
|
266
|
+
*/
|
|
267
|
+
playedText: string;
|
|
268
|
+
/**
|
|
269
|
+
* The full reply text that was being played.
|
|
270
|
+
* @public
|
|
271
|
+
*/
|
|
272
|
+
originalText: string;
|
|
273
|
+
time: number;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Envelope of a WebSocket event frame: `\{ "type": "event", "event": \{ ... \} \}`.
|
|
277
|
+
* @public
|
|
278
|
+
*/
|
|
279
|
+
export interface InterruptionWebsocketEvent {
|
|
280
|
+
type: string;
|
|
281
|
+
/**
|
|
282
|
+
* The caller interrupted (barged in over) a reply that was being played.
|
|
283
|
+
* @public
|
|
284
|
+
*/
|
|
285
|
+
event: InterruptionEvent;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Client-reported progress of an in-flight reply playback.
|
|
289
|
+
* @public
|
|
290
|
+
*/
|
|
291
|
+
export interface PlaybackEvent {
|
|
292
|
+
/**
|
|
293
|
+
* Discriminator for the inner payload of an `event` frame.
|
|
294
|
+
* @public
|
|
295
|
+
*/
|
|
296
|
+
type: VoiceEventType;
|
|
297
|
+
/**
|
|
298
|
+
* Correlates a caller phrase, the agent reply it produced, and the playback/interruption of that reply.
|
|
299
|
+
* @public
|
|
300
|
+
*/
|
|
301
|
+
replyId: string;
|
|
302
|
+
text: string;
|
|
303
|
+
complete: boolean;
|
|
304
|
+
startTime: number;
|
|
305
|
+
endTime?: number | undefined;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Envelope of a WebSocket event frame: `\{ "type": "event", "event": \{ ... \} \}`.
|
|
309
|
+
* @public
|
|
310
|
+
*/
|
|
311
|
+
export interface PlaybackWebsocketEvent {
|
|
312
|
+
type: string;
|
|
313
|
+
/**
|
|
314
|
+
* Client-reported progress of an in-flight reply playback.
|
|
315
|
+
* @public
|
|
316
|
+
*/
|
|
317
|
+
event: PlaybackEvent;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* A chunk of synthesized reply audio to play. `data` is base64, PCM-encoded at the sample rate declared in the matching `say` command; an empty `data` marks the end of the stream.
|
|
321
|
+
* @public
|
|
322
|
+
*/
|
|
323
|
+
export interface PlayCommandData {
|
|
324
|
+
/**
|
|
325
|
+
* Correlates a caller phrase, the agent reply it produced, and the playback/interruption of that reply.
|
|
326
|
+
* @public
|
|
327
|
+
*/
|
|
328
|
+
replyId: string;
|
|
329
|
+
/**
|
|
330
|
+
* Identifies one synthesized audio stream within a session; carried by a `say` command and the `play` frames that render it.
|
|
331
|
+
* @public
|
|
332
|
+
*/
|
|
333
|
+
streamId: string;
|
|
334
|
+
data: string;
|
|
335
|
+
/**
|
|
336
|
+
* Discriminator for the inner payload of a `command` frame.
|
|
337
|
+
* @public
|
|
338
|
+
*/
|
|
339
|
+
type: VoiceCommandType;
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Envelope of a WebSocket command frame: `\{ "type": "command", "command": \{ ... \} \}`.
|
|
343
|
+
* @public
|
|
344
|
+
*/
|
|
345
|
+
export interface PlayWebsocketCommand {
|
|
346
|
+
type: string;
|
|
347
|
+
/**
|
|
348
|
+
* A chunk of synthesized reply audio to play. `data` is base64, PCM-encoded at the sample rate declared in the matching `say` command; an empty `data` marks the end of the stream.
|
|
349
|
+
* @public
|
|
350
|
+
*/
|
|
351
|
+
command: PlayCommandData;
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* A final caller phrase that should trigger an agent turn (PBX / TRANSCRIPTION mode).
|
|
355
|
+
* @public
|
|
356
|
+
*/
|
|
357
|
+
export interface ReplyEvent {
|
|
358
|
+
/**
|
|
359
|
+
* Discriminator for the inner payload of an `event` frame.
|
|
360
|
+
* @public
|
|
361
|
+
*/
|
|
362
|
+
type: VoiceEventType;
|
|
363
|
+
/**
|
|
364
|
+
* Correlates a caller phrase, the agent reply it produced, and the playback/interruption of that reply.
|
|
365
|
+
* @public
|
|
366
|
+
*/
|
|
367
|
+
id: string;
|
|
368
|
+
text: string;
|
|
369
|
+
startTime: number;
|
|
370
|
+
endTime: number;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Envelope of a WebSocket event frame: `\{ "type": "event", "event": \{ ... \} \}`.
|
|
374
|
+
* @public
|
|
375
|
+
*/
|
|
376
|
+
export interface ReplyWebsocketEvent {
|
|
377
|
+
type: string;
|
|
378
|
+
/**
|
|
379
|
+
* A final caller phrase that should trigger an agent turn (PBX / TRANSCRIPTION mode).
|
|
380
|
+
* @public
|
|
381
|
+
*/
|
|
382
|
+
event: ReplyEvent;
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* 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.
|
|
386
|
+
* @public
|
|
387
|
+
*/
|
|
388
|
+
export interface SayCommandAudioOptions {
|
|
389
|
+
/**
|
|
390
|
+
* Identifies one synthesized audio stream within a session; carried by a `say` command and the `play` frames that render it.
|
|
391
|
+
* @public
|
|
392
|
+
*/
|
|
393
|
+
streamId: string;
|
|
394
|
+
sampleRate: number;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Play a reply to the caller. When `audio` is absent the client performs text-to-speech from `text`; when present the server streams synthesized `play` frames for this reply.
|
|
398
|
+
* @public
|
|
399
|
+
*/
|
|
400
|
+
export interface SayCommandData {
|
|
401
|
+
text: string;
|
|
402
|
+
/**
|
|
403
|
+
* Correlates a caller phrase, the agent reply it produced, and the playback/interruption of that reply.
|
|
404
|
+
* @public
|
|
405
|
+
*/
|
|
406
|
+
replyId: string;
|
|
407
|
+
/**
|
|
408
|
+
* Whether the caller may barge in over this reply.
|
|
409
|
+
* @public
|
|
410
|
+
*/
|
|
411
|
+
interruptible?: boolean | undefined;
|
|
412
|
+
/**
|
|
413
|
+
* 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.
|
|
414
|
+
* @public
|
|
415
|
+
*/
|
|
416
|
+
audio?: SayCommandAudioOptions | undefined;
|
|
417
|
+
/**
|
|
418
|
+
* Discriminator for the inner payload of a `command` frame.
|
|
419
|
+
* @public
|
|
420
|
+
*/
|
|
421
|
+
type: VoiceCommandType;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Envelope of a WebSocket command frame: `\{ "type": "command", "command": \{ ... \} \}`.
|
|
425
|
+
* @public
|
|
426
|
+
*/
|
|
427
|
+
export interface SayWebsocketCommand {
|
|
428
|
+
type: string;
|
|
429
|
+
/**
|
|
430
|
+
* Play a reply to the caller. When `audio` is absent the client performs text-to-speech from `text`; when present the server streams synthesized `play` frames for this reply.
|
|
431
|
+
* @public
|
|
432
|
+
*/
|
|
433
|
+
command: SayCommandData;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Terminal server event: the session ended, optionally with an error.
|
|
437
|
+
* @public
|
|
438
|
+
*/
|
|
439
|
+
export interface SessionEndedEvent {
|
|
440
|
+
/**
|
|
441
|
+
* Discriminator for the inner payload of an `event` frame.
|
|
442
|
+
* @public
|
|
443
|
+
*/
|
|
444
|
+
type: VoiceEventType;
|
|
445
|
+
reason?: string | undefined;
|
|
446
|
+
/**
|
|
447
|
+
* Present when the session ended because of an error.
|
|
448
|
+
* @public
|
|
449
|
+
*/
|
|
450
|
+
error?: string | undefined;
|
|
451
|
+
time: number;
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Envelope of a WebSocket event frame: `\{ "type": "event", "event": \{ ... \} \}`.
|
|
455
|
+
* @public
|
|
456
|
+
*/
|
|
457
|
+
export interface SessionEndedWebsocketEvent {
|
|
458
|
+
type: string;
|
|
459
|
+
/**
|
|
460
|
+
* Terminal server event: the session ended, optionally with an error.
|
|
461
|
+
* @public
|
|
462
|
+
*/
|
|
463
|
+
event: SessionEndedEvent;
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* 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.
|
|
467
|
+
* @public
|
|
468
|
+
*/
|
|
469
|
+
export interface SessionStartedEvent {
|
|
470
|
+
/**
|
|
471
|
+
* Discriminator for the inner payload of an `event` frame.
|
|
472
|
+
* @public
|
|
473
|
+
*/
|
|
474
|
+
type: VoiceEventType;
|
|
475
|
+
time: number;
|
|
476
|
+
/**
|
|
477
|
+
* Caller-facing voice session identifier, unique per connection. Supplied by the client at connect (the PBX call/session id, or a client-generated id for web sessions).
|
|
478
|
+
* @public
|
|
479
|
+
*/
|
|
480
|
+
sessionId: string;
|
|
481
|
+
/**
|
|
482
|
+
* Agent bound to the session.
|
|
483
|
+
* @public
|
|
484
|
+
*/
|
|
485
|
+
agentId: string;
|
|
486
|
+
/**
|
|
487
|
+
* Published agent version resolved at connect; absent when running the agent draft.
|
|
488
|
+
* @public
|
|
489
|
+
*/
|
|
490
|
+
agentVersion?: number | undefined;
|
|
491
|
+
/**
|
|
492
|
+
* Agent display name.
|
|
493
|
+
* @public
|
|
494
|
+
*/
|
|
495
|
+
agentName?: string | undefined;
|
|
496
|
+
/**
|
|
497
|
+
* Agent category.
|
|
498
|
+
* @public
|
|
499
|
+
*/
|
|
500
|
+
category?: string | undefined;
|
|
501
|
+
/**
|
|
502
|
+
* PBX group used for data ACL; empty when the agent is not assigned to a group.
|
|
503
|
+
* @public
|
|
504
|
+
*/
|
|
505
|
+
groupId?: string | undefined;
|
|
506
|
+
/**
|
|
507
|
+
* Negotiated format of caller `audio` chunks the client should send (AUDIO mode).
|
|
508
|
+
* @public
|
|
509
|
+
*/
|
|
510
|
+
inputAudio?: VoiceAudioFormat | undefined;
|
|
511
|
+
/**
|
|
512
|
+
* Format of the synthesized `play` frames the server will send when it performs TTS.
|
|
513
|
+
* @public
|
|
514
|
+
*/
|
|
515
|
+
outputAudio?: VoiceAudioFormat | undefined;
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Envelope of a WebSocket event frame: `\{ "type": "event", "event": \{ ... \} \}`.
|
|
519
|
+
* @public
|
|
520
|
+
*/
|
|
521
|
+
export interface SessionStartedWebsocketEvent {
|
|
522
|
+
type: string;
|
|
523
|
+
/**
|
|
524
|
+
* 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.
|
|
525
|
+
* @public
|
|
526
|
+
*/
|
|
527
|
+
event: SessionStartedEvent;
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* @public
|
|
531
|
+
*/
|
|
532
|
+
export interface StopCommandData {
|
|
533
|
+
/**
|
|
534
|
+
* Discriminator for the inner payload of a `command` frame.
|
|
535
|
+
* @public
|
|
536
|
+
*/
|
|
537
|
+
type: VoiceCommandType;
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* Envelope of a WebSocket command frame: `\{ "type": "command", "command": \{ ... \} \}`.
|
|
541
|
+
* @public
|
|
542
|
+
*/
|
|
543
|
+
export interface StopWebsocketCommand {
|
|
544
|
+
type: string;
|
|
545
|
+
command: StopCommandData;
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* A transcription chunk of caller speech, provided by a client that does its own speech-to-text (PBX / TRANSCRIPTION mode), or emitted by the service (AUDIO mode) and echoed to the client.
|
|
549
|
+
* @public
|
|
550
|
+
*/
|
|
551
|
+
export interface TranscriptionEvent {
|
|
552
|
+
/**
|
|
553
|
+
* Discriminator for the inner payload of an `event` frame.
|
|
554
|
+
* @public
|
|
555
|
+
*/
|
|
556
|
+
type: VoiceEventType;
|
|
557
|
+
/**
|
|
558
|
+
* Identifier of a transcription chunk within a session.
|
|
559
|
+
* @public
|
|
560
|
+
*/
|
|
561
|
+
id: string;
|
|
562
|
+
text: string;
|
|
563
|
+
/**
|
|
564
|
+
* Transcription confidence score (accuracy level) in range from 0.0 to 1.0. Value -1.0 indicates confidence is unavailable.
|
|
565
|
+
* @public
|
|
566
|
+
*/
|
|
567
|
+
confidence?: number | undefined;
|
|
568
|
+
/**
|
|
569
|
+
* True when this is the final transcript for the utterance rather than an interim hypothesis.
|
|
570
|
+
* @public
|
|
571
|
+
*/
|
|
572
|
+
final?: boolean | undefined;
|
|
573
|
+
time: number;
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* Envelope of a WebSocket event frame: `\{ "type": "event", "event": \{ ... \} \}`.
|
|
577
|
+
* @public
|
|
578
|
+
*/
|
|
579
|
+
export interface TranscriptionWebsocketEvent {
|
|
580
|
+
type: string;
|
|
581
|
+
/**
|
|
582
|
+
* A transcription chunk of caller speech, provided by a client that does its own speech-to-text (PBX / TRANSCRIPTION mode), or emitted by the service (AUDIO mode) and echoed to the client.
|
|
583
|
+
* @public
|
|
584
|
+
*/
|
|
585
|
+
event: TranscriptionEvent;
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* Transfer the call to a PBX destination and terminate the session. Honoured on PBX clients.
|
|
589
|
+
* @public
|
|
590
|
+
*/
|
|
591
|
+
export interface TransferCommandData {
|
|
592
|
+
context: string;
|
|
593
|
+
extension: string;
|
|
594
|
+
/**
|
|
595
|
+
* Discriminator for the inner payload of a `command` frame.
|
|
596
|
+
* @public
|
|
597
|
+
*/
|
|
598
|
+
type: VoiceCommandType;
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* Envelope of a WebSocket command frame: `\{ "type": "command", "command": \{ ... \} \}`.
|
|
602
|
+
* @public
|
|
603
|
+
*/
|
|
604
|
+
export interface TransferWebsocketCommand {
|
|
605
|
+
type: string;
|
|
606
|
+
/**
|
|
607
|
+
* Transfer the call to a PBX destination and terminate the session. Honoured on PBX clients.
|
|
608
|
+
* @public
|
|
609
|
+
*/
|
|
610
|
+
command: TransferCommandData;
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* @public
|
|
614
|
+
*/
|
|
615
|
+
export interface DescribeVoiceProtocolOutput {
|
|
616
|
+
/**
|
|
617
|
+
* Parameters supplied on the WebSocket connect (upgrade) request, as query-string parameters.
|
|
618
|
+
* @public
|
|
619
|
+
*/
|
|
620
|
+
connectParams?: VoiceConnectParams | undefined;
|
|
621
|
+
/**
|
|
622
|
+
* Envelope of a WebSocket event frame: `\{ "type": "event", "event": \{ ... \} \}`.
|
|
623
|
+
* @public
|
|
624
|
+
*/
|
|
625
|
+
audioWebsocketEvent?: AudioWebsocketEvent | undefined;
|
|
626
|
+
/**
|
|
627
|
+
* Envelope of a WebSocket event frame: `\{ "type": "event", "event": \{ ... \} \}`.
|
|
628
|
+
* @public
|
|
629
|
+
*/
|
|
630
|
+
transcriptionWebsocketEvent?: TranscriptionWebsocketEvent | undefined;
|
|
631
|
+
/**
|
|
632
|
+
* Envelope of a WebSocket event frame: `\{ "type": "event", "event": \{ ... \} \}`.
|
|
633
|
+
* @public
|
|
634
|
+
*/
|
|
635
|
+
replyWebsocketEvent?: ReplyWebsocketEvent | undefined;
|
|
636
|
+
/**
|
|
637
|
+
* Envelope of a WebSocket event frame: `\{ "type": "event", "event": \{ ... \} \}`.
|
|
638
|
+
* @public
|
|
639
|
+
*/
|
|
640
|
+
playbackWebsocketEvent?: PlaybackWebsocketEvent | undefined;
|
|
641
|
+
/**
|
|
642
|
+
* Envelope of a WebSocket event frame: `\{ "type": "event", "event": \{ ... \} \}`.
|
|
643
|
+
* @public
|
|
644
|
+
*/
|
|
645
|
+
interruptionWebsocketEvent?: InterruptionWebsocketEvent | undefined;
|
|
646
|
+
/**
|
|
647
|
+
* Envelope of a WebSocket event frame: `\{ "type": "event", "event": \{ ... \} \}`.
|
|
648
|
+
* @public
|
|
649
|
+
*/
|
|
650
|
+
completeWebsocketEvent?: CompleteWebsocketEvent | undefined;
|
|
651
|
+
/**
|
|
652
|
+
* Envelope of a WebSocket event frame: `\{ "type": "event", "event": \{ ... \} \}`.
|
|
653
|
+
* @public
|
|
654
|
+
*/
|
|
655
|
+
controlWebsocketEvent?: ControlWebsocketEvent | undefined;
|
|
656
|
+
/**
|
|
657
|
+
* Envelope of a WebSocket event frame: `\{ "type": "event", "event": \{ ... \} \}`.
|
|
658
|
+
* @public
|
|
659
|
+
*/
|
|
660
|
+
sessionStartedWebsocketEvent?: SessionStartedWebsocketEvent | undefined;
|
|
661
|
+
/**
|
|
662
|
+
* Envelope of a WebSocket event frame: `\{ "type": "event", "event": \{ ... \} \}`.
|
|
663
|
+
* @public
|
|
664
|
+
*/
|
|
665
|
+
sessionEndedWebsocketEvent?: SessionEndedWebsocketEvent | undefined;
|
|
666
|
+
/**
|
|
667
|
+
* Envelope of a WebSocket event frame: `\{ "type": "event", "event": \{ ... \} \}`.
|
|
668
|
+
* @public
|
|
669
|
+
*/
|
|
670
|
+
errorWebsocketEvent?: ErrorWebsocketEvent | undefined;
|
|
671
|
+
/**
|
|
672
|
+
* Envelope of a WebSocket command frame: `\{ "type": "command", "command": \{ ... \} \}`.
|
|
673
|
+
* @public
|
|
674
|
+
*/
|
|
675
|
+
sayWebsocketCommand?: SayWebsocketCommand | undefined;
|
|
676
|
+
/**
|
|
677
|
+
* Envelope of a WebSocket command frame: `\{ "type": "command", "command": \{ ... \} \}`.
|
|
678
|
+
* @public
|
|
679
|
+
*/
|
|
680
|
+
playWebsocketCommand?: PlayWebsocketCommand | undefined;
|
|
681
|
+
/**
|
|
682
|
+
* Envelope of a WebSocket command frame: `\{ "type": "command", "command": \{ ... \} \}`.
|
|
683
|
+
* @public
|
|
684
|
+
*/
|
|
685
|
+
stopWebsocketCommand?: StopWebsocketCommand | undefined;
|
|
686
|
+
/**
|
|
687
|
+
* Envelope of a WebSocket command frame: `\{ "type": "command", "command": \{ ... \} \}`.
|
|
688
|
+
* @public
|
|
689
|
+
*/
|
|
690
|
+
hangupWebsocketCommand?: HangupWebsocketCommand | undefined;
|
|
691
|
+
/**
|
|
692
|
+
* Envelope of a WebSocket command frame: `\{ "type": "command", "command": \{ ... \} \}`.
|
|
693
|
+
* @public
|
|
694
|
+
*/
|
|
695
|
+
transferWebsocketCommand?: TransferWebsocketCommand | undefined;
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Terminate the session and hang up the call.
|
|
699
|
+
* @public
|
|
700
|
+
*/
|
|
701
|
+
export interface SendHangupInput {
|
|
702
|
+
reason?: string | undefined;
|
|
703
|
+
/**
|
|
704
|
+
* Caller-facing voice session identifier, unique per connection. Supplied by the client at connect (the PBX call/session id, or a client-generated id for web sessions).
|
|
705
|
+
* @public
|
|
706
|
+
*/
|
|
707
|
+
sessionId: string;
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* @public
|
|
711
|
+
*/
|
|
712
|
+
export interface SendHangupOutput {
|
|
713
|
+
}
|
|
714
|
+
/**
|
|
715
|
+
* A chunk of synthesized reply audio to play. `data` is base64, PCM-encoded at the sample rate declared in the matching `say` command; an empty `data` marks the end of the stream.
|
|
716
|
+
* @public
|
|
717
|
+
*/
|
|
718
|
+
export interface SendPlayInput {
|
|
719
|
+
/**
|
|
720
|
+
* Correlates a caller phrase, the agent reply it produced, and the playback/interruption of that reply.
|
|
721
|
+
* @public
|
|
722
|
+
*/
|
|
723
|
+
replyId: string;
|
|
724
|
+
/**
|
|
725
|
+
* Identifies one synthesized audio stream within a session; carried by a `say` command and the `play` frames that render it.
|
|
726
|
+
* @public
|
|
727
|
+
*/
|
|
728
|
+
streamId: string;
|
|
729
|
+
data: string;
|
|
730
|
+
/**
|
|
731
|
+
* Caller-facing voice session identifier, unique per connection. Supplied by the client at connect (the PBX call/session id, or a client-generated id for web sessions).
|
|
732
|
+
* @public
|
|
733
|
+
*/
|
|
734
|
+
sessionId: string;
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* @public
|
|
738
|
+
*/
|
|
739
|
+
export interface SendPlayOutput {
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* Play a reply to the caller. When `audio` is absent the client performs text-to-speech from `text`; when present the server streams synthesized `play` frames for this reply.
|
|
743
|
+
* @public
|
|
744
|
+
*/
|
|
745
|
+
export interface SendSayInput {
|
|
746
|
+
text: string;
|
|
747
|
+
/**
|
|
748
|
+
* Correlates a caller phrase, the agent reply it produced, and the playback/interruption of that reply.
|
|
749
|
+
* @public
|
|
750
|
+
*/
|
|
751
|
+
replyId: string;
|
|
752
|
+
/**
|
|
753
|
+
* Whether the caller may barge in over this reply.
|
|
754
|
+
* @public
|
|
755
|
+
*/
|
|
756
|
+
interruptible?: boolean | undefined;
|
|
757
|
+
/**
|
|
758
|
+
* 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.
|
|
759
|
+
* @public
|
|
760
|
+
*/
|
|
761
|
+
audio?: SayCommandAudioOptions | undefined;
|
|
762
|
+
/**
|
|
763
|
+
* Caller-facing voice session identifier, unique per connection. Supplied by the client at connect (the PBX call/session id, or a client-generated id for web sessions).
|
|
764
|
+
* @public
|
|
765
|
+
*/
|
|
766
|
+
sessionId: string;
|
|
767
|
+
}
|
|
768
|
+
/**
|
|
769
|
+
* @public
|
|
770
|
+
*/
|
|
771
|
+
export interface SendSayOutput {
|
|
772
|
+
}
|
|
773
|
+
/**
|
|
774
|
+
* @public
|
|
775
|
+
*/
|
|
776
|
+
export interface SendStopInput {
|
|
777
|
+
/**
|
|
778
|
+
* Caller-facing voice session identifier, unique per connection. Supplied by the client at connect (the PBX call/session id, or a client-generated id for web sessions).
|
|
779
|
+
* @public
|
|
780
|
+
*/
|
|
781
|
+
sessionId: string;
|
|
782
|
+
}
|
|
783
|
+
/**
|
|
784
|
+
* @public
|
|
785
|
+
*/
|
|
786
|
+
export interface SendStopOutput {
|
|
787
|
+
}
|
|
788
|
+
/**
|
|
789
|
+
* Transfer the call to a PBX destination and terminate the session. Honoured on PBX clients.
|
|
790
|
+
* @public
|
|
791
|
+
*/
|
|
792
|
+
export interface SendTransferInput {
|
|
793
|
+
context: string;
|
|
794
|
+
extension: string;
|
|
795
|
+
/**
|
|
796
|
+
* Caller-facing voice session identifier, unique per connection. Supplied by the client at connect (the PBX call/session id, or a client-generated id for web sessions).
|
|
797
|
+
* @public
|
|
798
|
+
*/
|
|
799
|
+
sessionId: string;
|
|
800
|
+
}
|
|
801
|
+
/**
|
|
802
|
+
* @public
|
|
803
|
+
*/
|
|
804
|
+
export interface SendTransferOutput {
|
|
805
|
+
}
|