bugfix: gather catch errors when webhook fails

This commit is contained in:
Dave Horton
2022-04-24 13:45:29 -04:00
parent de9f2ce5ca
commit 85d86cfdc3

View File

@@ -462,27 +462,29 @@ class TaskGather extends Task {
return; return;
} }
if (reason.startsWith('dtmf')) { try {
if (this.parentTask) this.parentTask.emit('dtmf', evt); if (reason.startsWith('dtmf')) {
else { if (this.parentTask) this.parentTask.emit('dtmf', evt);
this.emit('dtmf', evt); else {
await this.performAction({digits: this.digitBuffer, reason: 'dtmfDetected'}); this.emit('dtmf', evt);
await this.performAction({digits: this.digitBuffer, reason: 'dtmfDetected'});
}
} }
} else if (reason.startsWith('speech')) {
else if (reason.startsWith('speech')) { if (this.parentTask) this.parentTask.emit('transcription', evt);
if (this.parentTask) this.parentTask.emit('transcription', evt); else {
else { this.emit('transcription', evt);
this.emit('transcription', evt); await this.performAction({speech: evt, reason: 'speechDetected'});
await this.performAction({speech: evt, reason: 'speechDetected'}); }
} }
} else if (reason.startsWith('timeout')) {
else if (reason.startsWith('timeout')) { if (this.parentTask) this.parentTask.emit('timeout', evt);
if (this.parentTask) this.parentTask.emit('timeout', evt); else {
else { this.emit('timeout', evt);
this.emit('timeout', evt); await this.performAction({reason: 'timeout'});
await this.performAction({reason: 'timeout'}); }
} }
} } catch (err) { /*already logged error*/ }
this.notifyTaskDone(); this.notifyTaskDone();
} }
} }