Using AGI to implement White list phone numbers in VICIdial - Omid-Mohajerani/VICIdial GitHub Wiki
Related Video:
https://www.youtube.com/watch?v=8lM8AaTdJPU
REQUIREMENT:
If incoming call in VICIdial list let it connect to define INGROUP, else hangup the call.
SOLUTION:
Using AGI (Asterisk Gateway Interface) to query CALLERID in vicidial_list table in asterisk database and drop it if it not exists.
How to do it?
edit /etc/asterisk/extensions.conf
Change from:
[trunkinbound]
exten => _X.,1,AGI(agi-DID_route.agi)
exten => _X.,n,Hangup()
to:
[trunkinbound]
exten => _X.,1,AGI(/usr/src/agi-scripts/whitelist.php,${CALLERID(num)})
exten => _X.,n,AGI(agi-DID_route.agi)
exten => _X.,n,Hangup()
Create a folder for agi scripts
cd /usr/src/
mkdir agi-scripts
Copy agi scirpts in /usr/src/agi-scripts
wget -c https://raw.githubusercontent.com/Omid-Mohajerani/VICIdial/main/agi-scripts/phpagi-asmanager.php
wget -c https://raw.githubusercontent.com/Omid-Mohajerani/VICIdial/main/agi-scripts/phpagi.php
wget -c https://raw.githubusercontent.com/Omid-Mohajerani/VICIdial/main/agi-scripts/whitelist.php
Give execute permission to the scripts
chmod -R 755 /usr/src/agi-scripts/*.php
Reload asterisk DialPlan
asterisk -rx "dialplan reload"
WARNING
- - If you have huge list of numbers in your VICIdial lists it will add a delay for incoming calls.
- Because it wants to search in database to check if the CALLERID exists or not.