mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +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.span = span;
|
||||||
this.sayTask.ctx = ctx;
|
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) => {
|
.catch((err) => {
|
||||||
process();
|
process();
|
||||||
});
|
});
|
||||||
if (this.sayTask.isStreamingTts && !this.sayTask.closeOnStreamEmpty) {
|
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
|
// if streaming tts, we do not wait for it to complete if it is not closing the stream automatically
|
||||||
process();
|
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) {
|
else if (this.playTask) {
|
||||||
@@ -306,15 +308,17 @@ class TaskGather extends SttTask {
|
|||||||
};
|
};
|
||||||
this.playTask.span = span;
|
this.playTask.span = span;
|
||||||
this.playTask.ctx = ctx;
|
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) => {
|
.catch((err) => {
|
||||||
process();
|
process();
|
||||||
});
|
});
|
||||||
this.playTask.on('playDone', (err) => {
|
|
||||||
span.end();
|
|
||||||
if (err) this.logger.error({err}, 'Gather:exec Error playing url');
|
|
||||||
process();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (this.killed) {
|
if (this.killed) {
|
||||||
@@ -882,12 +886,10 @@ class TaskGather extends SttTask {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.sayTask && !this.sayTask.killed) {
|
if (this.sayTask && !this.sayTask.killed) {
|
||||||
this.sayTask.removeAllListeners('playDone');
|
|
||||||
this.sayTask.kill(cs);
|
this.sayTask.kill(cs);
|
||||||
this.sayTask = null;
|
this.sayTask = null;
|
||||||
}
|
}
|
||||||
if (this.playTask && !this.playTask.killed) {
|
if (this.playTask && !this.playTask.killed) {
|
||||||
this.playTask.removeAllListeners('playDone');
|
|
||||||
this.playTask.kill(cs);
|
this.playTask.kill(cs);
|
||||||
this.playTask = null;
|
this.playTask = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,13 +120,11 @@ class TaskSay extends TtsTask {
|
|||||||
}
|
}
|
||||||
if (this.isStreamingTts) await this.handlingStreaming(cs, obj);
|
if (this.isStreamingTts) await this.handlingStreaming(cs, obj);
|
||||||
else await this.handling(cs, obj);
|
else await this.handling(cs, obj);
|
||||||
this.emit('playDone');
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof SpeechCredentialError) {
|
if (error instanceof SpeechCredentialError) {
|
||||||
// if say failed due to speech credentials, alarm is writtern and error notification is sent
|
// if say failed due to speech credentials, alarm is writtern and error notification is sent
|
||||||
// finished this say to move to next task.
|
// finished this say to move to next task.
|
||||||
this.logger.info({error}, 'Say failed due to SpeechCredentialError, finished!');
|
this.logger.info({error}, 'Say failed due to SpeechCredentialError, finished!');
|
||||||
this.emit('playDone');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
|
|||||||
Reference in New Issue
Block a user