VoIP.info Troubleshooting

Asterisk WaitForCondition times out, fails or returns early

Find the first divergence among installed application, loaded expression, deferred evaluation, mutable-state owner, writer timing, truth rules, interval, timeout, status and next dialplan step.

Reviewed 2026-10-15Current Asterisk branch-23-generated WaitForCondition, VARIABLE_EXISTS and GLOBAL_EXISTS references, branch 22 WaitForCondition reference, and current dialplan expression and conditional-application documentation reviewed October 15, 2026; installed branch, module packaging, exact dialplan, expression, channel, mutable-state owner, writer, timing, function cost and downstream call flow remain deployment specific; no host, module, dialplan, channel, variable, global, function, poll, packet or live call was inspected or testedAdvancedDocumentation based · not lab tested

Capture one wait, expression, timeline and status

Record timestamp and timezone, installed Asterisk branch, channel identity, context, extension, priority, exact loaded application arguments, mutable-state owner, writer, start time, relevant writer time, return time, immediate WAITFORCONDITIONSTATUS, next priority and caller-visible result. Redact secrets and caller data.

Classify the symptom as timeout, early TRUE, FAILURE, HANGUP, no return, missing status or correct return followed by wrong downstream behavior. Do not group all of them under polling delay.

Prove the installed application and loaded dialplan

Confirm the running system exposes WaitForCondition() and inspect its local help. Then prove that the active dialplan entered the expected context, extension and priority with the intended replacement character, expression, timeout and interval. A source-file edit or generated configuration fragment is not proof that the loaded dialplan executed it.

If the application, generated syntax or target priority differs, correct that boundary before changing variables or timing. Keep upstream documentation, installed help, loaded dialplan and one observed run separately labelled.

Determine whether the expression was deferred or pre-evaluated

Inspect the exact argument that reached the application. Verify that the replacement character stands in for $, does not appear elsewhere in the expression, and survives every configuration or templating layer. Compare the value visible at application entry with the value written later.

If runtime substitution collapsed the expression before polling began, the application can repeatedly test only that initial result. Repair quoting or replacement first. Do not compensate for a frozen expression with a longer timeout or faster interval.

Trace variable, global or shared-state ownership

Identify the exact object read by the expression and the exact object written by the producer. Channel variables, inherited variables, globals, SHARED state, AstDB and function-backed values have different scope and concurrency properties. Use VARIABLE_EXISTS() only for channel-variable presence and GLOBAL_EXISTS() only for global-variable presence when the installed version provides them.

Record writer channel, value, correlation key and timestamp. A similarly named value on another channel is not the same state. If cross-channel coordination is required, use one documented shared owner and protect any multi-step invariant rather than relying on naming coincidence.

Recalculate timeout, interval and repeated work

Write timeout and interval in seconds, compare them with observed start and return times, and account for the expected writer latency. The current generated reference documents a 0.05-second default interval and no timeout by default, but a production call path should use an explicit bound.

Inspect every function inside the expression. Repeated evaluation can multiply database, network or custom-function work, especially at a short interval. Treat cost and side effects as function-specific deployment evidence. A slow or failing lookup, wrong owner and genuinely false condition require different corrections.

Fix the first proved owner and test the status matrix

Correct only the first demonstrated divergence: application availability, loaded syntax, replacement character, expression, state owner, writer, existence test, truth comparison, function behavior, interval, timeout or result branch. Preserve rollback and remove temporary high-volume logging.

Repeat bounded true, timeout, failure and hangup cases as authorized, logging the immediate status and next executed priority. Accept the condition result separately from downstream application and caller outcome. No host, module, dialplan, channel, variable, global, function, poll, packet or live call was inspected or tested for this diagnostic.

Sources & applicability

Primary references for the technical details above. Operational examples and planning checklists are VoIP.info editorial guidance.

Examples require adaptation to your topology. No live PBX or hardware testing is claimed.