@onereach/step-voice 7.0.25 → 7.0.26-VOIC1686.0

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,6 +23,10 @@ interface INPUT {
23
23
  prompt?: string;
24
24
  }>;
25
25
  idle_goodbye_message: string;
26
+ dtmf_enabled: boolean;
27
+ dtmf_timeout: number | string;
28
+ dtmf_termination_digit: string;
29
+ dtmf_prefix: string;
26
30
  custom_config_enabled: boolean;
27
31
  agent_url_overwritten: boolean;
28
32
  agent_url: string;
@@ -34,7 +34,7 @@ class VoiceAgent extends voice_1.default {
34
34
  }
35
35
  });
36
36
  this.triggers.otherwise(async () => {
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 = '', 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;
38
38
  if (lodash_1.default.isEmpty(system_instruction)) {
39
39
  this.throwError(new Error('Voice Agent: system instruction is required'));
40
40
  }
@@ -69,6 +69,17 @@ class VoiceAgent extends voice_1.default {
69
69
  goodbye_message: lodash_1.default.isEmpty(lodash_1.default.trim(idle_goodbye_message)) ? undefined : idle_goodbye_message
70
70
  };
71
71
  }
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
+ };
82
+ }
72
83
  let agentCustomUrl = '';
73
84
  if (this.isStepFlagEnabled(agent_url_overwritten)) {
74
85
  if (!this.isValidAgentUrl(agent_url)) {
package/dst/voice.d.ts CHANGED
@@ -33,7 +33,7 @@ export interface IVoiceCall extends IConversationData {
33
33
  user: string;
34
34
  };
35
35
  }
36
- export type EventType = 'hangup' | 'ack' | 'error' | 'cancel' | 'background' | 'avm-detected' | 'recognition' | 'digit' | 'digits' | 'conference-start' | 'conference-end' | 'playback' | 'timeout' | 'record' | 'bridge' | 'bridge/ended' | 'is_flow_ready' | 'call' | 'dtmf-sent';
36
+ export type EventType = 'hangup' | 'ack' | 'error' | 'cancel' | 'background' | 'avm-detected' | 'recognition' | 'digit' | 'digits' | 'conference-start' | 'conference-end' | 'playback' | 'timeout' | 'record' | 'bridge' | 'bridge/ended' | 'is_flow_ready' | 'call' | 'dtmf-sent' | 'function_call' | 'agent/started' | 'agent/stopped';
37
37
  export declare class VoiceStepError extends BasicError {
38
38
  }
39
39
  export type VoicerError = Error & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/step-voice",
3
- "version": "7.0.25",
3
+ "version": "7.0.26-VOIC1686.0",
4
4
  "author": "Roman Zolotarov <roman.zolotarov@onereach.com>",
5
5
  "contributors": [
6
6
  "Roman Zolotarov",