@onereach/step-voice 4.0.10 → 4.0.13

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.
@@ -4,10 +4,5 @@ export default class InitiateCall extends VoiceStep<any, any, import("./voice").
4
4
  get autoCancel(): undefined;
5
5
  runStep(): Promise<void>;
6
6
  waitForCall(): Promise<void>;
7
- error: {
8
- name: string;
9
- message: string;
10
- stack: {};
11
- } | undefined;
12
7
  }
13
8
  import VoiceStep from "./voice";
@@ -32,7 +32,7 @@ class InitiateCall extends voice_1.default {
32
32
  }
33
33
  async waitForCall() {
34
34
  const { asr, tts, from: botNumber, endUserNumber, sipHost, sipUser, sipPassword, timeout, headers, enableSpoofCallerId, spoofCallerId, isAMD } = this.data;
35
- const { id: channelId } = await this.getDataOut();
35
+ const { id: channelId } = await this.fetchData();
36
36
  this.triggers.once(`in/voice/${channelId}/event`, async (event) => {
37
37
  switch (event.params.type) {
38
38
  case 'is_flow_ready': {
@@ -45,7 +45,7 @@ class InitiateCall extends voice_1.default {
45
45
  };
46
46
  });
47
47
  await this.startConversation(event.params.channel, { events: [] });
48
- this.log.warn('Confirming that the OB call can be started');
48
+ this.log.warn({ channel: event.params.channel, conv: this.conversation, data: this.get(this.conversation) }, 'Confirming that the OB call can be started');
49
49
  return this.exitFlow();
50
50
  }
51
51
  case 'call': {
@@ -107,15 +107,10 @@ class InitiateCall extends voice_1.default {
107
107
  await this.updateData();
108
108
  return this.exitStep('no answer', errorChannel);
109
109
  }
110
- this.error = {
111
- name: event.params.error.name,
112
- message: `${event.params.error.date}: ${event.params.error.originateStatus}`,
113
- stack: {}
114
- };
115
110
  await this.transcript(errorChannel, { action: 'Call Error' });
116
- return this.exitStep('error', {
117
- ...errorChannel,
118
- ...this.error
111
+ return this.throwError({
112
+ name: event.params.error.name,
113
+ message: `${event.params.error.date}: ${event.params.error.originateStatus}`
119
114
  });
120
115
  }
121
116
  default:
package/dst/voice.d.ts CHANGED
@@ -29,6 +29,7 @@ export default class VoiceStep<TIn = unknown, TOut = unknown, TParams = VoiceEve
29
29
  }, TOut, TParams> {
30
30
  get autoCancel(): boolean | undefined;
31
31
  onCancel(): Promise<void>;
32
+ waitForEnd(): Promise<void>;
32
33
  sendCommands({ id, type, callback }: IVoiceChannel, commands: TODO[]): Promise<unknown>;
33
34
  extractSectionMessages(sections: IPromtpSection[]): string;
34
35
  extractSectionFiles(sections: IPromtpSection[]): Array<{
package/dst/voice.js CHANGED
@@ -16,10 +16,15 @@ class VoiceStep extends step_1.default {
16
16
  return true;
17
17
  }
18
18
  async onCancel() {
19
- await super.onCancel();
20
19
  if (this.data.handleCancel === true) {
21
20
  this.exitStep('cancel');
22
21
  }
22
+ else {
23
+ this.gotoState('waitForEnd');
24
+ }
25
+ }
26
+ async waitForEnd() {
27
+ this.exitFlow();
23
28
  }
24
29
  async sendCommands({ id, type, callback }, commands) {
25
30
  if (lodash_1.default.isEmpty(commands))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/step-voice",
3
- "version": "4.0.10",
3
+ "version": "4.0.13",
4
4
  "author": "Roman Zolotarov <roman.zolotarov@onereach.com>",
5
5
  "contributors": [
6
6
  "Roman Zolotarov",
@@ -13,27 +13,27 @@
13
13
  "npm": ">= 6.0.0"
14
14
  },
15
15
  "dependencies": {
16
- "@onereach/step-conversation": "^1.0.32",
16
+ "@onereach/step-conversation": "^1.0.33",
17
17
  "lodash": "^4.17.21",
18
18
  "uuid": "^8.3.2"
19
19
  },
20
20
  "devDependencies": {
21
- "@onereach/flow-sdk": "^3.0.12",
21
+ "@onereach/flow-sdk": "^3.0.14",
22
22
  "@swc/cli": "^0.1.57",
23
- "@swc/core": "^1.2.196",
23
+ "@swc/core": "^1.2.197",
24
24
  "@swc/jest": "^0.2.21",
25
- "@types/jest": "^28.1.0",
25
+ "@types/jest": "^28.1.1",
26
26
  "@types/lodash": "^4.14.182",
27
27
  "@types/timestring": "^6.0.2",
28
28
  "@types/uuid": "^8.3.4",
29
- "aws-sdk": "^2.1148.0",
29
+ "aws-sdk": "^2.1149.0",
30
30
  "babel-runtime": "^6.26.0",
31
31
  "docdash": "^1.2.0",
32
32
  "husky": "^8.0.1",
33
- "jest": "^28.1.0",
33
+ "jest": "^28.1.1",
34
34
  "pinst": "^3.0.0",
35
35
  "ts-standard": "^11.0.0",
36
- "typescript": "^4.7.2"
36
+ "typescript": "^4.7.3"
37
37
  },
38
38
  "files": [
39
39
  "/dst"