From c2a1819cbb0e14b5ec805c232f45a503d4a1eec3 Mon Sep 17 00:00:00 2001 From: rammohan-kore Date: Tue, 6 Aug 2024 19:04:15 +0530 Subject: [PATCH] feat/813 - notify speech-bargein-detected and dtmf-bargein-detected events (#823) * feat/813 - notify speech-bargein-detected and dtmf-bargein-detected events * fix for #826 race condition in say (#827) * fix for #826 race condition in say * wip * wip * wip * wip * wip * wip * wip * wip * Update transcription-utils.js (#802) * Check the confidence levels of a transcript with minConfidence (#808) * https://github.com/jambonz/jambonz-feature-server/issues/807 * feat/807: Using minConfidence from recognizer settings * feat/807: new reason stt-min-confidence-error * feat/807: sending stt-min-confidence instead of stt-min-confidence-error * feat/807: sending stt-low-confidence instead of stt-min-confidence-error * feat/807 - removed ? for this.data * fix conference end is not sent when moderator leave conference (#825) * fix conference end is not sent when moderator leave conference * wip * fix review comment * feat/813: checking for playComplete before sending dtmf-bargein-detected event * feat/813: added this.playComplete=true at the end of _killAudio method * feat/813: removed empty line * feat/813: removed nested if and added condition to main if * feat/813: notifyStatus called when not playComplete * feat/813: referring to time-series 0.2.9 version * feat/813: generated package-lock.json --------- Co-authored-by: Dave Horton Co-authored-by: Vinod Dharashive Co-authored-by: Hoan Luu Huu <110280845+xquanluu@users.noreply.github.com> --- lib/tasks/gather.js | 5 +++++ package-lock.json | 14 +++++++------- package.json | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/tasks/gather.js b/lib/tasks/gather.js index 28a2f77b..9061741e 100644 --- a/lib/tasks/gather.js +++ b/lib/tasks/gather.js @@ -322,6 +322,9 @@ class TaskGather extends SttTask { clearTimeout(this.interDigitTimer); let resolved = false; if (this.dtmfBargein) { + if (!this.playComplete) { + this.notifyStatus({event: 'dtmf-bargein-detected', ...evt}); + } this._killAudio(cs); this.emit('dtmf', evt); } @@ -700,6 +703,7 @@ class TaskGather extends SttTask { this.playTask.kill(cs); this.playTask = null; } + this.playComplete = true; } _onTranscription(cs, ep, evt, fsEvent) { @@ -863,6 +867,7 @@ class TaskGather extends SttTask { if (!this.playComplete) { this.logger.debug({transcript: evt.alternatives[0].transcript}, 'killing audio due to speech'); this.emit('vad'); + this.notifyStatus({event: 'speech-bargein-detected', ...evt}); } this._killAudio(cs); } diff --git a/package-lock.json b/package-lock.json index 4f8328d0..c6a3d543 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "@jambonz/realtimedb-helpers": "^0.8.8", "@jambonz/speech-utils": "^0.1.11", "@jambonz/stats-collector": "^0.1.10", - "@jambonz/time-series": "^0.2.8", + "@jambonz/time-series": "^0.2.9", "@jambonz/verb-specifications": "^0.0.74", "@opentelemetry/api": "^1.8.0", "@opentelemetry/exporter-jaeger": "^1.23.0", @@ -1565,9 +1565,9 @@ } }, "node_modules/@jambonz/time-series": { - "version": "0.2.8", - "resolved": "https://registry.npmjs.org/@jambonz/time-series/-/time-series-0.2.8.tgz", - "integrity": "sha512-iFSKPAEElb3NXVAKYlr+2Q08zNhv8SlsS4I1Bwg4gFIj4Tku0vHzoXk6WTCzMRY1hE4YbBPbImNYLW9BfzMJjw==", + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/@jambonz/time-series/-/time-series-0.2.9.tgz", + "integrity": "sha512-+/Oal0mjjV4iQ8q0ymtvVJP+GqgGpYUb2bc/FD/xDxOzKtl340l9yoM3oczREJg5IvEkpExz6NogJzUiCSeVnQ==", "dependencies": { "debug": "^4.3.1", "influx": "^5.9.3" @@ -10521,9 +10521,9 @@ } }, "@jambonz/time-series": { - "version": "0.2.8", - "resolved": "https://registry.npmjs.org/@jambonz/time-series/-/time-series-0.2.8.tgz", - "integrity": "sha512-iFSKPAEElb3NXVAKYlr+2Q08zNhv8SlsS4I1Bwg4gFIj4Tku0vHzoXk6WTCzMRY1hE4YbBPbImNYLW9BfzMJjw==", + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/@jambonz/time-series/-/time-series-0.2.9.tgz", + "integrity": "sha512-+/Oal0mjjV4iQ8q0ymtvVJP+GqgGpYUb2bc/FD/xDxOzKtl340l9yoM3oczREJg5IvEkpExz6NogJzUiCSeVnQ==", "requires": { "debug": "^4.3.1", "influx": "^5.9.3" diff --git a/package.json b/package.json index fef7f078..fdfe480c 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "@jambonz/realtimedb-helpers": "^0.8.8", "@jambonz/speech-utils": "^0.1.11", "@jambonz/stats-collector": "^0.1.10", - "@jambonz/time-series": "^0.2.8", + "@jambonz/time-series": "^0.2.9", "@jambonz/verb-specifications": "^0.0.74", "@opentelemetry/api": "^1.8.0", "@opentelemetry/exporter-jaeger": "^1.23.0",