mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-19 04:17:44 +00:00
fixed gather does not start timeout on bargin (#1421)
* fixed gather does not start timeout on bargin * with previous change, no need to emit playDone since no where in the code are we listening for it --------- Co-authored-by: Dave Horton <daveh@beachdognet.com>
This commit is contained in:
@@ -270,19 +270,21 @@ class TaskGather extends SttTask {
|
||||
};
|
||||
this.sayTask.span = span;
|
||||
this.sayTask.ctx = ctx;
|
||||
this.sayTask.exec(cs, {ep}) // kicked off, _not_ waiting for it to complete
|
||||
this.sayTask
|
||||
.exec(cs, {ep}) // kicked off, _not_ waiting for it to complete
|
||||
.then(() => {
|
||||
if (this.sayTask.isStreamingTts) return;
|
||||
this.logger.debug('Gather:exec - nested say task completed');
|
||||
span.end();
|
||||
process();
|
||||
return;
|
||||
})
|
||||
.catch((err) => {
|
||||
process();
|
||||
});
|
||||
if (this.sayTask.isStreamingTts && !this.sayTask.closeOnStreamEmpty) {
|
||||
// if streaming tts, we do not wait for it to complete if it is not closing the stream automatically
|
||||
process();
|
||||
} else {
|
||||
this.sayTask.on('playDone', (err) => {
|
||||
span.end();
|
||||
if (err) this.logger.error({err}, 'Gather:exec Error playing tts');
|
||||
process();
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (this.playTask) {
|
||||
@@ -306,15 +308,17 @@ class TaskGather extends SttTask {
|
||||
};
|
||||
this.playTask.span = span;
|
||||
this.playTask.ctx = ctx;
|
||||
this.playTask.exec(cs, {ep}) // kicked off, _not_ waiting for it to complete
|
||||
this.playTask
|
||||
.exec(cs, {ep}) // kicked off, _not_ waiting for it to complete
|
||||
.then(() => {
|
||||
this.logger.debug('Gather:exec - nested play task completed');
|
||||
span.end();
|
||||
process();
|
||||
return;
|
||||
})
|
||||
.catch((err) => {
|
||||
process();
|
||||
});
|
||||
this.playTask.on('playDone', (err) => {
|
||||
span.end();
|
||||
if (err) this.logger.error({err}, 'Gather:exec Error playing url');
|
||||
process();
|
||||
});
|
||||
}
|
||||
else {
|
||||
if (this.killed) {
|
||||
@@ -882,12 +886,10 @@ class TaskGather extends SttTask {
|
||||
return;
|
||||
}
|
||||
if (this.sayTask && !this.sayTask.killed) {
|
||||
this.sayTask.removeAllListeners('playDone');
|
||||
this.sayTask.kill(cs);
|
||||
this.sayTask = null;
|
||||
}
|
||||
if (this.playTask && !this.playTask.killed) {
|
||||
this.playTask.removeAllListeners('playDone');
|
||||
this.playTask.kill(cs);
|
||||
this.playTask = null;
|
||||
}
|
||||
|
||||
@@ -120,13 +120,11 @@ class TaskSay extends TtsTask {
|
||||
}
|
||||
if (this.isStreamingTts) await this.handlingStreaming(cs, obj);
|
||||
else await this.handling(cs, obj);
|
||||
this.emit('playDone');
|
||||
} catch (error) {
|
||||
if (error instanceof SpeechCredentialError) {
|
||||
// if say failed due to speech credentials, alarm is writtern and error notification is sent
|
||||
// finished this say to move to next task.
|
||||
this.logger.info({error}, 'Say failed due to SpeechCredentialError, finished!');
|
||||
this.emit('playDone');
|
||||
return;
|
||||
}
|
||||
throw error;
|
||||
|
||||
Reference in New Issue
Block a user