@onereach/step-voice 7.0.26-voicemaildetection.0 → 7.0.26

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.
@@ -23,7 +23,10 @@ interface INPUT {
23
23
  prompt?: string;
24
24
  }>;
25
25
  idle_goodbye_message: string;
26
- voicemail_detection_enabled: boolean;
26
+ dtmf_enabled: boolean;
27
+ dtmf_timeout: number | string;
28
+ dtmf_termination_digit: string;
29
+ dtmf_prefix: string;
27
30
  custom_config_enabled: boolean;
28
31
  agent_url_overwritten: boolean;
29
32
  agent_url: string;
@@ -24,18 +24,6 @@ class VoiceAgent extends voice_1.default {
24
24
  }
25
25
  return;
26
26
  }
27
- case 'voicemail_detected': {
28
- const exitId = this.getExitStepId('voicemail_detected');
29
- if (exitId) {
30
- return this.exitStep(exitId, {
31
- callId: call.id,
32
- callType: call.type,
33
- callCallback: call.callback,
34
- }, false);
35
- }
36
- this.log.warn('no exit for voicemail_detected');
37
- return;
38
- }
39
27
  case 'hangup':
40
28
  await this.handleHangup(call);
41
29
  return await this.waitConvEnd();
@@ -46,7 +34,7 @@ class VoiceAgent extends voice_1.default {
46
34
  }
47
35
  });
48
36
  this.triggers.otherwise(async () => {
49
- const { handlers = [], system_instruction = '', developer_messages = [], greeting_message = '', prevent_greeting_interruption = false, idle_detection_enabled = false, idle_timeout_secs = 8, idle_max_retries = 3, idle_prompts = [], idle_goodbye_message = '', voicemail_detection_enabled = false, custom_config_enabled = false, agent_url_overwritten = false, agent_url = '', mode = '', stt = {}, llm = {}, tts = {}, realtime = {} } = this.data;
37
+ const { handlers = [], system_instruction = '', developer_messages = [], greeting_message = '', prevent_greeting_interruption = false, idle_detection_enabled = false, idle_timeout_secs = 8, idle_max_retries = 3, idle_prompts = [], idle_goodbye_message = '', dtmf_enabled = false, dtmf_timeout = 2, dtmf_termination_digit = '#', dtmf_prefix = 'DTMF: ', custom_config_enabled = false, agent_url_overwritten = false, agent_url = '', mode = '', stt = {}, llm = {}, tts = {}, realtime = {} } = this.data;
50
38
  if (lodash_1.default.isEmpty(system_instruction)) {
51
39
  this.throwError(new Error('Voice Agent: system instruction is required'));
52
40
  }
@@ -81,12 +69,16 @@ class VoiceAgent extends voice_1.default {
81
69
  goodbye_message: lodash_1.default.isEmpty(lodash_1.default.trim(idle_goodbye_message)) ? undefined : idle_goodbye_message
82
70
  };
83
71
  }
84
- if (this.isStepFlagEnabled(voicemail_detection_enabled)) {
85
- if (this.isStepFlagEnabled(custom_config_enabled)
86
- && mode === "realtime" /* AgentPipelineMode.REALTIME */) {
87
- this.throwError(new Error('Voice Agent: voicemail detection requires waterfall mode (not compatible with realtime)'));
88
- }
89
- config.voicemail_detection = { enabled: true };
72
+ if (this.isStepFlagEnabled(dtmf_enabled)) {
73
+ const timeout = Number(dtmf_timeout);
74
+ const terminationDigit = String(dtmf_termination_digit || '#');
75
+ const prefix = dtmf_prefix == null || dtmf_prefix === '' ? 'DTMF: ' : String(dtmf_prefix);
76
+ config.dtmf = {
77
+ enabled: true,
78
+ timeout: Number.isFinite(timeout) ? timeout : 2,
79
+ termination_digit: terminationDigit,
80
+ prefix
81
+ };
90
82
  }
91
83
  let agentCustomUrl = '';
92
84
  if (this.isStepFlagEnabled(agent_url_overwritten)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/step-voice",
3
- "version": "7.0.26-voicemaildetection.0",
3
+ "version": "7.0.26",
4
4
  "author": "Roman Zolotarov <roman.zolotarov@onereach.com>",
5
5
  "contributors": [
6
6
  "Roman Zolotarov",