Merge dev to main #1

Merged
ChrisChrome merged 20 commits from dev into main 2025-10-28 07:58:47 -06:00
Showing only changes of commit 4e8cd9c23f - Show all commits

View file

@ -1,3 +1,10 @@
const blocked = [
'0',
'0000',
'9998',
'9999'
];
import dotenv from 'dotenv'; import dotenv from 'dotenv';
dotenv.config({ quiet: true }) dotenv.config({ quiet: true })
import AMISocket from 'ami'; import AMISocket from 'ami';
@ -81,8 +88,20 @@ const main = () => {
console.log(`Found ${respData.length} call forwards.`); console.log(`Found ${respData.length} call forwards.`);
for (let cf of respData) { for (let cf of respData) {
console.log(`Extension ${cf.extension} has ${cfTypes[cf.type]} call forward to ${cf.target}`); 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
}); });
}); });
}); });