asterisk auto dial outbound calling


Automated Outbound Dialing

Asterisk can make outbound calls without having someone call in the first place (as with the Dial command). The means to do this is in the creation of a “call file”, simply a text file as follows:

Channel: SIP/flowroute/16466429299 MaxRetries: 1 RetryTime: 60 WaitTime: 30 Context: ck987_originate Extension: 1 Priority: 1 Set: variablename=variablevalue CallerID: Someone <2125551234>

This “call file” is simply a text file. The first line specifies the channel to use, in this case “SIP/flowroute” and the extension, in this case, my phone number. The next line is the number of times that Asterisk should try calling, the amount of times in between retries (in seconds) and the initial wait time to make the call. Next it specifies which dialplan context to put the call in along with what extension and priority to use in that context.

There are other options available such as setting the caller id of the outbound call: CallerID: Someone <2125551234>

In order to tell asterisk to read and use this call file it needs to be placed into the/var/spool/asterisk/outgoing/ directory. You need to “mv” this file there instead of creating it there in the first place. Also Asterisk needs to have permission enough to delete the file when it is done with it. Here are the steps that I use on the command line after creating the call file:

chmod 777 mv /var/spool/asterisk/outgoing/.

Note above that the call file enters the call into a context, extension and priority. Here is the context that the above example is using:

[ck987_originate] exten => 1,1,Answer() exten => 1,n,Record(/home/ck987/asterisk_sounds/rec/incoming_call.gsm,5,30) exten => 1,n,Playback(vm-goodbye) exten => 1,n,Hangup()

Nothing special about it except that since we are going to extension 1 in the call file we need to have extension 1 defined in the context.

Call Files for use in the future

If you change the modified date of a call file (using the touch command as shown below) you can have Asterisk make the call at that point.

touch -t YYYYMMDDHHMM.SS filename  <-- This is just the format, not an executable command! touch -t 201302141320.00  <-- this will generate a call on Feb14, 2013, at 1:20pm

You can look at the files that are waiting to be executed with the following command:

ls --full-time /var/spool/asterisk/outgoing/

2015-11-26 13:08:31gstlouis



2015-11-26 13:08:59

I have tried this and had to create a file vim
Channel: SIP/trunkname/18882223333 //number to call
Application: Playback
Data: hello-world

chown asterisk:asterisk because of the following error:

WARNING[1812] pbx_spool.c: Unable to set utime on /var/spool/asterisk/outgoing/ Operation not permitted

I had issues because I did not put a 1 in front.  My service provide follows 11 digit dialing

2015-11-26 14:20:19