Vicidial Random Callerid
Topic:
How to set random callerid in vicidial
Asterisk dialplan to set random callerid
Asterisk AGI script to set random callerid
Overview : Why Random Caller ID ?
There are many reasons to set a Random callerid or auto rotate the callerid, the First Reason is The TrueCaller App in which a customer can mark a Callerid as SPAM which reflect to others who using the Same App which will pop up as spam before atteding the call,
Next Reason in Callcenters 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 Callerid 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
Option 1: Vicidial CID Groups
Option 2 : Asterisk RAND function
Synopsis:
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()
Option 3 : Using asterisk AGI script
This method can be used were you have numbers ie: not in range, numbers are placed in a txt file, from which a random number will be filtered and set as callerid.
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