Posted on Friday, 9th July 2010 by Michael

Simple Asterisk Auto Dialer

What is it:

This simple shell script was created by Michael LaSalvia of Digital Offensive to auto dial numbers and plays back a message to the person that picks up the phone. This script will take a comma separated file (CSV) that is setup as follows:


And automate the dialing and playing of that sound / message. The sound can be in the standard gsm format or an mp3 file.  This is useful for automating phone campaigns or just having a good time messing with friends.

How it works:

This script takes advantage of the Asterisk outgoing spool directory. The script creates a “call” file using the variables that you provided in the csv file as well as the variables you set in the script. The file is then moved into the /var/sppol/asterisk/outgoing directory where asterisk will process the “call” file and place the call.

The CSV file:

The CSV file is setup with three columns number, sound and trunk_name

The telephone number must not contain any – and must be the full 10 digit number for local and long distance calls. This may vary based on your dial plan.

To play custom sounds / messages you will need to create them and upload them to /var/lib/asterisk/sounds. Make sure that all the files you upload there that you chown them to asterisk.asterisk if your PBX is running as asterisk. When adding the sound to play in the CSV file do not add the extension just define the exact name.

To allow you to use different trunks to place your calls we added a column to define your trunks. If you only have one trunk then use that trunks name on each line

The CSV should look like this:



And so on….

The shell script variables:

If you are not sure what you are doing please leave all the settings here along except nFile and nTrunk.

  1. sounds: this variable defines the path to the asterisk sounds. You must upload your custom sounds /messages to this directory for them to play.
  2. rOut: this variable defines the path to the asterisk outgoing spool directory.
  3. rUser: this variable defines the user as asterisk.
  4. rGroup: this variable defines the group as asterisk.
  5. nFile: this variable defines the path and file name of your CSV file. You need to upload that file to a readable spot on your PBX.
  6. rtry: this variable defines the max time to wait between trying to call a user back.
  7. mtry: this variable defines the max number of times to try to call someone back.
  8. stime: this variable defines the time to wait before calling the next number. This will help avoid congestion.

What is needed:

  1. You will need an Asterisk based PBX.
    1. You will need to have an account that has the ability to access required directories and files. Preferably root.
    2. You will need to modify the /etc/asterisk/modules.conf file and add the line “load”
    3. You will need to have a copy of our script which can be downloaded here:
    4. You will need a client to upload your sound / message files to the server with as well as your CSV file.

How to run:

To run this script you will need to either manually execute it daily or schedule it via cron.

Current issues:

Since I do not have access to the do not call lists database I cannot add the functionality to check your CSV file against the do not call list. With that being stated I do not take any responsibility for your actions with this script.

Posted in Code | Comments (15)

15 Responses to “Simple Asterisk Auto Dialer”

  1. Tweets that mention Digital Offensive » Blog Archive » Simple Asterisk Auto Dialer -- Says:

    […] This post was mentioned on Twitter by VoIP Hub. VoIP Hub said: Digital Offensive » Blog Archive » Simple Asterisk Auto Dialer […]

  2. Cover Says:

    Hi Michael

    This is excellent but could do with speaking to you when you’re free, drop me a line @ when you get a chance


  3. Digital Offensive » Blog Archive » Simple Asterisk Auto Dialer « Gregory Reese Research Says:

    […] via Digital Offensive » Blog Archive » Simple Asterisk Auto Dialer. […]

  4. JF Says:

    If I have 10 phone lines, can it dial ALL 10 at the SAME TIME with the SAME MESSAGE?


    Would that make it call all three numbers at the very same time???

  5. Michael Says:

    You would need to create a ring group and put all the numbers you want it to call in that group. Then I think it will work I have not tested this. The timing may be a few seconds off but should be close.

  6. vishal Says:

    The script it awesome.

    But it is not entering the data in CDR table.

    Any Solution for that??

  7. Michael Says:

    The solution is to hire us to do it or do it yourself. This is a simple free script.

  8. Martin Says:


    Thanks for the great post and please forgive a rookie question but where in the modules.conf should I place the “load”? Any help is appreciated.



  9. Martin Says:


    I got it worked out. Script is working great. Thanks again for the post.


  10. vishal Says:

    I got data into cdr table..thanx michael..

  11. Rosli Says:

    Hi Michael, really need your favor to assist with regards to saving the CDR into the database.

    The script is working fine, just the CDR is not captured.

    Please assist here.

  12. Michael Says:

    I will assist but since it is a free script my hourly rate is 50.00 a hour US. Please feel free to email me directly for help / support. I require a 100 dollar retainer.


  13. Bryan Says:

    I strongly agree on the fee. Just saying.

  14. Asterisk autodial | Alirazashaikh Says:

    […] Digital Offensive » Blog Archive » Simple Asterisk Auto DialerJul 9, 2010 … Simple Asterisk Auto Dialer. What is it: This simple shell script was created by Michael LaSalvia of Digital Offensive to auto dial numbers and … […]

  15. EM Says:

    Hello Michael. I would like to know if you can quote a SCRIPT for any of Asterisk and/or Elastix and/or FreePBX.

    The script is a routine for outbound calls for 20 numbers to dial out as follows:
    a. One 10-seconds call every 30 minutes for one week/month.
    b. One 60-seconds call every 60 minutes for one week/month.

    There should be a registry log that shows call time stamps as far as when the call was initiated, answered and disconnected.

    Let me know. Best regards


Leave a Reply