mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
bugfix: azure stt - if we get no speech detected, listen again
This commit is contained in:
@@ -385,7 +385,7 @@ class TaskGather extends Task {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (evt.is_final) {
|
if (evt.is_final) {
|
||||||
if (evt.alternatives[0].transcript === '' && !this.callSession.callGonen && !this.killed) {
|
if (evt.alternatives[0].transcript === '' && !this.callSession.callGone && !this.killed) {
|
||||||
this.logger.info({evt}, 'TaskGather:_onTranscription - got empty transcript, listen again');
|
this.logger.info({evt}, 'TaskGather:_onTranscription - got empty transcript, listen again');
|
||||||
return this._startTranscribing(ep);
|
return this._startTranscribing(ep);
|
||||||
}
|
}
|
||||||
@@ -433,7 +433,10 @@ class TaskGather extends Task {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_onNoSpeechDetected(cs, ep) {
|
_onNoSpeechDetected(cs, ep) {
|
||||||
this._resolve('timeout');
|
if (!this.callSession.callGone && !this.killed) {
|
||||||
|
this.logger.debug('TaskGather:_onNoSpeechDetected - listen again');
|
||||||
|
return this._startTranscribing(ep);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async _resolve(reason, evt) {
|
async _resolve(reason, evt) {
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ class WsRequestor extends BaseRequestor {
|
|||||||
/* save the message info for reply */
|
/* save the message info for reply */
|
||||||
const startAt = process.hrtime();
|
const startAt = process.hrtime();
|
||||||
this.messagesInFlight.set(msgid, {
|
this.messagesInFlight.set(msgid, {
|
||||||
|
timer,
|
||||||
success: (response) => {
|
success: (response) => {
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
const rtt = this._roundTrip(startAt);
|
const rtt = this._roundTrip(startAt);
|
||||||
@@ -135,6 +136,8 @@ class WsRequestor extends BaseRequestor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const [msgid, obj] of this.messagesInFlight) {
|
for (const [msgid, obj] of this.messagesInFlight) {
|
||||||
|
const {timer} = obj;
|
||||||
|
clearTimeout(timer);
|
||||||
obj.failure(`abandoning msgid ${msgid} since we have closed the socket`);
|
obj.failure(`abandoning msgid ${msgid} since we have closed the socket`);
|
||||||
}
|
}
|
||||||
this.messagesInFlight.clear();
|
this.messagesInFlight.clear();
|
||||||
|
|||||||
Reference in New Issue
Block a user