Skip to content
Phone Guides

Asterisk call files: submission, retries and scheduling

A call file asks Asterisk to originate a call and apply specified handling. Treat producing and submitting that file as a controlled operation with a destination, owner and retry policy, not as a casual file copy into a directory.

Source-reviewed, 19 October 2026. Prepared from the cited documentation. Call-file origination has not been independently tested by Phone Guides. Scope: Asterisk 22 call-file design; no calls are placed by this guide.

Identify the requested work

Record the intended channel/destination, caller identity, answer handling, attempt timeout, retry count/interval and permitted execution time. Restrict who or what may submit jobs. A filesystem writer able to create call files can affect calling behaviour and potentially incur charges.

Use the official call-file reference for field meanings. Do not accept arbitrary caller-supplied channel strings or dialplan destinations. Validate against the application's authorised job types and destination set.

Read a small internal-call example

This original example assumes the existing local PJSIP endpoint/AOR 6001 from register two phones. It rings that endpoint, then runs a deliberately small context after answer. It contains no carrier destination. Submitting it on a real PBX still places a call, so use an account and phone you control.

First add this separate context to the configuration source that owns your dialplan:


[pg-file-answer]
exten => s,1,Wait(2)
 same => n,Hangup()

Check the loaded context at the CLI before submitting a file:


dialplan show pg-file-answer
pjsip show endpoint 6001
pjsip show aor 6001
module show like pbx_spool

Inspect the actual contact and the spool module's availability. If your deployment uses a configuration database or a managed PBX, use that owner's supported process rather than adding a second competing file definition.

Prepare the following content in a protected staging directory on the same filesystem as the effective outgoing spool:


Channel: PJSIP/6001
WaitTime: 15
MaxRetries: 0
Context: pg-file-answer
Extension: s
Priority: 1
Archive: yes

The intended sequence is ringing for up to 15 seconds, no additional attempts, then a two-second wait and hangup after answer. MaxRetries: 0 still permits the initial attempt. The route does not play an announcement; it is meant to make the answer/handling boundary easy to inspect. The branch-22 Wait reference and Hangup reference define those two applications.

Submit through the actual spool

Prepare the full file outside the monitored outgoing directory, with correct content, ownership and permissions. Then use the documented atomic submission arrangement on the appropriate filesystem. Writing it incrementally where Asterisk is already watching can expose an incomplete job to processing.

Inspect the effective spool directory rather than assuming a default path. The upstream directory reference and running settings identify the installation's locations. Keep preparation files protected if they contain subscriber information or account details.

Finish ownership and access settings while the file is staged. Then rename it into the outgoing directory on that same filesystem using your deployment's supported file operation. A cross-filesystem move may become a copy, defeating the complete-file boundary. This guide intentionally does not supply a guessed service user or absolute spool path for every distribution.

With Archive: yes, inspect the corresponding file in outgoing_done after processing. Its appended Status and the call's execution evidence answer different questions: file processing may finish without proving an external business task succeeded. If no file appears there, inspect parsing, access and spool-module evidence before submitting a replacement job.

Separate retries from duplicate jobs

Case Decision required
Destination does not answer The call-file retry policy appropriate to that service
Producer loses confirmation after submission Determine whether the original job already exists or ran
Producer restarts Resume its job ledger without submitting every old job again
Scheduled time changes Update the intended job through a defined process
Job completes Record outcome and stop further attempts

Give each business operation a stable internal job identity and keep a private ledger of submission/outcome. A new filename does not make a repeated business operation safe. Decide how cancellation works before allowing unattended scheduled work.

Understand scheduling and completion

The upstream reference describes future modification-time scheduling and optional movement to an outgoing-done archive. Keep server time, intended timezone and modification-time handling together. Do not assume the producer's local clock and the server's interpretation are identical.

Choose whether files are archived or deleted after processing and how operational results are retained. A status indicating job completion needs interpretation in the context of its requested work; it is not a substitute for every business outcome or later application result.

Reader checks

If you implement this path, use an authorised ordinary destination with a stated cost/attempt limit. Check a valid job, rejected/malformed job, no answer, retry exhaustion and producer restart. Never use a real emergency number as a scheduling check.

Verify that untrusted users cannot submit files or alter their routing. Protect the outgoing/done directories and their retention. If the application needs richer event correlation or immediate interactive control, compare AMI and ARI rather than adding hidden control logic around files.

Return to Asterisk documentation.