Asterisk can automatically make a call if you put a .call file in the (default) /var/spool/asterisk/outgoing/ directory. If the date of the file change is greater than the current one, the call will be made on or after this time.
For automatic calls, the pbx_spool.so module must be loaded, it must be registered in modules.conf or autoload=yes must be specified.
I’ll give an example of the contents of the file:
Channel: SIP/goip4/10670000000 Application: Playback Data: file1 MaxRetries: 5 RetryTime: 60 WaitTime: 30
Briefly describe what I said in it:
Channel: SIP/goip4/10670000000 (channel for an outgoing call, in my case the first SIM card on the goip4 gateway will be used and the number 0670000000 will be dialed)
Application: Playback (application that you need to execute when you call, in my case, Playback to play an audio file)
Data: file1 (data for the application, since Playback is started, file1 is the name of the file being run, in my case I put the file here /usr/share/asterisk/sounds/ru_RU/file1.ulaw)
MaxRetries: 5 (the number of attempts after which the call will not be considered successful, the default value is 0, the count starts from 0 – this is a one-time call)
RetryTime: 60 (time in seconds between call attempts, default 300 (5 minutes))
WaitTime: 30 (call waiting time in seconds, default 45)
You can also specify:
Context: NAME (context name from extensions.conf)
Extension: NAME (extension name of extensions.conf)
Priority: (priority number from which to start execution)
Archive: Yes/No (Yes means transferring the .call file to the /var/spool/asterisk/outgoing_done/ directory after the call is made)
AlwaysDelete: Yes/No (do not delete the file if the modification time is longer than the current one)
For example, you can move a ready .call file using rsync at certain events, after which the call will be made:
rsync -avh /scripts/zabbix/alert.d/zabbix.call /var/spool/asterisk/outgoing/zabbix.call
See also my most popular entries on topic – Asterisk