Record the module and support boundary first
The current Dynamic Routes overview says that since FreePBX 15 the module can be installed through Module Admin from the Unsupported repository. Sangoma's current category page describes the same family as community-supported modules whose maintenance is not owned by the core PBX Engineering team. Preserve both statements rather than relabeling the module as a standard supported feature.
Before designing a route, record the installed FreePBX branch, module name and version, signature state, repository channel and change owner. A current documentation page or repository branch is not proof that a particular PBX has a compatible, enabled or supported build.
Define one lookup contract before choosing a source
Write down the allowed input, the single value expected back, the exact result-to-destination table, invalid-input destination and default destination. Dynamic Routes documents MySQL, ODBC, URL, AGI and Asterisk-variable lookup sources; those are different trust, availability and parsing boundaries rather than interchangeable ways to obtain the same fact.
Use the narrowest source that already owns the decision. Keep caller identity, dialed DID, DTMF input, saved variables, external response and final destination as separate observations so a correct branch is not mistaken for proof that every upstream value was authentic.
Bound DTMF and channel-local saved variables
If caller input is enabled, set an explicit maximum digit count, timeout, validation expression, retry count, retry prompt and invalid destination. The guide documents saved input and result names for later Dynamic Routes, with DYNROUTE_-prefixed channel variables for dialplan use. These values last only while that channel is up.
Treat the input as untrusted. A format-valid value is not authorization, account ownership or consent, and a saved channel variable is not durable storage. Record each route in a chain and the exact name passed forward instead of assuming another channel or later call inherits it.
Make substitutions deliberate and results exact
Square brackets can trigger Dynamic Route variable substitution. The user guide explicitly warns that substitutions must be disabled when brackets in a query or destination are literal. Preserve the configured substitution state and the rendered lookup expression without exposing credentials or personal data.
Dynamic Route entries use an exact match against the returned result. Normalize the producer contract deliberately: plain-text URL output, ODBC value, AGI-set variable or Asterisk expression must yield the intended token without undocumented wrappers, extra fields or whitespace assumptions.
Give every miss an explicit, safe destination
The user guide strongly recommends a default destination and says a failed lookup or unmatched result can drop the call when no default exists. If intentional termination is required, choose the explicit Terminate Call destination rather than depending on an empty configuration.
Keep invalid DTMF, lookup failure, no result, unmatched result and an exact matched result as different branches. A fallback should provide safe service behavior without silently granting a privileged queue, external route or data-dependent treatment.
Test one bounded change and preserve rollback
Use an authorized non-production or controlled maintenance window to exercise one valid match, one invalid input, one empty or failed lookup and one unmatched result. Record the generated dialplan revision, source type, sanitized request or query fingerprint, returned token, chosen destination and call-channel identifiers.
External databases, URLs and AGI scripts need their own least-privilege credentials, certificate and network controls, logging, availability expectations and change owners. The published examples are starting points, not proof of security, compatibility or production fitness. This guide is documentation-derived; no module, lookup or call was tested.
Sources & applicability
Primary references for the technical details above. Operational examples and planning checklists are VoIP.info editorial guidance.
- Sangoma FreePBX Dynamic Routes module ↗
- Sangoma FreePBX Dynamic Routes user guide ↗
- Sangoma FreePBX Dynamic Routes working examples ↗
- Sangoma FreePBX community-supported modules ↗
- Sangoma FreePBX Module Admin user guide ↗
- FreePBX Dynamic Routes call-flow article ↗
- FreePBX Contributed Modules dynroute repository ↗
Examples require adaptation to your topology. No live PBX or hardware testing is claimed.