@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.
@@ -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
- replyAck(eventParams: any): void;
41
+ acceptAck(eventParams: any): void;
42
42
  }
43
43
  export {};
@@ -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.replyAck({ ack: true });
104
+ this.acceptAck({ ack: true });
101
105
  return;
102
106
  }
103
107
  case 'hangup':
104
- this.replyAck({ ack: false });
105
- return await this.hangup(call);
108
+ this.acceptAck({ ack: false });
109
+ await this.hangup(call);
110
+ return;
106
111
  case 'avm-detected':
107
- return await this.exitThread(event, 'AMD', 'AMD');
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
- replyAck(eventParams) {
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/step-voice",
3
- "version": "6.1.0",
3
+ "version": "6.1.1",
4
4
  "author": "Roman Zolotarov <roman.zolotarov@onereach.com>",
5
5
  "contributors": [
6
6
  "Roman Zolotarov",
@@ -81,4 +81,4 @@
81
81
  "node_modules"
82
82
  ]
83
83
  }
84
- }
84
+ }