Bwug
This commit is contained in:
parent
395373d27b
commit
4e8cd9c23f
21
index.js
21
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
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue