@onereach/step-voice 1.2202.21 → 1.2202.25

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.
@@ -41,8 +41,11 @@ class GlobalCommand extends voice_1.default {
41
41
  }
42
42
  ]);
43
43
  await this.updateData();
44
- this.process.runThread({
44
+ await this.process.runThread({
45
45
  id: `G:${this.dataThreadId}`,
46
+ local: {
47
+ background: true
48
+ },
46
49
  state: {
47
50
  name: 'globThread',
48
51
  step: this.step.id,
@@ -58,10 +61,10 @@ class GlobalCommand extends voice_1.default {
58
61
  return _.some(choices, (choice) => choice.exitId === exitId);
59
62
  };
60
63
  this.triggers.once(`in/voice/${channel.id}/event`, async (event) => {
64
+ event.processed = undefined;
61
65
  switch (event.params.type) {
62
66
  case 'hangup': {
63
67
  await this.hangup(channel, event);
64
- this.event.processed = undefined;
65
68
  return this.end();
66
69
  }
67
70
  case 'avm-detected':
@@ -82,7 +85,7 @@ class GlobalCommand extends voice_1.default {
82
85
  });
83
86
  return this.exitThread(event, 'digit', params.exitId);
84
87
  }
85
- return this.exitFlow();
88
+ return {};
86
89
  }
87
90
  case 'recognition': {
88
91
  const params = event.params;
@@ -102,12 +105,12 @@ class GlobalCommand extends voice_1.default {
102
105
  });
103
106
  return this.exitThread(event, 'voice', params.exitId);
104
107
  }
105
- return this.exitFlow();
108
+ return {};
106
109
  }
107
110
  case 'error':
108
111
  return this.throwError(event.params.error);
109
112
  default:
110
- return this.exitFlow();
113
+ return {};
111
114
  }
112
115
  });
113
116
  }
@@ -183,6 +186,7 @@ class GlobalCommand extends voice_1.default {
183
186
  step: this.currentStepId
184
187
  }
185
188
  });
189
+ event.processed = true;
186
190
  // this is required to mark event as handled
187
191
  // this.gotoState(this.state, { name: 'exiting' })
188
192
  }
@@ -11,9 +11,8 @@ class InitiateCall extends voice_1.default {
11
11
  return this.step.dataOut.name;
12
12
  }
13
13
  async runStep() {
14
- const { from: botNumber, endUserNumber, sipHost, sipUser, sipPassword, timeout, headers } = this.data;
14
+ const { from: botNumber, endUserNumber, sipHost, sipUser, sipPassword, timeout, headers, originationId = uuid.v4() } = this.data;
15
15
  const originateTimeout = timestring(`${timeout || 30} sec`, 'ms'); // timeout or 30 seconds
16
- const originationId = uuid.v4();
17
16
  const customHeaders = _.reduce(headers, (memo, header) => {
18
17
  memo[header.name] = `${header.value}`;
19
18
  return memo;
@@ -114,14 +113,14 @@ class InitiateCall extends voice_1.default {
114
113
  }
115
114
  });
116
115
  }
116
+ await this.startConversation(channel, {
117
+ events: { [`in/voice/${channel.id}/event`]: {} }
118
+ });
117
119
  await this.transcript(channel, {
118
120
  action: 'Call Start',
119
121
  reportingSettingsKey: 'transcript',
120
122
  actionFromBot: true
121
123
  });
122
- await this.startConversation(channel, {
123
- events: { [`in/voice/${channel.id}/event`]: {} }
124
- });
125
124
  await this.sendCommands(channel, [
126
125
  ...isAMD
127
126
  ? [{
@@ -46,7 +46,6 @@ class SayMessage extends voice_1.default {
46
46
  reportingSettingsKey: 'transcript',
47
47
  actionFromBot: true
48
48
  });
49
- await this.updateData();
50
49
  await this.sendCommands(channel, [command]);
51
50
  return this.exitFlow();
52
51
  });
@@ -35,14 +35,14 @@ class WaitForCall extends voice_1.default {
35
35
  sessionType: 'Phone'
36
36
  }
37
37
  });
38
+ await this.startConversation(channel, {
39
+ events: { [`in/voice/${channel.id}/event`]: {} }
40
+ });
38
41
  await this.transcript(channel, {
39
42
  action: 'Call Start',
40
43
  reportingSettingsKey: 'transcript',
41
44
  actionFromBot: false
42
45
  });
43
- await this.startConversation(channel, {
44
- events: { [`in/voice/${channel.id}/event`]: {} }
45
- });
46
46
  return this.exitStep('trigger');
47
47
  }
48
48
  }
package/dst/voice.js CHANGED
@@ -93,6 +93,7 @@ class VoiceStep extends step_1.default {
93
93
  reportingObject.voiceProcessResult = voiceProcessResult;
94
94
  await this.reporter.reportTranscriptEvent(reportingObject);
95
95
  channel.lastTranscriptId = eventId;
96
+ await this.updateData();
96
97
  return eventId;
97
98
  }
98
99
  throwError(error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/step-voice",
3
- "version": "1.2202.21",
3
+ "version": "1.2202.25",
4
4
  "author": "Roman Zolotarov <roman.zolotarov@onereach.com>",
5
5
  "contributors": [
6
6
  "Roman Zolotarov",
@@ -18,14 +18,14 @@
18
18
  "uuid": "^8.3.2"
19
19
  },
20
20
  "devDependencies": {
21
- "@onereach/flow-sdk": "^2.7.82",
21
+ "@onereach/flow-sdk": "^2.7.84",
22
22
  "@swc/cli": "^0.1.55",
23
- "@swc/core": "^1.2.143",
24
- "@swc/jest": "^0.2.17",
25
- "@types/jest": "^27.4.0",
26
- "@types/lodash": "^4.14.178",
23
+ "@swc/core": "^1.2.146",
24
+ "@swc/jest": "^0.2.20",
25
+ "@types/jest": "^27.4.1",
26
+ "@types/lodash": "^4.14.179",
27
27
  "@types/uuid": "^8.3.4",
28
- "aws-sdk": "^2.1078.0",
28
+ "aws-sdk": "^2.1082.0",
29
29
  "babel-runtime": "^6.26.0",
30
30
  "docdash": "^1.2.0",
31
31
  "husky": "^7.0.4",
@@ -45,7 +45,8 @@
45
45
  "download-prod": "sh scripts/download.sh prod",
46
46
  "download-dev": "sh scripts/download.sh dev",
47
47
  "upload-prod": "sh scripts/upload.sh prod",
48
- "upload-dev": "sh scripts/upload.sh dev"
48
+ "upload-dev": "sh scripts/upload.sh dev",
49
+ "test": "jest"
49
50
  },
50
51
  "repository": {
51
52
  "type": "git",