From 65c241bcd1bca6fb5546def2d3ae5fb686de1138 Mon Sep 17 00:00:00 2001 From: Hoan Luu Huu <110280845+xquanluu@users.noreply.github.com> Date: Sun, 24 Mar 2024 03:01:41 +0700 Subject: [PATCH] gather verb should clean dtmf listerner even dtmfBargein=false (#686) --- lib/tasks/gather.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/tasks/gather.js b/lib/tasks/gather.js index befd0bba..0a52266a 100644 --- a/lib/tasks/gather.js +++ b/lib/tasks/gather.js @@ -965,10 +965,8 @@ class TaskGather extends SttTask { // If bargin is false and ws application return ack to verb:hook // the gather should not play any audio this._killAudio(this.cs); - // Clear dtmf event - if (this.dtmfBargein) { - this.ep.removeAllListeners('dtmf'); - } + // Clear dtmf events, to avoid any case can leak the listener, just clean it + this.ep.removeAllListeners('dtmf'); clearTimeout(this.interDigitTimer); this._clearTimer(); this._clearFastRecognitionTimer();