@onereach/step-voice 6.0.12 → 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 +23 -14
- 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,14 +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
|
-
this.
|
|
77
|
-
|
|
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
|
+
}
|
|
78
80
|
this.triggers.local(`in/voice/${call.id}`, async (event) => {
|
|
79
81
|
switch (event.params.type) {
|
|
80
82
|
case 'hangup':
|
|
@@ -99,7 +101,7 @@ class GlobalCommand extends voice_1.default {
|
|
|
99
101
|
else {
|
|
100
102
|
this.log.debug('exitId missmatch', { exitId, exits: this.step.exits });
|
|
101
103
|
}
|
|
102
|
-
|
|
104
|
+
break;
|
|
103
105
|
}
|
|
104
106
|
case 'recognition': {
|
|
105
107
|
const params = event.params;
|
|
@@ -122,7 +124,7 @@ class GlobalCommand extends voice_1.default {
|
|
|
122
124
|
else {
|
|
123
125
|
this.log.debug('exitId missmatch', { exitId, exits: this.step.exits });
|
|
124
126
|
}
|
|
125
|
-
|
|
127
|
+
break;
|
|
126
128
|
}
|
|
127
129
|
case 'error': {
|
|
128
130
|
if (event.params.error) {
|
|
@@ -140,18 +142,25 @@ class GlobalCommand extends voice_1.default {
|
|
|
140
142
|
break;
|
|
141
143
|
}
|
|
142
144
|
default:
|
|
143
|
-
|
|
145
|
+
break;
|
|
144
146
|
}
|
|
145
147
|
});
|
|
146
148
|
}
|
|
147
149
|
async hangup(call) {
|
|
148
150
|
if (this.event.params.zombie) {
|
|
149
|
-
this.
|
|
150
|
-
|
|
151
|
+
if (this.state.passive) {
|
|
152
|
+
this.log.debug('ignore zombie hangup waiting for full hangup');
|
|
153
|
+
return this.exitFlow();
|
|
154
|
+
}
|
|
155
|
+
this.log.debug('this gc was ignored because call is aleady hang up');
|
|
156
|
+
return this.end();
|
|
151
157
|
}
|
|
152
158
|
await this.handleHangup(call);
|
|
153
159
|
const isHangedUpByBot = call.sessionEndedBy === 'Bot';
|
|
154
|
-
|
|
160
|
+
let hangUpType = isHangedUpByBot ? 'bot hang up' : 'user hang up';
|
|
161
|
+
if (this.event.params.error != null) {
|
|
162
|
+
hangUpType = 'unexpected hang up';
|
|
163
|
+
}
|
|
155
164
|
let processHangUp = this.data.processHangUp;
|
|
156
165
|
// process call recording in hangup event
|
|
157
166
|
if (call.recordCall && this.event.params.callRecording != null) {
|
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();
|