reject calls on hosted jambonz with no activ (#166)

e subscriptions
This commit is contained in:
Dave Horton
2025-02-19 13:04:44 -05:00
committed by GitHub
parent 9feb6f3c8f
commit 7380457b5a
3 changed files with 10 additions and 5 deletions

View File

@@ -174,6 +174,11 @@ module.exports = (srf, logger, redisClient) => {
}); });
return req.srf.endSession(req); 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) { if (process.env.JAMBONES_TRACK_SP_CALLS && sp_limit > 0 && callsSP > sp_limit) {
logger.info({callsSP, sp_limit}, 'checkLimits: service provider limits exceeded'); logger.info({callsSP, sp_limit}, 'checkLimits: service provider limits exceeded');
writeAlerts({ writeAlerts({

8
package-lock.json generated
View File

@@ -9,7 +9,7 @@
"version": "0.9.3", "version": "0.9.3",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@jambonz/db-helpers": "^0.9.7", "@jambonz/db-helpers": "^0.9.9",
"@jambonz/http-health-check": "^0.0.1", "@jambonz/http-health-check": "^0.0.1",
"@jambonz/mw-registrar": "0.2.7", "@jambonz/mw-registrar": "0.2.7",
"@jambonz/realtimedb-helpers": "^0.8.9", "@jambonz/realtimedb-helpers": "^0.8.9",
@@ -578,9 +578,9 @@
} }
}, },
"node_modules/@jambonz/db-helpers": { "node_modules/@jambonz/db-helpers": {
"version": "0.9.7", "version": "0.9.9",
"resolved": "https://registry.npmjs.org/@jambonz/db-helpers/-/db-helpers-0.9.7.tgz", "resolved": "https://registry.npmjs.org/@jambonz/db-helpers/-/db-helpers-0.9.9.tgz",
"integrity": "sha512-5qN/CJZJXpbMkMn+8gFn8PpQ0ZImZxp1EjKyxLUlmMn+xgjeNb29c3pjeVt/6EQnBB65jAax6TNsVzVIfpvE2w==", "integrity": "sha512-aUr7kq78NUiOg7/aqFW+KseHqwujtThaJHu7O1Bp5OznHLMDNFB8jJJDs3LGIqaRHEM/c4oaKtpKA4wahgP99w==",
"dependencies": { "dependencies": {
"cidr-matcher": "^2.1.1", "cidr-matcher": "^2.1.1",
"debug": "^4.3.4", "debug": "^4.3.4",

View File

@@ -27,7 +27,7 @@
"jslint": "eslint app.js lib --fix" "jslint": "eslint app.js lib --fix"
}, },
"dependencies": { "dependencies": {
"@jambonz/db-helpers": "^0.9.7", "@jambonz/db-helpers": "^0.9.9",
"@jambonz/realtimedb-helpers": "^0.8.9", "@jambonz/realtimedb-helpers": "^0.8.9",
"@jambonz/http-health-check": "^0.0.1", "@jambonz/http-health-check": "^0.0.1",
"@jambonz/mw-registrar": "0.2.7", "@jambonz/mw-registrar": "0.2.7",