...
- Create a log activity to alert you when calls fail.
- Make an ICR on the destination extension and set it to hang up the call. This way you won't be billed for the test calls.
- Activate a Dial-IN Call Event on the extension and point it to http://<your_server_ip>/autodial.php
Create the autodial.php file as shown below. Mind the ownership and permissions.
Code Block -rwxr-xr-x. 1 voipnow voipnow 357 Jun 16 13:07 /usr/local/vipnow/admin/htdocs/autodial.php
This is the code that will be executed once your destination receives the autodialer call. It will save the contents of the Call Event request to autodial.log.
Code Block <?php // set file to write $file = 'autodial.log'; $somecontent = print_r($_GET, TRUE); echo $somecontent;// see sample output below // open file $fp = fopen($file, 'a') or die('Could not open file!'); // write to file fwrite($fp, "$somecontent") or die('Could not write to file'); // close file fclose($fp); ?>
Now create the autodial.log file as shown below. Again, mind the file ownership and permissions.
Code Block -rwxr-xr-x. 1 voipnow voipnow 10780 Jun 16 13:47 /usr/local/voipnow/admin/htdocs/autodial.log
The calls will be placed by this script (replace with your email address):
Code Block #!/bin/bash cp /tmp/autodial.call /var/spool/asterisk/outgoing/ CALLERID=`cat /tmp/autodial.call | grep CallerID | cut -d "<" -f2 | cut -d ">" -f1` NEWCALLERID="$((CALLERID + 1))" sed -i "s/$CALLERID/$NEWCALLERID/g" /tmp/autodial.call sleep 10 CALLOK=`cat /usr/local/voipnow/admin/htdocs/autodial.log | grep $CALLERID` if [ -z "$CALLOK" ]; then echo "Call with callerID $CALLERID failed." >> /usr/local/voipnow/admin/htdocs/autodial.log echo "Call with callerID $CALLERID failed." | /bin/mail -s "Failed autodial call" example@email.com else echo "Call with callerID $CALLERID was successful." >> /usr/local/voipnow/admin/htdocs/autodial.log fi
The flow
Here is how things should unfold.it goes:
→ The script moves the autodial.call file to the "outgoing" directory.
...
Content by Label | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
hidden | true |
---|
...
Except where otherwise noted, content in this space is licensed under a Creative Commons Attribution 4.0 International.