From 4e8cd9c23f4f2a01399178164a48d121388979d3 Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Tue, 28 Oct 2025 07:51:37 -0600 Subject: [PATCH] Bwug --- index.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 547302c..e960279 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,10 @@ +const blocked = [ + '0', + '0000', + '9998', + '9999' +]; + import dotenv from 'dotenv'; dotenv.config({ quiet: true }) import AMISocket from 'ami'; @@ -81,8 +88,20 @@ const main = () => { console.log(`Found ${respData.length} call forwards.`); for (let cf of respData) { console.log(`Extension ${cf.extension} has ${cfTypes[cf.type]} call forward to ${cf.target}`); + // Check if forward target is anything in the 700-800 range, or is a number in the blocked list + if ((cf.target >= 700 && cf.target < 800) || blocked.includes(cf.target)) { + // Violation. Remove call forward from db. + console.log(`---> Violation found on extension ${cf.extension}. Removing call forward to ${cf.target}`); + sock.send({ + action: 'DBDel', + family: cf.type, + key: cf.extension + }).then((resp) => { + console.log(`-----> Call forward removed successfully.`); + hook.send(`:no_entry: **Call Forward Removed** :no_entry:\nExtension **${cf.extension}** had a **${cfTypes[cf.type]}** call forward to **${cf.target}** The call forward has been removed.`); + }) } - setTimeout(main, 60000); // Repeat every 60 seconds + setTimeout(main, 1000); // Repeat every 60 seconds }); }); }); @@ -98,4 +117,4 @@ const startup = async () => { }); } -startup(); \ No newline at end of file +startup(); \ No newline at end of file