@onereach/step-voice 4.0.31 → 4.0.32

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.
@@ -58,20 +58,6 @@ class GlobalCommand extends voice_1.default {
58
58
  const findExit = (exitId) => {
59
59
  return lodash_1.default.find(this.step.exits, (exit) => exitId === exit.stepId);
60
60
  };
61
- // if (channel.autoHangup) {
62
- // this.triggers.local('thread/end/main', async () => {
63
- // delete this.thread.waits['thread/end/main']
64
- // const channel = await this.fetchData()
65
- // if (!channel.hangup) {
66
- // channel.autoHangup = false
67
- // await this.updateData()
68
- // this.local.background = undefined
69
- // await this.sendCommands(channel, [{ name: 'hangup' }])
70
- // void this.process.main.enqueueAndRun({ name: 'ending' })
71
- // this.exitFlow()
72
- // }
73
- // })
74
- // }
75
61
  this.triggers.once(`in/voice/${channel.id}/event`, async (event) => {
76
62
  event.processed = undefined;
77
63
  switch (event.params.type) {
@@ -2,7 +2,6 @@ import VoiceStep, { CallStartEvent, TODO } from './voice';
2
2
  interface INPUT {
3
3
  channelId?: string;
4
4
  sessionTimeout?: number | string;
5
- autoHangup?: boolean;
6
5
  asr: TODO;
7
6
  tts: TODO;
8
7
  from: string;
@@ -36,7 +36,7 @@ class InitiateCall extends voice_1.default {
36
36
  this.gotoState('waitForCall');
37
37
  }
38
38
  async waitForCall() {
39
- const { autoHangup, asr, tts, from: botNumber, endUserNumber, sipHost, sipUser, sipPassword, timeout, headers, enableSpoofCallerId, spoofCallerId, isAMD } = this.data;
39
+ const { asr, tts, from: botNumber, endUserNumber, sipHost, sipUser, sipPassword, timeout, headers, enableSpoofCallerId, spoofCallerId, isAMD } = this.data;
40
40
  const { id: channelId } = await this.fetchData();
41
41
  this.triggers.once(`in/voice/${channelId}/event`, async (event) => {
42
42
  switch (event.params.type) {
@@ -57,7 +57,6 @@ class InitiateCall extends voice_1.default {
57
57
  const channel = {
58
58
  headers: event.params.headers,
59
59
  ...event.params.channel,
60
- autoHangup,
61
60
  asr: asr.getSettings(),
62
61
  tts: tts.getVoice(),
63
62
  botNumber: event.params.channel.to ?? 'unknown',
@@ -91,9 +90,6 @@ class InitiateCall extends voice_1.default {
91
90
  }]
92
91
  : []
93
92
  ]);
94
- if (this.data.autoHangup) {
95
- this.once('ending', this.autoHangup);
96
- }
97
93
  return this.exitStep('success');
98
94
  }
99
95
  case 'error': {
@@ -20,18 +20,12 @@ class WaitForCall extends voice_1.default {
20
20
  lodash_1.default.forEach(selectedNumbers, number => {
21
21
  this.triggers.on(`in/voice/${number.value}/call`, this.onCall);
22
22
  });
23
- if (this.data.autoHangup) {
24
- this.triggers.otherwise(() => {
25
- this.once('ending', this.autoHangup);
26
- });
27
- }
28
23
  }
29
24
  async onCall(event) {
30
- const { autoHangup, asr, tts, endOfInputTimeout } = this.data;
25
+ const { asr, tts, endOfInputTimeout } = this.data;
31
26
  const channel = {
32
27
  headers: event.params.headers,
33
28
  ...event.params.channel,
34
- autoHangup,
35
29
  asr: asr.getSettings(),
36
30
  tts: tts.getVoice(),
37
31
  botNumber: event.params.channel.to ?? 'unknown',
package/dst/voice.d.ts CHANGED
@@ -4,7 +4,6 @@ import BasicError from '@onereach/flow-sdk/dst/errors/base';
4
4
  export declare type TODO = any;
5
5
  export interface IVoiceChannel {
6
6
  id: string;
7
- autoHangup?: boolean;
8
7
  hangup: boolean;
9
8
  endUserNumber: string;
10
9
  botNumber: string;
@@ -46,7 +45,6 @@ export default class VoiceStep<TIn = unknown, TOut = unknown, TParams = VoiceEve
46
45
  message: string;
47
46
  }): never;
48
47
  handleHangup(channel: IVoiceChannel): Promise<void>;
49
- autoHangup(): Promise<void>;
50
48
  buildSections({ sections, textType, ttsSettings, allowKeypadBargeIn }: TODO): TODO;
51
49
  buildReprompts({ prompts, allowKeypadBargeIn }: TODO): TODO;
52
50
  buildChoices({ choices }: TODO): TODO;
package/dst/voice.js CHANGED
@@ -113,12 +113,6 @@ class VoiceStep extends step_1.default {
113
113
  channel.hangup = true;
114
114
  await this.updateData();
115
115
  }
116
- async autoHangup() {
117
- const channel = await this.fetchData();
118
- if (!channel.hangup) {
119
- await this.sendCommands(channel, [{ name: 'hangup', reason: 'AUTO' }]);
120
- }
121
- }
122
116
  buildSections({ sections, textType, ttsSettings, allowKeypadBargeIn }) {
123
117
  return lodash_1.default.map(sections, section => ({
124
118
  text: section.voiceTextMsg,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/step-voice",
3
- "version": "4.0.31",
3
+ "version": "4.0.32",
4
4
  "author": "Roman Zolotarov <roman.zolotarov@onereach.com>",
5
5
  "contributors": [
6
6
  "Roman Zolotarov",
@@ -75,4 +75,4 @@
75
75
  "node_modules"
76
76
  ]
77
77
  }
78
- }
78
+ }