diff --git a/lib/tasks/gather.js b/lib/tasks/gather.js index 700a2533..ead87997 100644 --- a/lib/tasks/gather.js +++ b/lib/tasks/gather.js @@ -1424,7 +1424,26 @@ class TaskGather extends SttTask { returnedVerbs = await this.performAction({speech:evt, reason: 'stt-low-confidence', ...latencies}); } } - } catch (err) { /*already logged error*/ } + } catch (err) { + this.logger.info({err}, 'TaskGather:_resolve - error performing action'); + this.notifyError({msg: 'invalid actionHook response', details: err.message}); + const {writeAlerts, AlertType} = this.cs.srf.locals; + writeAlerts({ + account_sid: this.cs.accountSid, + alert_type: AlertType.INVALID_APP_PAYLOAD, + target_sid: this.cs.callSid, + message: `actionHook returned invalid verb syntax: ${err.message}` + }).catch((err) => this.logger.info({err}, 'TaskGather:_resolve - error generating alert')); + try { + const obj = Object.assign({}, this.cs.callInfo.toJSON(), { + error: 'invalid actionHook response', + reason: err.message + }); + await this.cs.notifier.request('call:status', this.cs.call_status_hook, obj); + } catch (statusErr) { + this.logger.info({statusErr}, 'TaskGather:_resolve - error sending statusHook'); + } + } // Gather got response from hook, cancel actionHookDelay processing if (this.cs.actionHookDelayProcessor) {