@onereach/step-voice 6.1.0 → 6.1.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/dst/Global Command.d.ts +1 -1
- package/dst/Global Command.js +11 -6
- package/package.json +2 -2
package/dst/Global Command.d.ts
CHANGED
|
@@ -38,6 +38,6 @@ export default class GlobalCommand extends VoiceStep<Partial<INPUT>, OUTPUT, EVE
|
|
|
38
38
|
hangup(call: IVoiceCall): Promise<unknown>;
|
|
39
39
|
exitThread(event: ITypedEvent<EVENT>, type: string, stepExit: string): Promise<void>;
|
|
40
40
|
buildGrammar(call: IVoiceCall, choices: TODO[]): Promise<any>;
|
|
41
|
-
|
|
41
|
+
acceptAck(eventParams: any): void;
|
|
42
42
|
}
|
|
43
43
|
export {};
|
package/dst/Global Command.js
CHANGED
|
@@ -15,6 +15,9 @@ class GlobalCommand extends voice_1.default {
|
|
|
15
15
|
async runStep() {
|
|
16
16
|
const call = await this.fetchData();
|
|
17
17
|
const allowAck = this.canVoicerAck(call);
|
|
18
|
+
if (this.thread.id === this.workerThreadId) {
|
|
19
|
+
throw new Error('gc worker should not use runStep, is another gc on hangup leg?');
|
|
20
|
+
}
|
|
18
21
|
const worker = this.process.newThread(this.workerThreadId, thread => {
|
|
19
22
|
thread.state = {
|
|
20
23
|
name: this.worker.name,
|
|
@@ -35,6 +38,7 @@ class GlobalCommand extends voice_1.default {
|
|
|
35
38
|
}
|
|
36
39
|
if (allowAck) {
|
|
37
40
|
this.triggers.local('ack', ({ params: { ack } }) => {
|
|
41
|
+
delete worker.state.acktrd;
|
|
38
42
|
if (ack)
|
|
39
43
|
this.exitStep('no commands');
|
|
40
44
|
else
|
|
@@ -97,14 +101,16 @@ class GlobalCommand extends voice_1.default {
|
|
|
97
101
|
this.triggers.local(`in/voice/${call.id}`, async (event) => {
|
|
98
102
|
switch (event.params.type) {
|
|
99
103
|
case 'ack': {
|
|
100
|
-
this.
|
|
104
|
+
this.acceptAck({ ack: true });
|
|
101
105
|
return;
|
|
102
106
|
}
|
|
103
107
|
case 'hangup':
|
|
104
|
-
this.
|
|
105
|
-
|
|
108
|
+
this.acceptAck({ ack: false });
|
|
109
|
+
await this.hangup(call);
|
|
110
|
+
return;
|
|
106
111
|
case 'avm-detected':
|
|
107
|
-
|
|
112
|
+
await this.exitThread(event, 'AMD', 'AMD');
|
|
113
|
+
return;
|
|
108
114
|
case 'digit':
|
|
109
115
|
case 'digits': {
|
|
110
116
|
const params = event.params;
|
|
@@ -245,14 +251,13 @@ class GlobalCommand extends voice_1.default {
|
|
|
245
251
|
asr: asr.getSettings(call.asr)
|
|
246
252
|
};
|
|
247
253
|
}
|
|
248
|
-
|
|
254
|
+
acceptAck(eventParams) {
|
|
249
255
|
if (this.state.acktrd) {
|
|
250
256
|
this.process.enqueue({
|
|
251
257
|
thread: this.state.acktrd,
|
|
252
258
|
name: 'ack',
|
|
253
259
|
params: eventParams
|
|
254
260
|
});
|
|
255
|
-
delete this.state.acktrd;
|
|
256
261
|
}
|
|
257
262
|
}
|
|
258
263
|
}
|
package/package.json
CHANGED