From 76ff1835a67806e69d0a286f1c2ec549bac54836 Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Wed, 11 May 2022 09:21:54 -0400 Subject: [PATCH] background gather listen only once for vad and other interrupt events --- lib/session/call-session.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/session/call-session.js b/lib/session/call-session.js index c3ec5b45..57eadc4f 100644 --- a/lib/session/call-session.js +++ b/lib/session/call-session.js @@ -239,10 +239,10 @@ class CallSession extends Emitter { const t = normalizeJambones(this.logger, [gather]); this.backgroundGatherTask = makeTask(this.logger, t[0]); this.backgroundGatherTask - .on('dtmf', this._clearTasks.bind(this)) - .on('vad', this._clearTasks.bind(this)) - .on('transcription', this._clearTasks.bind(this)) - .on('timeout', this._clearTasks.bind(this)); + .once('dtmf', this._clearTasks.bind(this)) + .once('vad', this._clearTasks.bind(this)) + .once('transcription', this._clearTasks.bind(this)) + .once('timeout', this._clearTasks.bind(this)); this.logger.info({gather}, 'CallSession:enableBotMode - starting background gather'); const resources = await this._evaluatePreconditions(this.backgroundGatherTask); const {span, ctx} = this.rootSpan.startChildSpan(`background-gather:${this.backgroundGatherTask.summary}`);