mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
fix error responses for sms
This commit is contained in:
@@ -60,16 +60,27 @@ class TaskMessage extends Task {
|
|||||||
return res.sendStatus(404);
|
return res.sendStatus(404);
|
||||||
}
|
}
|
||||||
if (url) {
|
if (url) {
|
||||||
const post = bent(url, 'POST', 'json', 201);
|
const post = bent(url, 'POST', 'json', 201, 480);
|
||||||
this.logger.info({payload, url}, 'Message:exec sending outbound SMS');
|
this.logger.info({payload, url}, 'Message:exec sending outbound SMS');
|
||||||
const response = await post(relativeUrl, payload);
|
const response = await post(relativeUrl, payload);
|
||||||
this.logger.info({response}, 'Successfully sent SMS');
|
if (response.smpp_err_code) {
|
||||||
if (cs.callInfo.res) {
|
this.logger.info({response}, 'Error sending SMS');
|
||||||
this.logger.info('Message:exec sending 200 OK response to HTTP POST from api server');
|
if (cs.callInfo.res) {
|
||||||
res.status(200).json({
|
res.status(480).json({
|
||||||
sid: cs.callInfo.messageSid,
|
...response,
|
||||||
providerResponse: response
|
sid: cs.callInfo.messageSid
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.logger.info({response}, 'Successfully sent SMS');
|
||||||
|
if (cs.callInfo.res) {
|
||||||
|
this.logger.info('Message:exec sending 200 OK response to HTTP POST from api server');
|
||||||
|
res.status(200).json({
|
||||||
|
sid: cs.callInfo.messageSid,
|
||||||
|
providerResponse: response
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: action Hook
|
// TODO: action Hook
|
||||||
|
|||||||
Reference in New Issue
Block a user