diff --git a/lib/tasks/gather.js b/lib/tasks/gather.js index f3d40f84..75a55a23 100644 --- a/lib/tasks/gather.js +++ b/lib/tasks/gather.js @@ -25,6 +25,10 @@ class TaskGather extends Task { /* when collecting dtmf, bargein on dtmf is true unless explicitly set to false */ if (this.dtmfBargein !== false && this.input.includes('digits')) this.dtmfBargein = true; + this.listenDuringPrompt = this.data.listenDuringPrompt === false ? false : true; + this.minBargeinWordCount = this.data.minBargeinWordCount || 1; + + this.timeout = (this.timeout || 15) * 1000; this.interim = this.partialResultCallback; if (this.data.recognizer) { @@ -38,9 +42,6 @@ class TaskGather extends Task { const {enable, voiceMs = 0, mode = -1} = recognizer.vad || {}; this.vad = {enable, voiceMs, mode}; - this.listenDuringPrompt = this.data.listenDuringPrompt === false ? false : true; - this.minBargeinWordCount = this.data.minBargeinWordCount || 1; - /* aws options */ this.vocabularyName = recognizer.vocabularyName; this.vocabularyFilterName = recognizer.vocabularyFilterName; @@ -341,6 +342,7 @@ class TaskGather extends Task { evt.alternatives[0].transcript.split(' ').length >= this.minBargeinWordCount) { this.logger.debug('Gather:_onTranscription - killing audio due to speech bargein'); this._killAudio(cs); + this._resolve('speech', evt); } if (this.partialResultHook) { this.cs.requestor.request(this.partialResultHook, Object.assign({speech: evt}, this.cs.callInfo))