@onereach/step-voice 6.0.19-repromptstimeout.2 → 6.0.20-refdata.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.
- package/dst/Choice.js +1 -1
- package/dst/Custom Voice Input.js +1 -1
- package/dst/Global Command.js +1 -2
- package/dst/Keypad Input.js +1 -1
- package/dst/step.js +0 -1
- package/dst/voice.d.ts +1 -4
- package/dst/voice.js +18 -75
- package/package.json +3 -2
package/dst/Choice.js
CHANGED
|
@@ -255,7 +255,7 @@ class Choice extends voice_1.default {
|
|
|
255
255
|
actionFromBot: true
|
|
256
256
|
});
|
|
257
257
|
command.params.sections = speechSections;
|
|
258
|
-
command.params.timeout = this.rptsTimeout({ noReplyDelay, repromptsList
|
|
258
|
+
command.params.timeout = this.rptsTimeout({ noReplyDelay, repromptsList });
|
|
259
259
|
await this.pauseRecording(call, command, sensitiveData);
|
|
260
260
|
return this.exitFlow();
|
|
261
261
|
});
|
|
@@ -202,7 +202,7 @@ class CustomVoiceInput extends voice_1.default {
|
|
|
202
202
|
actionFromBot: true
|
|
203
203
|
});
|
|
204
204
|
command.params.sections = speechSections;
|
|
205
|
-
command.params.timeout = this.rptsTimeout({ noReplyDelay, repromptsList
|
|
205
|
+
command.params.timeout = this.rptsTimeout({ noReplyDelay, repromptsList });
|
|
206
206
|
await this.pauseRecording(call, command, sensitiveData);
|
|
207
207
|
return this.exitFlow();
|
|
208
208
|
});
|
package/dst/Global Command.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/strict-boolean-expressions, @typescript-eslint/explicit-function-return-type */
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
const tslib_1 = require("tslib");
|
|
4
|
-
/* eslint-disable @typescript-eslint/strict-boolean-expressions, @typescript-eslint/explicit-function-return-type */
|
|
5
|
-
//@ts-nocheck
|
|
6
5
|
const types_1 = require("@onereach/flow-sdk/dst/types");
|
|
7
6
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
8
7
|
const voice_1 = tslib_1.__importDefault(require("./voice"));
|
package/dst/Keypad Input.js
CHANGED
|
@@ -170,7 +170,7 @@ class KeypadInput extends voice_1.default {
|
|
|
170
170
|
action: 'Call Prompt',
|
|
171
171
|
actionFromBot: true
|
|
172
172
|
});
|
|
173
|
-
command.params.firstDigitTimeout = this.rptsTimeout({ noReplyDelay, repromptsList
|
|
173
|
+
command.params.firstDigitTimeout = this.rptsTimeout({ noReplyDelay, repromptsList });
|
|
174
174
|
command.params.sections = speechSections;
|
|
175
175
|
await this.pauseRecording(call, command, sensitiveData);
|
|
176
176
|
return this.exitFlow();
|
package/dst/step.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* eslint-disable @typescript-eslint/strict-boolean-expressions */
|
|
3
|
-
//@ts-nocheck
|
|
4
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
4
|
const tslib_1 = require("tslib");
|
|
6
5
|
const step_1 = tslib_1.__importDefault(require("@onereach/flow-sdk/dst/step"));
|
package/dst/voice.d.ts
CHANGED
|
@@ -56,8 +56,6 @@ export default class VoiceStep<TIn = unknown, TOut = unknown, TParams extends Vo
|
|
|
56
56
|
exitStepByThread(exitId: string, result: any): any;
|
|
57
57
|
exitToThread(): void;
|
|
58
58
|
sendCommands({ id, type, callback }: IVoiceCall, commands: TODO[]): Promise<void>;
|
|
59
|
-
handleDataThreadStart(): void;
|
|
60
|
-
handleDataThreadEnd(): void;
|
|
61
59
|
handleHeartbeat(call: IVoiceCall): Promise<void>;
|
|
62
60
|
handleCancel(): void;
|
|
63
61
|
extractSectionMessages(sections: IPromtpSection[]): string;
|
|
@@ -76,12 +74,11 @@ export default class VoiceStep<TIn = unknown, TOut = unknown, TParams extends Vo
|
|
|
76
74
|
buildChoice(choice: TODO): TODO;
|
|
77
75
|
exitChoiceData(type: string, params?: TODO): TODO;
|
|
78
76
|
rptsSend(call: IVoiceCall, { command, reporting, repromptsList, noReplyDelay, speechSections, textType, ttsSettings, sensitiveData }: TODO): Promise<void>;
|
|
79
|
-
rptsTimeout({ noReplyDelay, repromptsList
|
|
77
|
+
rptsTimeout({ noReplyDelay, repromptsList }: TODO): number;
|
|
80
78
|
rptsRestart(): void;
|
|
81
79
|
rptsHasMore({ repromptsList }: TODO): boolean;
|
|
82
80
|
get rptsIndex(): number;
|
|
83
81
|
get rptsStarted(): boolean;
|
|
84
|
-
sleepUntilHangup(): Promise<void>;
|
|
85
82
|
canVoicerHearbeat(call: IVoiceCall): boolean;
|
|
86
83
|
canVoicerAck(call: IVoiceCall): boolean;
|
|
87
84
|
}
|
package/dst/voice.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* eslint-disable @typescript-eslint/strict-boolean-expressions */
|
|
3
|
-
//@ts-nocheck
|
|
4
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
4
|
exports.VoiceStepError = void 0;
|
|
6
5
|
const tslib_1 = require("tslib");
|
|
7
6
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
8
7
|
const nanoid_1 = require("nanoid");
|
|
9
|
-
const types_1 = require("@onereach/flow-sdk/dst/types");
|
|
10
8
|
const uuid_1 = require("uuid");
|
|
11
9
|
// TODO: !!!!! import ConvStep from '@onereach/step-conversation/dst/step' !!!!!
|
|
12
10
|
const step_1 = tslib_1.__importDefault(require("./step"));
|
|
@@ -19,7 +17,8 @@ class VoiceStep extends step_1.default {
|
|
|
19
17
|
async runBefore() {
|
|
20
18
|
await super.runBefore();
|
|
21
19
|
if (this.cache != null) {
|
|
22
|
-
this.
|
|
20
|
+
if (this.thread.id !== this.dataThreadId)
|
|
21
|
+
this.thread.refThread(this.dataThreadId);
|
|
23
22
|
if (!this.state.direct)
|
|
24
23
|
await this.handleHeartbeat(this.cache);
|
|
25
24
|
}
|
|
@@ -27,9 +26,6 @@ class VoiceStep extends step_1.default {
|
|
|
27
26
|
exitStep(exitId, data, byThread = false) {
|
|
28
27
|
if (byThread)
|
|
29
28
|
return this.exitStepByThread(exitId, data);
|
|
30
|
-
if (this.cache != null) {
|
|
31
|
-
this.handleDataThreadEnd();
|
|
32
|
-
}
|
|
33
29
|
return super.exitStep(exitId, data);
|
|
34
30
|
}
|
|
35
31
|
exitStepByThread(exitId, result) {
|
|
@@ -76,50 +72,6 @@ class VoiceStep extends step_1.default {
|
|
|
76
72
|
if (result == null)
|
|
77
73
|
throw new Error(`failed to send command to call: ${id}`);
|
|
78
74
|
}
|
|
79
|
-
handleDataThreadStart() {
|
|
80
|
-
if (this.dataThreadId === types_1.MAIN_THREAD_ID || this.thread.id === this.dataThreadId)
|
|
81
|
-
return;
|
|
82
|
-
const dataThread = this.process.getThread(this.dataThreadId);
|
|
83
|
-
if (dataThread == null)
|
|
84
|
-
return;
|
|
85
|
-
if (dataThread.state.name === this.sleepUntilHangup.name) {
|
|
86
|
-
this.log.debug('attach to sleep data thread', { thread: this.thread.id });
|
|
87
|
-
dataThread.waits[`thread/end/${this.thread.id}`] = {};
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
this.triggers.hook({ name: "ending" /* ACTION.ending */, thread: this.dataThreadId, sync: true, times: 1 }, async () => {
|
|
91
|
-
// TODO: this is not required in newer versions, delete in v6.1+
|
|
92
|
-
delete this.waits['@ending'];
|
|
93
|
-
delete this.waits.ending;
|
|
94
|
-
if (dataThread.state.name === this.sleepUntilHangup.name) {
|
|
95
|
-
this.log.debug('hook attach to sleep data thread', { thread: this.thread.id });
|
|
96
|
-
dataThread.waits[`thread/end/${this.thread.id}`] = {};
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
this.log.debug('hook create sleep data thread', { thread: this.thread.id });
|
|
100
|
-
dataThread.gotoState({
|
|
101
|
-
direct: true,
|
|
102
|
-
step: this.currentStepId,
|
|
103
|
-
name: this.sleepUntilHangup.name,
|
|
104
|
-
waits: {
|
|
105
|
-
[`thread/end/${this.thread.id}`]: {}
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
handleDataThreadEnd() {
|
|
111
|
-
if (this.dataThreadId === types_1.MAIN_THREAD_ID || this.thread.id === this.dataThreadId)
|
|
112
|
-
return;
|
|
113
|
-
const dataThread = this.process.getThread(this.dataThreadId);
|
|
114
|
-
if (dataThread == null)
|
|
115
|
-
return;
|
|
116
|
-
if (dataThread.state.name === this.sleepUntilHangup.name) {
|
|
117
|
-
this.log.debug('remove sleep data thread', { thread: this.thread.id });
|
|
118
|
-
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
119
|
-
delete dataThread.waits[`thread/end/${this.thread.id}`];
|
|
120
|
-
this.process.enqueue({ name: 'activate', thread: this.dataThreadId });
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
75
|
async handleHeartbeat(call) {
|
|
124
76
|
const allowHeartbeat = this.canVoicerHearbeat(call);
|
|
125
77
|
if (allowHeartbeat) {
|
|
@@ -172,20 +124,19 @@ class VoiceStep extends step_1.default {
|
|
|
172
124
|
}
|
|
173
125
|
async pauseRecording(call, command, sensitiveData) {
|
|
174
126
|
const commands = [command];
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
127
|
+
const stopRecording = (call.recordCall && sensitiveData?.muteStep);
|
|
128
|
+
if (call.vv >= 2) {
|
|
129
|
+
// newer voicer version automaically should stop/resume session recording
|
|
130
|
+
command.params.sensitiveData = stopRecording ? sensitiveData : {};
|
|
131
|
+
}
|
|
132
|
+
else if (stopRecording) {
|
|
133
|
+
commands.unshift({
|
|
134
|
+
name: 'stop-record-session',
|
|
135
|
+
params: {
|
|
136
|
+
muteUser: sensitiveData.muteUser,
|
|
137
|
+
muteBot: sensitiveData.muteBot
|
|
138
|
+
}
|
|
139
|
+
});
|
|
189
140
|
}
|
|
190
141
|
await this.sendCommands(call, commands);
|
|
191
142
|
}
|
|
@@ -378,9 +329,9 @@ class VoiceStep extends step_1.default {
|
|
|
378
329
|
else
|
|
379
330
|
await this.sendCommands(call, [command]);
|
|
380
331
|
}
|
|
381
|
-
rptsTimeout({ noReplyDelay, repromptsList
|
|
382
|
-
const
|
|
383
|
-
return Number(lodash_1.default.get(
|
|
332
|
+
rptsTimeout({ noReplyDelay, repromptsList }) {
|
|
333
|
+
const current = repromptsList[this.rptsIndex];
|
|
334
|
+
return Number(lodash_1.default.get(current, 'time', noReplyDelay)) * 1000 || 60000;
|
|
384
335
|
}
|
|
385
336
|
rptsRestart() {
|
|
386
337
|
this.state.repIdx = undefined;
|
|
@@ -394,14 +345,6 @@ class VoiceStep extends step_1.default {
|
|
|
394
345
|
get rptsStarted() {
|
|
395
346
|
return this.rptsIndex !== 0;
|
|
396
347
|
}
|
|
397
|
-
async sleepUntilHangup() {
|
|
398
|
-
const threadEndPrefix = 'thread/end/';
|
|
399
|
-
if (this.event.name.startsWith(threadEndPrefix)) {
|
|
400
|
-
this.event.processed = true;
|
|
401
|
-
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
402
|
-
delete this.waits[this.event.name];
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
348
|
canVoicerHearbeat(call) {
|
|
406
349
|
return call.vv >= 1;
|
|
407
350
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onereach/step-voice",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.20-refdata.0",
|
|
4
4
|
"author": "Roman Zolotarov <roman.zolotarov@onereach.com>",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Roman Zolotarov",
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"uuid": "^9.0.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@onereach/flow-sdk": "^3.2.
|
|
22
|
+
"@onereach/flow-sdk": "^3.2.46",
|
|
23
|
+
"@onereach/orbes": "^3.1.51",
|
|
23
24
|
"@onereach/step-voice": "./test",
|
|
24
25
|
"@swc/cli": "^0.1.62",
|
|
25
26
|
"@swc/core": "^1.3.57",
|