mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
fixed: should start transcription and timeout timer when listenDuringPrompt=true
This commit is contained in:
@@ -230,17 +230,17 @@ class TaskGather extends SttTask {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const startListening = async(cs, ep) => {
|
const startListening = async(cs, ep) => {
|
||||||
|
if (this.killed || this.resolved) {
|
||||||
|
this.logger.info('Gather:exec - task was quickly killed so do not transcribe');
|
||||||
|
return;
|
||||||
|
}
|
||||||
this._startTimer();
|
this._startTimer();
|
||||||
if (this.isContinuousAsr && 0 === this.timeout && !this.isBackgroundGather) {
|
if (this.isContinuousAsr && 0 === this.timeout && !this.isBackgroundGather) {
|
||||||
this._startAsrTimer();
|
this._startAsrTimer();
|
||||||
}
|
}
|
||||||
if (this.input.includes('speech') && !this.listenDuringPrompt) {
|
if (this.input.includes('speech')) {
|
||||||
try {
|
try {
|
||||||
await this._setSpeechHandlers(cs, ep);
|
await this._setSpeechHandlers(cs, ep);
|
||||||
if (this.killed) {
|
|
||||||
this.logger.info('Gather:exec - task was quickly killed so do not transcribe');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this._startTranscribing(ep);
|
this._startTranscribing(ep);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await this._startFallback(cs, ep, {error: e});
|
await this._startFallback(cs, ep, {error: e});
|
||||||
@@ -258,15 +258,15 @@ class TaskGather extends SttTask {
|
|||||||
startDtmfListener();
|
startDtmfListener();
|
||||||
}
|
}
|
||||||
this._stopVad();
|
this._stopVad();
|
||||||
if (!this.killed && !this.resolved) {
|
if (!this.killed && !this.resolved && !this.listenDuringPrompt) {
|
||||||
startListening(cs, ep);
|
startListening(cs, ep);
|
||||||
|
}
|
||||||
if (this.input.includes('speech') && this.vendor === 'nuance' && this.listenDuringPrompt) {
|
if (this.input.includes('speech') && this.vendor === 'nuance' && this.listenDuringPrompt) {
|
||||||
this.logger.debug('Gather:exec - starting transcription timers after say completes');
|
this.logger.debug('Gather:exec - starting transcription timers after say completes');
|
||||||
ep.startTranscriptionTimers((err) => {
|
ep.startTranscriptionTimers((err) => {
|
||||||
if (err) this.logger.error({err}, 'Gather:exec - error starting transcription timers');
|
if (err) this.logger.error({err}, 'Gather:exec - error starting transcription timers');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
this.sayTask.span = span;
|
this.sayTask.span = span;
|
||||||
this.sayTask.ctx = ctx;
|
this.sayTask.ctx = ctx;
|
||||||
@@ -296,15 +296,15 @@ class TaskGather extends SttTask {
|
|||||||
startDtmfListener();
|
startDtmfListener();
|
||||||
}
|
}
|
||||||
this._stopVad();
|
this._stopVad();
|
||||||
if (!this.killed && !this.resolved) {
|
if (!this.killed && !this.resolved && !this.listenDuringPrompt) {
|
||||||
startListening(cs, ep);
|
startListening(cs, ep);
|
||||||
|
}
|
||||||
if (this.input.includes('speech') && this.vendor === 'nuance' && this.listenDuringPrompt) {
|
if (this.input.includes('speech') && this.vendor === 'nuance' && this.listenDuringPrompt) {
|
||||||
this.logger.debug('Gather:exec - starting transcription timers after play completes');
|
this.logger.debug('Gather:exec - starting transcription timers after play completes');
|
||||||
ep.startTranscriptionTimers((err) => {
|
ep.startTranscriptionTimers((err) => {
|
||||||
if (err) this.logger.error({err}, 'Gather:exec - error starting transcription timers');
|
if (err) this.logger.error({err}, 'Gather:exec - error starting transcription timers');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
this.playTask.span = span;
|
this.playTask.span = span;
|
||||||
this.playTask.ctx = ctx;
|
this.playTask.ctx = ctx;
|
||||||
@@ -321,21 +321,12 @@ class TaskGather extends SttTask {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (this.killed) {
|
// listenDuringPrompt is set to false if there is no say or play task
|
||||||
this.logger.info('Gather:exec - task was immediately killed so do not transcribe');
|
await startListening(cs, ep);
|
||||||
return;
|
|
||||||
}
|
|
||||||
startListening(cs, ep);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.input.includes('speech') && this.listenDuringPrompt) {
|
if (this.listenDuringPrompt) {
|
||||||
await this._setSpeechHandlers(cs, ep);
|
await startListening(cs, ep);
|
||||||
if (!this.resolved && !this.killed) {
|
|
||||||
this._startTranscribing(ep);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.logger.info('Gather:exec - task was killed or resolved quickly, not starting transcription');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://github.com/jambonz/jambonz-feature-server/issues/913
|
// https://github.com/jambonz/jambonz-feature-server/issues/913
|
||||||
|
|||||||
Reference in New Issue
Block a user