Skip to content

Commit 58d01f0

Browse files
authored
feat: return feature_codes in REST API (#340)
1 parent cac0f8f commit 58d01f0

4 files changed

Lines changed: 33 additions & 5 deletions

File tree

root/usr/lib/node/nethcti-server/package-lock.json

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

root/usr/lib/node/nethcti-server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "NethCti Server",
55
"main": "nethcti.js",
66
"dependencies": {
7-
"@nethesis/astproxy": "^0.0.34",
7+
"@nethesis/astproxy": "^0.0.35",
88
"architect": "0.1.11",
99
"asterisk-ami": "0.2.0-beta1",
1010
"ejs": "2.5.6",

root/usr/lib/node/nethcti-server/plugins/astproxy/arch_astproxy.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,7 @@ module.exports = function(options, imports, register) {
652652
pickupQueueWaitingCaller: astProxy.proxyLogic.pickupQueueWaitingCaller,
653653
getEchoCallDestination: astProxy.proxyLogic.getEchoCallDestination,
654654
getConfBridgeConfCode: astProxy.proxyLogic.getConfBridgeConfCode,
655+
getFeatureCodes: astProxy.proxyLogic.getFeatureCodes,
655656
isPinEnabledAtLeastOneRoute: isPinEnabledAtLeastOneRoute,
656657
getUserExtenIdFromConf: astProxy.proxyLogic.getUserExtenIdFromConf,
657658
unmuteUserConfBridgeConf: astProxy.proxyLogic.unmuteUserConfBridgeConf,

root/usr/lib/node/nethcti-server/plugins/com_astproxy_rest/plugins_rest/astproxy.js

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1385,7 +1385,8 @@ var compConfigManager;
13851385
'opdata',
13861386
'qalarms',
13871387
'pin',
1388-
'pinstatus'
1388+
'pinstatus',
1389+
'feature_codes'
13891390
],
13901391

13911392
/**
@@ -2255,6 +2256,30 @@ var compConfigManager;
22552256
}
22562257
},
22572258

2259+
/**
2260+
* Gets the asterisk feature codes with the following REST API:
2261+
*
2262+
* GET feature_codes
2263+
*
2264+
* @method feature_codes
2265+
* @param {object} req The client request
2266+
* @param {object} res The client response
2267+
* @param {function} next Function to run the next handler in the chain
2268+
*/
2269+
feature_codes: function (req, res, next) {
2270+
try {
2271+
var username = req.headers.authorization_user;
2272+
var featureCodes = compAstProxy.getFeatureCodes();
2273+
2274+
logger.log.info(IDLOG, 'sent feature codes to user "' + username + '" ' + res.connection.remoteAddress);
2275+
res.send(200, featureCodes);
2276+
2277+
} catch (err) {
2278+
logger.log.error(IDLOG, err.stack);
2279+
compUtil.net.sendHttp500(IDLOG, res, err.toString());
2280+
}
2281+
},
2282+
22582283
/**
22592284
* Gets all the data needed by the operator panel with the following REST API:
22602285
*
@@ -5547,6 +5572,7 @@ var compConfigManager;
55475572
exports.op_wait_conv = astproxy.op_wait_conv;
55485573
exports.pin = astproxy.pin;
55495574
exports.pinstatus = astproxy.pinstatus;
5575+
exports.feature_codes = astproxy.feature_codes;
55505576
exports.queue_recall = astproxy.queue_recall;
55515577
exports.qmanager_queue_recall = astproxy.qmanager_queue_recall;
55525578
exports.qrecall_info = astproxy.qrecall_info;

0 commit comments

Comments
 (0)