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,9 +60,19 @@ class TaskMessage extends Task {
|
||||
return res.sendStatus(404);
|
||||
}
|
||||
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');
|
||||
const response = await post(relativeUrl, payload);
|
||||
if (response.smpp_err_code) {
|
||||
this.logger.info({response}, 'Error sending SMS');
|
||||
if (cs.callInfo.res) {
|
||||
res.status(480).json({
|
||||
...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');
|
||||
@@ -71,6 +81,7 @@ class TaskMessage extends Task {
|
||||
providerResponse: response
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: action Hook
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user