@onereach/step-voice 6.0.5 → 6.0.6

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.
@@ -71,16 +71,18 @@ class GlobalCommand extends voice_1.default {
71
71
  this.triggers.otherwise(async () => {
72
72
  await this.initGrammar();
73
73
  });
74
- if (this.dataThreadId !== types_1.MAIN_THREAD_ID) {
74
+ const dataThread = this.process.getThread(this.dataThreadId);
75
+ if (this.dataThreadId !== types_1.MAIN_THREAD_ID && dataThread != null && !dataThread.ending) {
75
76
  this.triggers.hook({ name: "ending" /* ACTION.ending */, thread: this.dataThreadId, sync: true }, async () => {
76
- this.log.debug('sleep data thread', { thread: this.dataThreadId });
77
77
  delete this.waits['@ending'];
78
- const dataThread = this.process.getThread(this.dataThreadId);
79
- dataThread?.gotoState({
80
- direct: true,
81
- step: this.currentStepId,
82
- name: this.sleepUntilHangup.name
83
- });
78
+ if (dataThread.waits[`in/voice/${call.id}`]) {
79
+ this.log.debug('sleep data thread', { thread: this.dataThreadId });
80
+ dataThread.gotoState({
81
+ direct: true,
82
+ step: this.currentStepId,
83
+ name: this.sleepUntilHangup.name
84
+ });
85
+ }
84
86
  });
85
87
  }
86
88
  this.triggers.hook({ name: "waitEnd" /* ACTION.waitEnd */, thread: types_1.MAIN_THREAD_ID, sync: true }, async () => {
@@ -94,11 +96,13 @@ class GlobalCommand extends voice_1.default {
94
96
  switch (event.params.type) {
95
97
  case 'hangup': {
96
98
  await this.hangup(call);
97
- this.log.debug('wake data thread', { thread: this.dataThreadId });
98
- this.process.enqueue({
99
- thread: this.dataThreadId,
100
- name: LocalEvents.hangup
101
- });
99
+ if (dataThread?.state.name === this.sleepUntilHangup.name) {
100
+ this.log.debug('wake data thread', { thread: this.dataThreadId });
101
+ this.process.enqueue({
102
+ thread: this.dataThreadId,
103
+ name: LocalEvents.hangup
104
+ });
105
+ }
102
106
  return;
103
107
  }
104
108
  case 'avm-detected':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/step-voice",
3
- "version": "6.0.5",
3
+ "version": "6.0.6",
4
4
  "author": "Roman Zolotarov <roman.zolotarov@onereach.com>",
5
5
  "contributors": [
6
6
  "Roman Zolotarov",