@onereach/step-voice 7.0.7 → 7.0.8

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.
@@ -73,27 +73,30 @@ class GlobalCommand extends voice_1.default {
73
73
  if (this.thread.id === this.workerThreadId) {
74
74
  throw new Error('gc worker should not use runStep, is another gc on hangup leg?');
75
75
  }
76
- const worker = this.process.newThread(this.workerThreadId, thread => {
77
- thread.state = {
78
- name: this.worker.name,
79
- step: this.step.id,
80
- thread: this.dataThreadId,
81
- acktrd: allowAck ? this.thread.id : undefined
82
- };
76
+ this.triggers.otherwise(async () => {
77
+ const worker = this.process.newThread(this.workerThreadId, thread => {
78
+ thread.state = {
79
+ name: this.worker.name,
80
+ step: this.step.id,
81
+ thread: this.dataThreadId,
82
+ acktrd: allowAck ? this.thread.id : undefined
83
+ };
84
+ });
85
+ if (worker.isNewThread) {
86
+ worker.activate();
87
+ await worker.run();
88
+ await this._refreshCache();
89
+ }
90
+ else if (worker.state.acktrd == null) {
91
+ worker.state.step = this.step.id;
92
+ worker.state.acktrd = allowAck ? this.thread.id : undefined;
93
+ await this.initGrammar(call);
94
+ }
83
95
  });
84
- if (worker.isNewThread) {
85
- worker.activate();
86
- await worker.run();
87
- await this._refreshCache();
88
- }
89
- else if (worker.state.acktrd == null) {
90
- worker.state.step = this.step.id;
91
- worker.state.acktrd = allowAck ? this.thread.id : undefined;
92
- await this.initGrammar(call);
93
- }
94
96
  if (allowAck) {
95
97
  this.triggers.local('ack', ({ params: { ack } }) => {
96
- delete worker.state.acktrd;
98
+ const worker = this.process.getThread(this.workerThreadId);
99
+ delete worker?.state.acktrd;
97
100
  if (ack)
98
101
  this.exitStep('no commands');
99
102
  else
@@ -107,9 +110,6 @@ class GlobalCommand extends voice_1.default {
107
110
  async initGrammar(call) {
108
111
  const choices = this.buildChoices({ choices: this.data.choices });
109
112
  const grammar = await this.buildGrammar(call, choices);
110
- // set grammar into voice conversation
111
- // this was required by nexmo integrations, could be skipped for now
112
- // channel.global = grammar;
113
113
  const recordSession = this.data.recordCall && !call.recordCall;
114
114
  if (recordSession) {
115
115
  call.recordCall = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/step-voice",
3
- "version": "7.0.7",
3
+ "version": "7.0.8",
4
4
  "author": "Roman Zolotarov <roman.zolotarov@onereach.com>",
5
5
  "contributors": [
6
6
  "Roman Zolotarov",