diff --git a/lib/tasks/gather.js b/lib/tasks/gather.js index 68266bec..d915bd1b 100644 --- a/lib/tasks/gather.js +++ b/lib/tasks/gather.js @@ -111,7 +111,11 @@ 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) { - startListening(cs, ep); + if (this.listenAfterSpeech === true) { + startListening(cs, ep); + } else { + this.notifyTaskDone(); + } } }); } @@ -126,8 +130,13 @@ class TaskGather extends Task { this.playTask.on('playDone', async(err) => { if (err) return this.logger.error({err}, 'Gather:exec Error playing url'); if (!this.killed) { - startListening(cs, ep); - }} + if (this.listenAfterSpeech === true) { + startListening(cs, ep); + } else { + this.notifyTaskDone(); + } + } + } ); } else startListening(cs, ep);