only resolve on barge in if final event

This commit is contained in:
akirilyuk
2022-02-03 22:07:47 +01:00
parent 22dad4eed6
commit f1c17e537d

View File

@@ -314,7 +314,7 @@ class TaskGather extends Task {
} }
if (evt.is_final) this._resolve('speech', evt); if (evt.is_final) this._resolve('speech', evt);
else { else {
if (this.bargein && evt.alternatives[0].transcript.split(' ').length >= this.minBargeinWordCount) { if (evt.is_final && this.bargein && evt.alternatives[0].transcript.split(' ').length >= this.minBargeinWordCount) {
this.logger.debug('Gather:_onTranscription - killing audio due to bargein'); this.logger.debug('Gather:_onTranscription - killing audio due to bargein');
this._killAudio(cs); this._killAudio(cs);
this._resolve('speech', evt); this._resolve('speech', evt);