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 AMIAsterisk Manager Interface. A TCP socket API for monitoring events and issuing actions in Asterisk, commonly used by click-to-dial integrations and dashboards. Originate or ARIAsterisk REST Interface. A modern asynchronous API exposing channels, bridges, and endpoints over HTTP and WebSocket for building custom call applications. 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 channelA single call leg passing through Asterisk. Channels represent connections to endpoints and are what dialplan applications act on., 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 |
DialplanThe core call-routing configuration of Asterisk, written mostly in extensions.conf as contexts, extensions, and priorities that decide how every call is handled. Full definition → contextA named section of the dialplan that groups extensions. Calls enter a specific context and can only reach extensions visible from it, making contexts the basic unit of call routing and security. to enter after answer |
Extension |
ExtensionA dialplan entry that matches a dialed number or pattern within a context and triggers a sequence of prioritized steps. in that context |
Priority |
Starting priority |
CallerID |
Caller IDThe calling party number (and optionally name) presented on an outbound call, set from the endpoint or manipulated in the dialplan. 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.