mirror of
https://github.com/jambonz/sbc-inbound.git
synced 2025-12-19 04:37:43 +00:00
reject calls on hosted jambonz with no active subscriptions (#191)
This commit is contained in:
@@ -295,7 +295,6 @@ module.exports = function(srf, logger) {
|
||||
logger.debug(`checkLimits: call count is now ${calls}, limit is ${minLimit}`);
|
||||
if (calls <= minLimit) return next();
|
||||
|
||||
if (process.env.JAMBONES_HOSTING) {
|
||||
const accountCapacities = await lookupAccountCapacitiesBySid(account_sid);
|
||||
const accountLimit = accountCapacities.find((c) => c.category == 'voice_call_session');
|
||||
if (accountLimit) {
|
||||
@@ -314,7 +313,6 @@ module.exports = function(srf, logger) {
|
||||
return req.srf.endSession(req);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (trackingOn) {
|
||||
const {account_limit, sp_limit} = await queryCallLimits(service_provider_sid, account_sid);
|
||||
if (process.env.JAMBONES_TRACK_ACCOUNT_CALLS && account_limit > 0 && calls > account_limit) {
|
||||
@@ -333,6 +331,11 @@ module.exports = function(srf, logger) {
|
||||
});
|
||||
return req.srf.endSession(req);
|
||||
}
|
||||
if (!account_limit && !sp_limit && process.env.JAMBONES_HOSTING) {
|
||||
logger.info(`checkLimits: no active subscription found for account ${account_sid}, rejecting call`);
|
||||
res.send(503, 'No Active Subscription');
|
||||
return req.srf.endSession(req);
|
||||
}
|
||||
if (process.env.JAMBONES_TRACK_SP_CALLS && sp_limit > 0 && callsSP > sp_limit) {
|
||||
logger.info({callsSP, sp_limit}, 'checkLimits: service provider limits exceeded');
|
||||
writeAlerts({
|
||||
|
||||
14
package-lock.json
generated
14
package-lock.json
generated
@@ -11,7 +11,7 @@
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-auto-scaling": "^3.549.0",
|
||||
"@aws-sdk/client-sns": "^3.549.0",
|
||||
"@jambonz/db-helpers": "^0.9.7",
|
||||
"@jambonz/db-helpers": "^0.9.9",
|
||||
"@jambonz/digest-utils": "^0.0.5",
|
||||
"@jambonz/http-health-check": "^0.0.1",
|
||||
"@jambonz/realtimedb-helpers": "^0.8.8",
|
||||
@@ -1410,9 +1410,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@jambonz/db-helpers": {
|
||||
"version": "0.9.7",
|
||||
"resolved": "https://registry.npmjs.org/@jambonz/db-helpers/-/db-helpers-0.9.7.tgz",
|
||||
"integrity": "sha512-5qN/CJZJXpbMkMn+8gFn8PpQ0ZImZxp1EjKyxLUlmMn+xgjeNb29c3pjeVt/6EQnBB65jAax6TNsVzVIfpvE2w==",
|
||||
"version": "0.9.9",
|
||||
"resolved": "https://registry.npmjs.org/@jambonz/db-helpers/-/db-helpers-0.9.9.tgz",
|
||||
"integrity": "sha512-aUr7kq78NUiOg7/aqFW+KseHqwujtThaJHu7O1Bp5OznHLMDNFB8jJJDs3LGIqaRHEM/c4oaKtpKA4wahgP99w==",
|
||||
"dependencies": {
|
||||
"cidr-matcher": "^2.1.1",
|
||||
"debug": "^4.3.4",
|
||||
@@ -7907,9 +7907,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"@jambonz/db-helpers": {
|
||||
"version": "0.9.7",
|
||||
"resolved": "https://registry.npmjs.org/@jambonz/db-helpers/-/db-helpers-0.9.7.tgz",
|
||||
"integrity": "sha512-5qN/CJZJXpbMkMn+8gFn8PpQ0ZImZxp1EjKyxLUlmMn+xgjeNb29c3pjeVt/6EQnBB65jAax6TNsVzVIfpvE2w==",
|
||||
"version": "0.9.9",
|
||||
"resolved": "https://registry.npmjs.org/@jambonz/db-helpers/-/db-helpers-0.9.9.tgz",
|
||||
"integrity": "sha512-aUr7kq78NUiOg7/aqFW+KseHqwujtThaJHu7O1Bp5OznHLMDNFB8jJJDs3LGIqaRHEM/c4oaKtpKA4wahgP99w==",
|
||||
"requires": {
|
||||
"cidr-matcher": "^2.1.1",
|
||||
"debug": "^4.3.4",
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
"jslint:fix": "npm run jslint --fix"
|
||||
},
|
||||
"dependencies": {
|
||||
"@jambonz/db-helpers": "^0.9.7",
|
||||
"@jambonz/db-helpers": "^0.9.9",
|
||||
"@jambonz/http-health-check": "^0.0.1",
|
||||
"@jambonz/realtimedb-helpers": "^0.8.8",
|
||||
"@jambonz/rtpengine-utils": "^0.4.4",
|
||||
|
||||
Reference in New Issue
Block a user