VoIP.info Guide

Asterisk DIALGROUP: manage dynamic dial targets with explicit fallbacks

Build a named dial-target list with whole-list replacement or explicit add and delete operations, then keep membership, contact expansion and Dial outcomes independently observable.

Reviewed 2026-10-19Current Asterisk Latest API DIALGROUP, Dial, PJSIP_DIAL_CONTACTS, HANGUPCAUSE_KEYS, HANGUPCAUSE and HangupCauseClear references, the Asterisk CLI guide and the upstream func_dialgroup implementation were reviewed October 19, 2026. The generated Latest API pages reported branch 23; the installed Asterisk branch, loaded func_dialgroup module, dialplan revision, named-group lifecycle, concurrent writers, endpoint and contact state, channel-driver behavior and call outcomes remain deployment specific. No PBX, module, dialplan, group, endpoint, contact, channel, packet, media stream or live call was inspected or testedAdvancedDocumentation based · not lab tested

Use DIALGROUP for a dial list, not concurrency accounting

DIALGROUP(group,op) manages a named list of interfaces intended for use with Dial(). Reading ${DIALGROUP(frontline)} produces the list to dial. A write with no operation replaces the whole list; add and del are write-only membership operations.

This is distinct from GROUP() and GROUP_COUNT(), which label and count live channels, and from the Queue application, which owns queue policy and agent behavior. Choose DIALGROUP only when a dialplan-owned list with an explicit fallback matches the requirement.

Give membership one writer and one lifecycle

Name the group, define which dialplan path may replace it, which paths may add or delete members, and when an entry should leave. Prefer one owner that serializes administrative intent instead of letting unrelated call paths race to rewrite the same list.

The reviewed function reference documents operations and dial use, but it does not promise restart persistence, reload persistence, transactional multi-step edits or conflict resolution between concurrent writers. Prove those properties on the installed branch before depending on them, and use a persistent external owner when persistence is the actual requirement.

Keep interface strings and PJSIP contact expansion separate

A DIALGROUP member is a channel name or interface string. For PJSIP, decide whether the list contains an endpoint dial target or a dial string produced from current contacts. PJSIP_DIAL_CONTACTS(endpoint[,aor[,request_user]]) returns a properly formatted string for all contacts on the selected AoR.

Do not represent that contact snapshot as permanent membership or a guarantee that a device will answer. Preserve the endpoint, AoR, expansion time and resulting redacted dial string so stale group membership and changing registration state remain distinguishable.

Guard the empty-list and malformed-target boundaries

Read the group into a named variable, record its blank/nonblank state and apply an explicit fallback before calling Dial(). The DIALGROUP reference says dialplan execution may continue when no interfaces are available; that is a control-flow opportunity, not evidence that a queue fallback, voicemail destination or failure branch happened.

Validate member grammar at the writer. Do not concatenate untrusted dial strings, expose credentials in logs or assume a blank value proves which add, delete or replacement operation occurred.

Separate list construction from Dial outcomes

Dial() attempts one or more channels and sets DIALSTATUS after it returns. Preserve the exact group name, redacted value read immediately before Dial, timeout, relevant options, returned status and next priority. An apparently correct list can still produce CHANUNAVAIL, BUSY, NOANSWER or another documented result.

For multiple outbound legs, HANGUPCAUSE_KEYS() supplies the channel names with available causes and HANGUPCAUSE(channel,type) separates technology-specific from translated Asterisk cause information. Clear old cause data deliberately with HangupCauseClear() only when the trace requires a new cause set.

Test membership and routing as two contracts

In an authorized staging path, start from a recorded baseline, replace the list with two controlled targets, read it back, add one target, delete one target and exercise an empty-list fallback. Then test one registered target, one unavailable target and the intended later route while capturing DIALSTATUS and per-leg cause evidence.

Restore the original list and temporary logging. A successful membership edit does not prove device reachability, media, failover or queue behavior. This guide is documentation-derived; no PBX, module, group, endpoint, contact, channel or call was tested.

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.