@onereach/step-voice 6.0.5 → 6.0.7

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,12 +71,12 @@ 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) {
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({
78
+ this.log.debug('sleep data thread', { thread: this.dataThreadId });
79
+ dataThread.gotoState({
80
80
  direct: true,
81
81
  step: this.currentStepId,
82
82
  name: this.sleepUntilHangup.name
@@ -94,11 +94,13 @@ class GlobalCommand extends voice_1.default {
94
94
  switch (event.params.type) {
95
95
  case 'hangup': {
96
96
  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
- });
97
+ if (dataThread?.state.name === this.sleepUntilHangup.name) {
98
+ this.log.debug('wake data thread', { thread: this.dataThreadId });
99
+ this.process.enqueue({
100
+ thread: this.dataThreadId,
101
+ name: LocalEvents.hangup
102
+ });
103
+ }
102
104
  return;
103
105
  }
104
106
  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.7",
4
4
  "author": "Roman Zolotarov <roman.zolotarov@onereach.com>",
5
5
  "contributors": [
6
6
  "Roman Zolotarov",