@onereach/step-voice 5.0.9-fixsubflow.11 → 5.0.9-fixsubflow.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.
package/dst/Cancel.js CHANGED
@@ -11,7 +11,7 @@ class VoiceCancel extends voice_1.default {
11
11
  // return
12
12
  // }
13
13
  const call = await this.fetchData();
14
- this.triggers.local(`in/voice/${call.id}/event`, async (event) => {
14
+ this.triggers.local(call.id, async (event) => {
15
15
  switch (event.params.type) {
16
16
  case 'hangup':
17
17
  await this.handleHangup(call);
package/dst/Choice.js CHANGED
@@ -93,7 +93,7 @@ class Choice extends voice_1.default {
93
93
  }
94
94
  };
95
95
  // There's a specific need to do so. There might be ${variable} section
96
- this.triggers.local(`in/voice/${call.id}/event`, async (event) => {
96
+ this.triggers.local(call.id, async (event) => {
97
97
  const reportingSettingsKey = this.rptsStarted ? 'transcriptRepromptResponse' : 'transcriptResponse';
98
98
  switch (event.params.type) {
99
99
  case 'digit':
@@ -232,7 +232,7 @@ class Choice extends voice_1.default {
232
232
  return await this.waitConvEnd();
233
233
  }
234
234
  case 'cancel': {
235
- return this.data.handleCancel === true && this.exitStep('cancel');
235
+ return this.handleCancel();
236
236
  }
237
237
  case 'error':
238
238
  return this.throwError(event.params.error);
@@ -7,7 +7,7 @@ class ConferenceDial extends voice_1.default {
7
7
  async runStep() {
8
8
  const call = await this.fetchData();
9
9
  this.triggers
10
- .local(`in/voice/${call.id}/event`, async (event) => {
10
+ .local(call.id, async (event) => {
11
11
  switch (event.params.type) {
12
12
  case 'hangup':
13
13
  await this.handleHangup(call);
@@ -84,7 +84,7 @@ class CustomVoiceInput extends voice_1.default {
84
84
  }
85
85
  };
86
86
  // There's a specific need to do so. There might be ${variable} section
87
- this.triggers.local(`in/voice/${call.id}/event`, async (event) => {
87
+ this.triggers.local(call.id, async (event) => {
88
88
  const reportingSettingsKey = this.rptsStarted ? 'transcriptRepromptResponse' : 'transcriptResponse';
89
89
  switch (event.params.type) {
90
90
  // digit recognition removed
@@ -178,7 +178,7 @@ class CustomVoiceInput extends voice_1.default {
178
178
  return await this.waitConvEnd();
179
179
  }
180
180
  case 'cancel': {
181
- return this.data.handleCancel === true && this.exitStep('cancel');
181
+ return this.handleCancel();
182
182
  }
183
183
  case 'error':
184
184
  return this.throwError(event.params.error);
@@ -71,7 +71,7 @@ class GlobalCommand extends voice_1.default {
71
71
  if (!this.thread.ending)
72
72
  this.end();
73
73
  });
74
- this.triggers.local(`in/voice/${call.id}/event`, async (event) => {
74
+ this.triggers.local(call.id, async (event) => {
75
75
  event.processed = undefined;
76
76
  switch (event.params.type) {
77
77
  case 'hangup': {
@@ -136,8 +136,7 @@ class GlobalCommand extends voice_1.default {
136
136
  }
137
137
  case 'cancel': {
138
138
  this.event.processed = true;
139
- this.end();
140
- break;
139
+ return this.handleCancel();
141
140
  }
142
141
  case 'background': {
143
142
  this.event.processed = true;
package/dst/Hangup.js CHANGED
@@ -5,7 +5,7 @@ const voice_1 = tslib_1.__importDefault(require("./voice"));
5
5
  class Hangup extends voice_1.default {
6
6
  async runStep() {
7
7
  const call = await this.fetchData();
8
- this.triggers.local(`in/voice/${call.id}/event`, async (event) => {
8
+ this.triggers.local(call.id, async (event) => {
9
9
  switch (event.params.type) {
10
10
  case 'hangup':
11
11
  await this.handleHangup(call);
@@ -13,7 +13,7 @@ class Hangup extends voice_1.default {
13
13
  case 'error':
14
14
  return this.throwError(event.params.error);
15
15
  case 'cancel': {
16
- return this.data.handleCancel === true && this.exitStep('cancel');
16
+ return this.handleCancel();
17
17
  }
18
18
  default:
19
19
  return this.exitFlow();
@@ -49,7 +49,7 @@ class InitiateCall extends voice_1.default {
49
49
  async waitForCall() {
50
50
  const { asr, tts, from: botNumber, endUserNumber, sipHost, sipUser, sipPassword, timeout, headers, enableSpoofCallerId, spoofCallerId, isAMD, otherCallRef, otherCallRefThread } = this.data;
51
51
  const call = await this.fetchData();
52
- this.triggers.local(`in/voice/${call.id}/event`, async (event) => {
52
+ this.triggers.once(`in/voice/${call.id}/event`, async (event) => {
53
53
  switch (event.params.type) {
54
54
  case 'is_flow_ready': {
55
55
  // TODO this.exitFlow({is_ready : true}) should be enough
@@ -7,7 +7,7 @@ class JoinConference extends voice_1.default {
7
7
  async runStep() {
8
8
  const call = await this.fetchData();
9
9
  const { conferenceName, stayInConference } = this.data;
10
- this.triggers.local(`in/voice/${call.id}/event`, async (event) => {
10
+ this.triggers.local(call.id, async (event) => {
11
11
  switch (event.params.type) {
12
12
  case 'hangup':
13
13
  await this.handleHangup(call);
@@ -66,7 +66,7 @@ class KeypadInput extends voice_1.default {
66
66
  }
67
67
  const repromptsList = this.buildReprompts({ prompts: this.data.prompts, allowKeypadBargeIn: keypadBargeIn });
68
68
  const speechSections = this.buildSections({ sections: this.data.audio, textType, ttsSettings, allowKeypadBargeIn: keypadBargeIn });
69
- this.triggers.local(`in/voice/${call.id}/event`, async (event) => {
69
+ this.triggers.local(call.id, async (event) => {
70
70
  const reportingSettingsKey = this.rptsStarted ? 'transcriptRepromptResponse' : 'transcriptResponse';
71
71
  switch (event.params.type) {
72
72
  case 'digits': {
@@ -149,7 +149,7 @@ class KeypadInput extends voice_1.default {
149
149
  return await this.waitConvEnd();
150
150
  }
151
151
  case 'cancel': {
152
- return this.data.handleCancel === true && this.exitStep('cancel');
152
+ return this.handleCancel();
153
153
  }
154
154
  case 'error':
155
155
  return this.throwError(event.params.error);
@@ -7,7 +7,7 @@ class KickFromConference extends voice_1.default {
7
7
  async runStep() {
8
8
  const call = await this.fetchData();
9
9
  const { room, user } = this.data;
10
- this.triggers.local(`in/voice/${call.id}/event`, async (event) => {
10
+ this.triggers.local(call.id, async (event) => {
11
11
  switch (event.params.type) {
12
12
  case 'hangup':
13
13
  await this.handleHangup(call);
@@ -8,7 +8,7 @@ class SayMessage extends voice_1.default {
8
8
  async runStep() {
9
9
  const { audio, textType, tts, sensitiveData } = this.data;
10
10
  const call = await this.fetchData();
11
- this.triggers.local(`in/voice/${call.id}/event`, async (event) => {
11
+ this.triggers.local(call.id, async (event) => {
12
12
  switch (event.params.type) {
13
13
  case 'hangup':
14
14
  await this.handleHangup(call);
@@ -19,7 +19,7 @@ class SayMessage extends voice_1.default {
19
19
  case 'error':
20
20
  return this.throwError(event.params.error);
21
21
  case 'cancel': {
22
- return this.data.handleCancel === true && this.exitStep('cancel');
22
+ return this.handleCancel();
23
23
  }
24
24
  default:
25
25
  return this.exitFlow();
@@ -46,7 +46,7 @@ class SendDTMF extends voice_1.default {
46
46
  afterDelay: +afterDelay
47
47
  }
48
48
  };
49
- this.triggers.local(`in/voice/${call.id}/event`, async (event) => {
49
+ this.triggers.local(call.id, async (event) => {
50
50
  // if (channel.callback.id)
51
51
  // await this.mergeFields[_conversation].set(
52
52
  // this.takeCallback(),
package/dst/Transfer.js CHANGED
@@ -6,7 +6,7 @@ const voice_1 = tslib_1.__importDefault(require("./voice"));
6
6
  class Transfer extends voice_1.default {
7
7
  async runStep() {
8
8
  const call = await this.fetchData();
9
- this.triggers.local(`in/voice/${call.id}/event`, async (event) => {
9
+ this.triggers.local(call.id, async (event) => {
10
10
  switch (event.params.type) {
11
11
  case 'bridge': {
12
12
  await this.transcript(call, {
@@ -23,7 +23,7 @@ class Recording extends voice_1.default {
23
23
  sections
24
24
  }
25
25
  };
26
- this.triggers.local(`in/voice/${call.id}/event`, async (event) => {
26
+ this.triggers.local(call.id, async (event) => {
27
27
  const url = event.params.mediaPath;
28
28
  switch (event.params.type) {
29
29
  case 'hangup':
package/dst/voice.d.ts CHANGED
@@ -47,6 +47,7 @@ export default class VoiceStep<TIn = unknown, TOut = unknown, TParams extends Vo
47
47
  runBefore(): Promise<void>;
48
48
  sendCommands({ id, type, callback }: IVoiceCall, commands: TODO[]): Promise<void>;
49
49
  handleHeartbeat(call: IVoiceCall): Promise<void>;
50
+ handleCancel(): void;
50
51
  extractSectionMessages(sections: IPromtpSection[]): string;
51
52
  extractSectionFiles(sections: IPromtpSection[]): Array<{
52
53
  fileUrl: string;
package/dst/voice.js CHANGED
@@ -65,6 +65,12 @@ class VoiceStep extends step_1.default {
65
65
  await this.updateData();
66
66
  }
67
67
  }
68
+ handleCancel() {
69
+ if (this.data.handleCancel === true)
70
+ this.exitStep('cancel');
71
+ else
72
+ this.end();
73
+ }
68
74
  extractSectionMessages(sections) {
69
75
  return lodash_1.default.chain(sections)
70
76
  .filter(s => Boolean(s.text))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/step-voice",
3
- "version": "5.0.9-fixsubflow.11",
3
+ "version": "5.0.9-fixsubflow.13",
4
4
  "author": "Roman Zolotarov <roman.zolotarov@onereach.com>",
5
5
  "contributors": [
6
6
  "Roman Zolotarov",