Separate interruptible playback from the later waiting period
BackGround() plays one or more sound files while listening for digits that can select an extension. When playback finishes, it does not by itself continue waiting indefinitely; Asterisk documents WaitExten() for a subsequent digit-entry window. Treat the prompt interval and the post-prompt wait as two timeline stages.
A caller hearing the whole prompt proves only that audio reached the channel. It does not establish that DTMF arrived, was allowed to interrupt, matched an extension or remained within the collection window.
Choose the destination context and match surface explicitly
BackGround() can name the context used when a dialed extension exits playback. Without an explicit override, the active dialplan context remains part of the decision. Confirm the current context, any supplied destination context, exact extensions, patterns and includes before treating a digit as valid.
Asterisk searches explicit extensions before patterns, includes and switches, and sorts overlapping patterns by specificity. Avoid a broad . or ! catch-all as a convenience repair: those wildcards match characters as well as digits and can cross an authorization boundary if caller input is not constrained.
Keep response and inter-digit timeouts distinct
TIMEOUT(response) governs how long a channel may wait for the first digit after dialplan priorities fall through, while TIMEOUT(digit) governs the interval between digits after collection begins. Asterisk documents defaults of ten and five seconds respectively on the current branch, but those defaults are not proof of a running channel value.
When no first digit arrives, the special t extension can receive control if defined. When a started sequence becomes invalid after collection, the i extension can receive control if defined. Log the active values and actual branch rather than describing every delay as a DTMF failure.
Treat each BackGround option as a different contract
Asterisk documents p to prevent digit interruption, m to break only for a digit that matches a one-digit extension in the destination context, n to avoid answering before playback, and s to skip playback if the channel is not already up. These options change what an audible prompt and keypress mean.
Record the exact option string from the loaded dialplan. A prompt skipped by s, an unanswered early-media path under n, a deliberately non-interruptible prompt under p, and a nonmatching digit under m are not the same fault.
Keep prompt, transport and dialplan evidence separate
A missing requested sound file can terminate call processing, and BackGround() documents BACKGROUNDSTATUS values for success or failure. A successful playback attempt remains separate from answer state, received DTMF and extension dispatch.
Confirm the negotiated DTMF method and the channel event before changing the menu. Then confirm which partial or complete digit sequence the dialplan considered, which candidate extensions existed in the selected context and which priority actually executed. Do not widen patterns merely because a keypress was not visible in a high-level log.
Validate one menu timeline with bounded inputs
In an authorized test path, capture channel name and identifiers, answer state, prompt list, language, BackGround() options and status, destination context, active timeout values, each received digit with timestamps, candidate matches, selected extension and final outcome. Exercise valid digits, an invalid digit, no input, early input, slow multi-digit input and the end of playback.
Recheck application help on the installed branch before deployment and preserve a rollback. No PBX, prompt, channel, DTMF event, dialplan match, endpoint, call or media path was inspected or tested for this guide.
Choose local IVR handlers or one e catchall deliberately
The exception guide explains when e substitutes for missing i, t or T handlers and how to retain the original reason and location.
Sources & applicability
Primary references for the technical details above. Operational examples and planning checklists are VoIP.info editorial guidance.
- Asterisk 24 BackGround application ↗
- Asterisk latest WaitExten application ↗
- Asterisk latest TIMEOUT function ↗
- Asterisk dialplan pattern matching ↗
- Asterisk contexts, extensions and priorities ↗
- Asterisk special dialplan extensions ↗
- Asterisk 23 RaiseException application ↗
- Asterisk 23 EXCEPTION function ↗
- Asterisk 23 TryExec application ↗
Examples require adaptation to your topology. No live PBX or hardware testing is claimed.