add more logs

This commit is contained in:
akirilyuk
2022-02-03 18:37:14 +01:00
parent f8e88f085f
commit cc67132dfa
2 changed files with 17 additions and 10 deletions

View File

@@ -263,16 +263,16 @@ class Cognigy extends Task {
try { try {
// lets wait until we have finished processing the speech before // lets wait until we have finished processing the speech before
// starting a gather... // starting a gather...
this.logger.debug("enqueued bot final ping gather"); this.logger.debug('enqueued bot final ping gather');
this._enqueueTask(async() => { this._enqueueTask(async() => {
this.logger.debug("executing bot final ping gather"); this.logger.debug('executing bot final ping gather');
try { try {
const gatherTask = this._makeGatherTask(); const gatherTask = this._makeGatherTask();
await gatherTask.exec(cs, ep, this); await gatherTask.exec(cs, ep, this);
} catch (err) { } catch (err) {
this.logger.info({err}, 'Cognigy final ping gather task returned error'); this.logger.info({err}, 'Cognigy final ping gather task returned error');
} }
this.logger.debug("executed bot final ping gather"); this.logger.debug('executed bot final ping gather');
}); });
} catch (err) { } catch (err) {

View File

@@ -25,7 +25,8 @@ class TaskGather extends Task {
this.minBargeinWordCount = this.data.minBargeinWordCount || 1; this.minBargeinWordCount = this.data.minBargeinWordCount || 1;
// this is specially for barge in where we want to make a bargebale promt // this is specially for barge in where we want to make a bargebale promt
// to a user without listening after the say task has finished // to a user without listening after the say task has finished
this.timeout = this.data.listenAfterSpeech === false ? 1 : (this.timeout || 15) * 1000; this.listenAfterSpeech = this.data.listenAfterSpeech === false;
this.timeout = (this.timeout || 15) * 1000;
this.interim = this.partialResultCallback || this.bargein; this.interim = this.partialResultCallback || this.bargein;
if (this.data.recognizer) { if (this.data.recognizer) {
const recognizer = this.data.recognizer; const recognizer = this.data.recognizer;
@@ -99,15 +100,21 @@ class TaskGather extends Task {
try { try {
if (this.sayTask) { if (this.sayTask) {
this.logger.debug('Gather: kicking off say task'); this.logger.debug('Gather: kicking off say task');
this.sayTask.exec(cs, ep); // kicked off, _not_ waiting for it to complete this.sayTask.exec(cs, ep).then(() => {
this.logger.debug('Gather: completed say task promise');
if (!this.killed) {
if (this.listenAfterSpeech) {
startListening(cs, ep);
} else {
this.kill(cs);
}
}
return;
}).catch(err => this.logger.error({err}, 'Gather: failed to play say task')); // kicked off, _not_ waiting for it to complete
this.sayTask.on('playDone', async(err) => { this.sayTask.on('playDone', async(err) => {
if (err) return this.logger.error({err}, 'Gather:exec Error playing tts'); if (err) return this.logger.error({err}, 'Gather:exec Error playing tts');
this.logger.debug('Gather: say task completed'); this.logger.debug('Gather: say task completed');
if (!this.killed) {
startListening(cs, ep);
}
}); });
} }
else if (this.playTask) { else if (this.playTask) {