fix wrong vad notification to background bargin (#781)

* fix wrong vad notification to background bargin

* wip

* wip

* reset bargeinHandled every on reset
This commit is contained in:
Hoan Luu Huu
2024-06-12 21:52:53 +07:00
committed by GitHub
parent 9969e39e7e
commit cafe149bdf

View File

@@ -117,6 +117,7 @@ class BackgroundTaskManager extends Emitter {
this._taskCompleted('bargeIn', task); this._taskCompleted('bargeIn', task);
if (task.sticky && !this.cs.callGone && !this.cs._stopping) { if (task.sticky && !this.cs.callGone && !this.cs._stopping) {
this.logger.info('BackgroundTaskManager:_initBargeIn: restarting background bargeIn'); this.logger.info('BackgroundTaskManager:_initBargeIn: restarting background bargeIn');
this._bargeInHandled = false;
this.newTask('bargeIn', opts, true); this.newTask('bargeIn', opts, true);
} }
return; return;
@@ -186,6 +187,8 @@ class BackgroundTaskManager extends Emitter {
} }
_bargeInTaskCompleted(evt) { _bargeInTaskCompleted(evt) {
if (this._bargeInHandled) return;
this._bargeInHandled = true;
this.logger.debug({evt}, this.logger.debug({evt},
'BackgroundTaskManager:_bargeInTaskCompleted on event from background bargeIn, emitting bargein-done event'); 'BackgroundTaskManager:_bargeInTaskCompleted on event from background bargeIn, emitting bargein-done event');
this.emit('bargeIn-done', evt); this.emit('bargeIn-done', evt);