mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
sending jambonz:error when the incoming message is not parsable (#1095)
* sending jambonz:error when the incoming message is not parsable https://github.com/jambonz/jambonz-feature-server/issues/1094 * writing an alert when incoming paylod is invalid * added content to the jambonz:error payload
This commit is contained in:
@@ -431,6 +431,21 @@ class WsRequestor extends BaseRequestor {
|
||||
}
|
||||
} catch (err) {
|
||||
this.logger.info({err, content}, 'WsRequestor:_onMessage - invalid incoming message');
|
||||
const params = {
|
||||
msg: 'InvalidMessage',
|
||||
details: err.message,
|
||||
content: Buffer.from(content).toString('utf-8')
|
||||
};
|
||||
const {writeAlerts, AlertType} = this.Alerter;
|
||||
writeAlerts({
|
||||
account_sid: this.account_sid,
|
||||
alert_type: AlertType.INVALID_APP_PAYLOAD,
|
||||
target_sid: this.call_sid,
|
||||
message: err.message,
|
||||
|
||||
}).catch((err) => this.logger.info({err}, 'Error generating alert for invalid message'));
|
||||
this.request('jambonz:error', '/error', params)
|
||||
.catch((err) => this.logger.debug({err}, 'WsRequestor:_onMessage - Error sending'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user