@onereach/step-voice 7.0.36 → 7.0.38

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.
@@ -17,7 +17,7 @@ class VoiceAgentToolResult extends voice_1.default {
17
17
  result,
18
18
  options: { stop: stopAgent }
19
19
  };
20
- await this.thread.eventManager.emit({
20
+ const ackResult = await this.thread.eventManager.emit({
21
21
  target: this.helpers.providersAccountId,
22
22
  name: 'out/voice/voicer',
23
23
  params: {
@@ -29,6 +29,13 @@ class VoiceAgentToolResult extends voice_1.default {
29
29
  invocationType: 'async',
30
30
  timeout: 5000
31
31
  });
32
+ if (ackResult == null) {
33
+ const error = new Error(`failed to send tool result to call: ${callId}`);
34
+ const errorExitId = this.getExitStepId('error');
35
+ if (errorExitId)
36
+ return this.exitStep(errorExitId, { error });
37
+ return this.throwError(error);
38
+ }
32
39
  this.exitStep('next');
33
40
  }
34
41
  }
@@ -32,11 +32,21 @@ class VoiceAgent extends voice_1.default {
32
32
  }
33
33
  return;
34
34
  }
35
- case 'hangup':
35
+ case 'hangup': {
36
+ delete this.waits.timeout;
36
37
  await this.handleHangup(call);
38
+ const exitId = this.getExitStepId('next');
39
+ if (exitId)
40
+ return this.exitStep(exitId);
37
41
  return await this.waitConvEnd();
38
- case 'error':
42
+ }
43
+ case 'error': {
44
+ delete this.waits.timeout;
45
+ const exitId = this.getExitStepId('error');
46
+ if (exitId)
47
+ return this.exitStep(exitId, { error: event.params.error });
39
48
  return this.throwError(event.params.error);
49
+ }
40
50
  case 'cancel':
41
51
  return this.end();
42
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/step-voice",
3
- "version": "7.0.36",
3
+ "version": "7.0.38",
4
4
  "author": "Roman Zolotarov <roman.zolotarov@onereach.com>",
5
5
  "contributors": [
6
6
  "Roman Zolotarov",