mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-21 00:58:34 +00:00
gather is hang if listenDuringPrompt = false and say/play task throw exception (#717)
This commit is contained in:
@@ -187,12 +187,7 @@ class TaskGather extends SttTask {
|
|||||||
try {
|
try {
|
||||||
if (this.sayTask) {
|
if (this.sayTask) {
|
||||||
const {span, ctx} = this.startChildSpan(`nested:${this.sayTask.summary}`);
|
const {span, ctx} = this.startChildSpan(`nested:${this.sayTask.summary}`);
|
||||||
this.sayTask.span = span;
|
const process = () => {
|
||||||
this.sayTask.ctx = ctx;
|
|
||||||
this.sayTask.exec(cs, {ep}); // kicked off, _not_ waiting for it to complete
|
|
||||||
this.sayTask.on('playDone', (err) => {
|
|
||||||
span.end();
|
|
||||||
if (err) this.logger.error({err}, 'Gather:exec Error playing tts');
|
|
||||||
this.logger.debug('Gather: nested say task completed');
|
this.logger.debug('Gather: nested say task completed');
|
||||||
if (!this.killed) {
|
if (!this.killed) {
|
||||||
startListening(cs, ep);
|
startListening(cs, ep);
|
||||||
@@ -203,16 +198,22 @@ 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
|
||||||
|
.catch((err) => {
|
||||||
|
process();
|
||||||
|
});
|
||||||
|
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) {
|
||||||
const {span, ctx} = this.startChildSpan(`nested:${this.playTask.summary}`);
|
const {span, ctx} = this.startChildSpan(`nested:${this.playTask.summary}`);
|
||||||
this.playTask.span = span;
|
const process = () => {
|
||||||
this.playTask.ctx = ctx;
|
|
||||||
this.playTask.exec(cs, {ep}); // kicked off, _not_ waiting for it to complete
|
|
||||||
this.playTask.on('playDone', (err) => {
|
|
||||||
span.end();
|
|
||||||
if (err) this.logger.error({err}, 'Gather:exec Error playing url');
|
|
||||||
this.logger.debug('Gather: nested play task completed');
|
this.logger.debug('Gather: nested play task completed');
|
||||||
if (!this.killed) {
|
if (!this.killed) {
|
||||||
startListening(cs, ep);
|
startListening(cs, ep);
|
||||||
@@ -223,6 +224,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
|
||||||
|
.catch((err) => {
|
||||||
|
process();
|
||||||
|
});
|
||||||
|
this.playTask.on('playDone', (err) => {
|
||||||
|
span.end();
|
||||||
|
if (err) this.logger.error({err}, 'Gather:exec Error playing url');
|
||||||
|
process();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
Reference in New Issue
Block a user