Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updated using 4PSA automated script

...

  1. Create a log activity to alert you when calls fail.
  2. 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.
  3. Activate a Dial-IN Call Event on the extension and point it to http://<your_server_ip>/autodial.php
  4. 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
  5. 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);
        ?>
  6. 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
  7. 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.

...

Except where otherwise noted, content in this space is licensed under a Creative Commons Attribution 4.0 International.