From 7bbfc01cb00a97539d5af62280c2d90504e4c08f Mon Sep 17 00:00:00 2001 From: rammohan-y <37395033+rammohan-y@users.noreply.github.com> Date: Tue, 17 Sep 2024 22:56:29 +0530 Subject: [PATCH] feat/864: enable bargeIn when minBargeinWordCount is 0 (#900) * feat/864: checking for undefined, because 0 is a valid value for minBargeinWordCount * feat/864: checking for undefined and null * feat/864: corrected spelling of mode and added check for undefined as 0 is a valid value for vad.mode --- lib/tasks/config.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/tasks/config.js b/lib/tasks/config.js index 0addfcc8..7efc2c20 100644 --- a/lib/tasks/config.js +++ b/lib/tasks/config.js @@ -34,7 +34,8 @@ class TaskConfig extends Task { 'finishOnKey', 'input', 'numDigits', 'minDigits', 'maxDigits', 'interDigitTimeout', 'bargein', 'dtmfBargein', 'minBargeinWordCount', 'actionHook' ].forEach((k) => { - if (this.bargeIn[k]) this.gatherOpts[k] = this.bargeIn[k]; + const val = this.bargeIn[k]; + if (val !== undefined && val !== null) this.gatherOpts[k] = val; }); } if (this.transcribe?.enable) { @@ -295,7 +296,7 @@ class TaskConfig extends Task { voiceMs: this.vad.voiceMs || 250, silenceMs: this.vad.silenceMs || 150, strategy: this.vad.strategy || 'one-shot', - mode: this.vad.mod || 2 + mode: (this.vad.mode !== undefined && this.vad.mode !== null) ? this.vad.mode : 2 }; } }