@onereach/step-voice 6.0.9 → 6.0.10

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.
@@ -47,7 +47,7 @@ class InitiateCall extends voice_1.default {
47
47
  this.exitStep('cancel');
48
48
  }
49
49
  async waitForCall() {
50
- const { asr, tts, from: botNumber, endUserNumber, sipHost, sipUser, sipPassword, timeout, headers, enableSpoofCallerId, spoofCallerId, isAMD, otherCallRef, otherCallRefThread } = this.data;
50
+ const { asr, tts, from: botNumber, endUserNumber, sipHost, sipUser, sipPassword, timeout, headers, enableSpoofCallerId, spoofCallerId, isAMD, otherCallRef, otherCallRefThread, handleCancel } = this.data;
51
51
  const call = await this.fetchData();
52
52
  this.triggers.once(`in/voice/${call.id}/event`, async (event) => {
53
53
  switch (event.params.type) {
@@ -106,8 +106,13 @@ class InitiateCall extends voice_1.default {
106
106
  }
107
107
  case 'hangup': {
108
108
  await this.handleHangup(call);
109
- this.end();
110
- break;
109
+ if (handleCancel && event.params.error?.name === 'CancelError') {
110
+ return this.exitStep('cancel');
111
+ }
112
+ return this.throwError(event.params.error ?? {
113
+ name: 'HangupError',
114
+ message: 'unpexpected hangup during init call'
115
+ });
111
116
  }
112
117
  case 'error': {
113
118
  const error = event.params.error;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/step-voice",
3
- "version": "6.0.9",
3
+ "version": "6.0.10",
4
4
  "author": "Roman Zolotarov <roman.zolotarov@onereach.com>",
5
5
  "contributors": [
6
6
  "Roman Zolotarov",