From b9ef00dfc7454681c52291aa2485356e8e9ba869 Mon Sep 17 00:00:00 2001 From: Hoan Luu Huu <110280845+xquanluu@users.noreply.github.com> Date: Mon, 30 Sep 2024 18:46:21 +0700 Subject: [PATCH] Fixed Gather digits does not work without nested say/play (#914) * Fixed Gather digits does not work without nested say/play * fix review comment * add assert to make sure we don't register dtmf twice in gather verb --- lib/tasks/gather.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/tasks/gather.js b/lib/tasks/gather.js index 1224722a..ee219803 100644 --- a/lib/tasks/gather.js +++ b/lib/tasks/gather.js @@ -177,8 +177,10 @@ class TaskGather extends SttTask { this._startVad(); const startDtmfListener = () => { + assert(!this._dtmfListenerStarted); if (this.input.includes('digits') || this.dtmfBargein || this.asrDtmfTerminationDigit) { ep.on('dtmf', this._onDtmf.bind(this, cs, ep)); + this._dtmfListenerStarted = true; } }; @@ -281,7 +283,8 @@ class TaskGather extends SttTask { } } - if (this.listenDuringPrompt) { + // https://github.com/jambonz/jambonz-feature-server/issues/913 + if (this.listenDuringPrompt || (!this.sayTask && !this.playTask)) { startDtmfListener(); }