How to use an Asterisk callfile
Asterisk call files are structured files which that tell asterisk how to initiate a call when when moved to the appropriate directory. you can use them in order to initei calls without an extension or bypass the dialplan for troubleshooting purposes.Â
Requirements and general information on how it worksÂ
pbx_spool.so module needs to be loaded into asterisk
Calls files will only be readed when they are moved into astspooldir directory defined in asterisk.conf (usually /var/spool/asterisk/outgoing/)
Upon detection Asterisk will immediately execute the directives unless the modification time is in the future, in which asterisk will wait for the time to on the server to match before placing executing.Â
Upon completion asterisk will remove the call from spooling directoryÂ
SyntaxÂ
​Specify where and how to call
Channel: <channel>: Channel to use for the call.
CallerID: "name" <number> Caller ID, Please note: It may not work if you do not respect the format: CallerID: "Some Name" <1234>
MaxRetries: <number> Number of retries before failing (not including the initial attempt, e.g. 0 = total of 1 attempt to make the call). Default is 0.
RetryTime: <number> Seconds between retries, Don't hammer an unavailable phone. Default is 300 (5 min).
WaitTime: <number> Seconds to wait for an answer. Default is 45.
Account: Set the account code to use.
If the call answers, connect it here:
Context: <context-name> Context in extensions.conf
Extension: <ext> Extension definition in extensions.conf
Priority: <priority> Priority of extension to start with
Set: Set a variable for use in the extension logic (example: file1=/tmp/to )
Application: Asterisk Application to run (use instead of specifiying context, extension and priority)
Data: The options to be passed to application
Other parametersÂ
AlwaysDelete: Yes/No - If the file's modification time is in the future, the call file will not be deleted
Archive: Yes/No - Move to subdir "outgoing_done" with "Status: value", where value can be Completed, Expired or Failed.
Examples
playback.call
Â
channel: DAHDI/1/123456789
application: Playback
data: Demo-congrats
Â
SendFax.call
Â
channel: SIP/PROVIDER/1234567890
application: SendFax
data: fax.tiff
setvar=FAXID=1430402112
setvar=FAXOPT(ecm)=yes
setvar=FAXOPT(minrate)=2400
setvar=FAXOPT(maxrate)=14400
How to initiate a call file
Create a callfile using
Set file permissions with chmod 777 <filename>
Move the file to the proper spool directory with #cp -ap /root/callfile /tmp/cf && mv /tmp/cf /var/spool/asterisk/outgoing/
Note: it's not recommended to copy the file to the spool directory because asterisk could start reading the file before the operating system stop writing it causing a failure.Â