@onereach/step-voice 6.0.13 → 6.0.14-fixpassivegc.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/Custom Voice Input.d.ts +1 -1
- package/dst/Custom Voice Input.js +3 -1
- package/dst/Global Command.js +13 -12
- package/dst/Send DTMF.js +4 -1
- package/dst/voice.js +3 -2
- package/package.json +1 -1
|
@@ -41,7 +41,9 @@ const isRepromptTrigger = (recogResult, promptsTriggers) => {
|
|
|
41
41
|
return !lodash_1.default.isEmpty(phrases.filter((e) => triggers.includes(e)));
|
|
42
42
|
};
|
|
43
43
|
const alterRecognitionPhrases = (phrases, interpretation) => {
|
|
44
|
-
|
|
44
|
+
if (interpretation.length !== 1)
|
|
45
|
+
return;
|
|
46
|
+
switch (interpretation[0]) {
|
|
45
47
|
case '$POSTALCODE':
|
|
46
48
|
phrases.forEach(p => { p.lexical = p.lexical.replace(/\s+/g, ''); });
|
|
47
49
|
break;
|
package/dst/Global Command.js
CHANGED
|
@@ -67,15 +67,16 @@ class GlobalCommand extends voice_1.default {
|
|
|
67
67
|
this.triggers.otherwise(async () => {
|
|
68
68
|
await this.initGrammar();
|
|
69
69
|
});
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
70
|
+
if (!call.ended && !this.state.passive) {
|
|
71
|
+
this.triggers.hook({ name: "waitEnd" /* ACTION.waitEnd */, thread: types_1.MAIN_THREAD_ID, sync: true }, async () => {
|
|
72
|
+
if (!call.ended) {
|
|
73
|
+
this.state.passive = true;
|
|
74
|
+
await this.sendCommands(call, [{ name: 'grammar', params: {} }]);
|
|
75
|
+
}
|
|
76
|
+
if (this.thread.background)
|
|
77
|
+
this.end();
|
|
78
|
+
});
|
|
79
|
+
}
|
|
79
80
|
this.triggers.local(`in/voice/${call.id}`, async (event) => {
|
|
80
81
|
switch (event.params.type) {
|
|
81
82
|
case 'hangup':
|
|
@@ -100,7 +101,7 @@ class GlobalCommand extends voice_1.default {
|
|
|
100
101
|
else {
|
|
101
102
|
this.log.debug('exitId missmatch', { exitId, exits: this.step.exits });
|
|
102
103
|
}
|
|
103
|
-
|
|
104
|
+
break;
|
|
104
105
|
}
|
|
105
106
|
case 'recognition': {
|
|
106
107
|
const params = event.params;
|
|
@@ -123,7 +124,7 @@ class GlobalCommand extends voice_1.default {
|
|
|
123
124
|
else {
|
|
124
125
|
this.log.debug('exitId missmatch', { exitId, exits: this.step.exits });
|
|
125
126
|
}
|
|
126
|
-
|
|
127
|
+
break;
|
|
127
128
|
}
|
|
128
129
|
case 'error': {
|
|
129
130
|
if (event.params.error) {
|
|
@@ -141,7 +142,7 @@ class GlobalCommand extends voice_1.default {
|
|
|
141
142
|
break;
|
|
142
143
|
}
|
|
143
144
|
default:
|
|
144
|
-
|
|
145
|
+
break;
|
|
145
146
|
}
|
|
146
147
|
});
|
|
147
148
|
}
|
package/dst/Send DTMF.js
CHANGED
|
@@ -54,11 +54,14 @@ class SendDTMF extends voice_1.default {
|
|
|
54
54
|
// );
|
|
55
55
|
switch (event.params.type) {
|
|
56
56
|
case 'hangup':
|
|
57
|
-
|
|
57
|
+
await this.handleHangup(call);
|
|
58
|
+
return await this.waitConvEnd();
|
|
58
59
|
case 'dtmf-sent':
|
|
59
60
|
return this.exitStep('next');
|
|
60
61
|
case 'error':
|
|
61
62
|
return this.throwError(event.params.error);
|
|
63
|
+
case 'cancel':
|
|
64
|
+
return this.handleCancel();
|
|
62
65
|
default:
|
|
63
66
|
return this.exitFlow();
|
|
64
67
|
}
|
package/dst/voice.js
CHANGED
|
@@ -222,10 +222,11 @@ class VoiceStep extends step_1.default {
|
|
|
222
222
|
async handleHangup(call) {
|
|
223
223
|
if (call.ended)
|
|
224
224
|
return;
|
|
225
|
+
const isHangedUpByBot = call.sessionEndedBy === 'Bot';
|
|
225
226
|
await this.transcript(call, {
|
|
226
227
|
action: 'Call End',
|
|
227
|
-
reportingSettingsKey: '
|
|
228
|
-
actionFromBot:
|
|
228
|
+
reportingSettingsKey: 'transcriptHangup',
|
|
229
|
+
actionFromBot: isHangedUpByBot
|
|
229
230
|
});
|
|
230
231
|
call.ended = true;
|
|
231
232
|
await this.updateData();
|