How to set random callerid in vicidial and asterisk
Topic: Vicidial Random caller ID or CID Groups
If you are using Vicidial or any other Asterisk based dialer and you are looking for the option how to set random caller ID in round robin or random, then this post is for you. In this Article I have provided the options to set the random caller-id either using the Asterisk Dialplan or Asterisk AGI script or using the Vicidial Cid Groups
How to add Random Caller ID in vicidial |
Why Random Caller ID?
There are couple of reasons to set a Random caller-id or auto rotate the caller-id, the First Reason is The TrueCaller App in which a customer can mark a Caller-id as SPAM which reflect to others who using the Same App which will pop up as spam before attending the call,
Next Reason in Call centers they need to Call leads multiple times throughout the day without using the same number every time
Next Reason some times the telco blocks the calls received from same callerid over a short period of time.
Vicidial Random Caller-id Options
Vicidial is an enterprise class, open source, contact center suite in use by many large call centers around the world. VICIdial has a full featured predictive dialer. It is capable of inbound, outbound, and blended phone call handling.
In Vicidial the Random callerid can be achived using the follwing options
1. Vicidial CID Group settings
2. Asterisk Dialplan with Rand Function
3. Asterisk AGI script and text file with list of numbers
Vicidial CID Groups
Enable CID Groups and Campaign Areacode CID :1
CID Group ID: 10001CID Group Note: Random calleridCID Group Type: NONEAdmin User Group: All Admin User GroupsSubmit
Asterisk RAND function
RAND Function can be used in a scenario , if you have a range of DID's like 40004001 to 40004999
pick any one number randomly within this range and set it has callerid.
Before entering the Dialplan , let me explain little bit about RAND function
Choose a random number within a range
Description:
RAND(min,max)
choose a random number between min and max , min default to 0 if not specified, while max may be upto 2147483647
Lets get in to dialplan
For eg: consider the DID range as 40004001 to 40004999
those who use plain asterisk setup use the below dialplan
exten => _9X.,1,Set(CALLERID(num)=${RAND(40004001,40004999)})
exten => _9X.,2,Dial(SIP/VOIPTRUNK/${EXTEN:1})
exten => _9X.,3,Hangup()
Note:
for vicidail /goautodial you have to use below dialplan
exten => _9X.,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _9X.,2,Set(CALLERID(num)=${RAND(40004001,40004999)})
exten => _9X.,3,Dial(SIP/VOIPTRUNK/${EXTEN:1},,Tto)
exten => _9X.,4,Hangup()
Random Callerid with asterisk AGI script
This method can be used were you have numbers that is not in range, numbers are placed in a txt file, from which a random number will be filtered and set as caller-id.
note: you must have PHPAgi installed in your pbx server under agi directory
phpagi download link
https://sourceforge.net/projects/phpagi/files/
a. Download the PhpAgi from above link to your windows desktop
b. Use winscp Copy the file to /var/lib/asterisk/agi-bin directory.
c. use putty to login to linux /asterisk server
d . cd /var/lib/asterisk/agi-bin/
e. tar -xvzf phpagi-2.20.tgz
f. chmod -R 777 phpagi-2.20
g. create a file named randomcid.php under /var/lib/asterisk/agi-bin
cd /var/lib/asterisk/agi-bin
vi randomcid.php
2. copy the below script and paste in randomcid.php
#!/usr/bin/php
<?php
include 'phpagi-2.20/phpagi.php';
$agi = new AGI();
$numbers = file('/var/lib/asterisk/agi-bin/cids-list.txt');
$cid = array_rand($numbers, 1);
//return trim($numbers[$cid[0]]);
$newCID = trim($numbers[$cid]);
//echo $newCID;
$agi->set_variable("CALLERID(num)", $newCID);
?>
3. create a file named cids-list.txt under /var/lib/asteisk/agi-bin
and fill you numbers in a single column
vi /var/lib/asterisk/agi-bin/cids-list.txt
4. now we will write a dialplan with AGI function
exten => _9X.,4,Hangup
How to set Random Callerid in asterisk(vicidial goautodial freepbx)
I have cluster setup so where this needs to be done? In every Asterisk server or Web Server?
yes every asterisk server which used to dialout via carrier
This comment has been removed by the author.
This comment has been removed by the author.