Asterisk Call Files: Spool Directory, Retries, and Archive Behavior
Asterisk Call Files: Spool Directory, Retries, and Archive Behavior
Call files let you originate calls by writing a text file into Asterisk's outgoing spool directory. They are simple, reliable, and easy to automate from shell scripts, cron jobs, and monitoring systems.
Use call files for small batches, callbacks, wake-up calls, reminder calls, and operational automation. For large campaigns or high-rate outbound dialing, use AMI Originate or ARI so you can apply backpressure and track state directly.
Spool directory
The outgoing spool is usually:
/var/spool/asterisk/outgoing
Asterisk watches this directory. When a complete call file appears, Asterisk claims it, parses it, and attempts the call.
Do not write directly into the outgoing directory. Write the file somewhere else on the same filesystem, then move it into place with mv. A rename is atomic, so Asterisk never sees a half-written file.
Minimal call file
Channel: PJSIP/100
Context: outbound-announcement
Extension: s
Priority: 1
CallerID: Reminder <5551234567>
MaxRetries: 2
RetryTime: 60
WaitTime: 30
Archive: yes
Setvar: CAMPAIGN_ID=reminder-2026-08
Setvar: CUSTOMER_ID=12345
When Asterisk answers the outbound channel, it sends the call to outbound-announcement,s,1.
[outbound-announcement]
exten => s,1,NoOp(Automated reminder for ${CUSTOMER_ID})
same => n,Playback(custom/reminder)
same => n,Hangup()
Common fields
| Field | Meaning |
|---|---|
Channel |
Technology and destination to dial first |
Context |
Dialplan context to enter after answer |
Extension |
Extension in that context |
Priority |
Starting priority |
CallerID |
Caller ID for the outbound leg |
MaxRetries |
Number of retry attempts after the first failure |
RetryTime |
Seconds between retry attempts |
WaitTime |
Seconds to wait for answer on each attempt |
Archive |
yes moves completed files to outgoing_done |
Setvar |
Channel variables to attach to the originated call |
Retry and archive behavior
Asterisk updates the call file while it works. If Archive: yes is present, completed files move to:
/var/spool/asterisk/outgoing_done
The archived file includes status comments that show whether the call expired, failed, or completed. Keep this directory on a retention policy if you generate many call files.
Permissions and mtime pitfalls
Call files must be readable by the Asterisk process. On many systems that means owner or group asterisk.
install -o asterisk -g asterisk -m 0640 reminder.call /var/spool/asterisk/tmp/reminder.call
mv /var/spool/asterisk/tmp/reminder.call /var/spool/asterisk/outgoing/reminder.call
The file modification time matters. If you set the mtime in the future, Asterisk waits until that time before processing the file. This is useful for scheduling, but confusing when a file appears to be ignored.
See Also
User Notes
Know a tip or gotcha for this topic? Share it below and help others.
Contribute a note
Share a tip, gotcha, or practical example. Keep it under 2000 characters. No questions (use the Asterisk community forums for support). Wrap code in backticks.