From 6960466afc90f82c8b825a4e318fda80681ff0e4 Mon Sep 17 00:00:00 2001 From: akirilyuk Date: Thu, 3 Feb 2022 22:12:47 +0100 Subject: [PATCH] use stability for bargein feature --- lib/tasks/gather.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) 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);