Skip to content

Commit

Permalink
log gather payload at info
Browse files Browse the repository at this point in the history
  • Loading branch information
davehorton committed Jan 14, 2025
1 parent 2bf4fb9 commit d484771
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lib/tasks/gather.js
Original file line number Diff line number Diff line change
Expand Up @@ -1137,35 +1137,42 @@ class TaskGather extends SttTask {
if (this.parentTask) this.parentTask.emit('dtmf', evt);
else {
this.emit('dtmf', evt);
returnedVerbs = await this.performAction({digits: this.digitBuffer, reason: 'dtmfDetected'});
const payload = {digits: this.digitBuffer, reason: 'dtmfDetected'};
this.logger.info({payload}, 'TaskGather:_resolve - sending dtmf event to app');
returnedVerbs = await this.performAction(payload);
}
}
else if (reason.startsWith('speech')) {
if (this.parentTask) this.parentTask.emit('transcription', evt);
else {
this.emit('transcription', evt);
this.logger.debug('TaskGather:_resolve - invoking performAction');
returnedVerbs = await this.performAction({speech: evt, reason: 'speechDetected'});
const payload = {speech: evt, reason: 'speechDetected'};
this.logger.info({payload}, 'TaskGather:_resolve - sending speech transcript to app');
returnedVerbs = await this.performAction(payload);
this.logger.debug({returnedVerbs}, 'TaskGather:_resolve - back from performAction');
}
}
else if (reason.startsWith('timeout')) {
if (this.parentTask) this.parentTask.emit('timeout', evt);
else {
this.emit('timeout', evt);
this.logger.info('TaskGather:_resolve - sending timeout event to app');
returnedVerbs = await this.performAction({reason: 'timeout'});
}
}
else if (reason.startsWith('stt-error')) {
if (this.parentTask) this.parentTask.emit('stt-error', evt);
else {
this.emit('stt-error', evt);
returnedVerbs = await this.performAction({reason: 'error', details: evt.error});
const payload = {reason: 'stt-error', details: evt.error};
this.logger.info({payload}, 'TaskGather:_resolve - sending stt-error event to app');
returnedVerbs = await this.performAction(payload);
}
} else if (reason.startsWith('stt-low-confidence')) {
if (this.parentTask) this.parentTask.emit('stt-low-confidence', evt);
else {
this.emit('stt-low-confidence', evt);
this.logger.info('TaskGather:_resolve - sending stt-low-confidence event to app');
returnedVerbs = await this.performAction({reason: 'stt-low-confidence'});
}
}
Expand Down

0 comments on commit d484771

Please sign in to comment.