diff --git a/lib/tasks/gather.js b/lib/tasks/gather.js index a264842f..57ed8981 100644 --- a/lib/tasks/gather.js +++ b/lib/tasks/gather.js @@ -25,8 +25,7 @@ class TaskGather extends Task { this.minBargeinWordCount = this.data.minBargeinWordCount || 1; // this is specially for barge in where we want to make a bargebale promt // to a user without listening after the say task has finished - this.listenAfterSpeech = this.data.listenAfterSpeech === false; - this.timeout = (this.timeout || 15) * 1000; + this.timeout = this.data.listenAfterSpeech === false ? 0 : (this.timeout || 15) * 1000; this.interim = this.partialResultCallback || this.bargein; if (this.data.recognizer) { const recognizer = this.data.recognizer; @@ -105,13 +104,9 @@ class TaskGather extends Task { if (err) return this.logger.error({err}, 'Gather:exec Error playing tts'); this.logger.debug('Gather: say task completed'); if (!this.killed) { - if (this.listenAfterSpeech) { + startListening(cs, ep); - } else { - setTimeout(()=>{ - this.kill(cs); - },1000) - } + } }); }