FreePBX Outbound Routes:
Sending Calls via SIP Trunk
Configure FreePBX outbound routes correctly — dial patterns, trunk selection, failover, caller ID, and LCR — so every outbound call exits through the right SIP trunk every time.
FreePBX outbound routes are the decision-making layer that determines how every outbound call leaves your PBX — which SIP trunk it exits through, what the caller ID displays, how the dialled number is transformed, and what happens when the primary trunk fails. Misconfigured outbound routes are responsible for the majority of FreePBX call failures: calls that go nowhere, calls that exit through the wrong trunk, incorrect caller ID on outbound calls, and international calls that accidentally consume local rate capacity. This guide covers every aspect of FreePBX outbound route configuration — from foundational dial pattern syntax through advanced multi-trunk failover, Least Cost Routing, PIN-protected premium routes, and time-based routing rules — with step-by-step instructions and a complete dial pattern reference you can implement immediately.
📑 Table of Contents
- How FreePBX Outbound Routing Works
- Dial Pattern Syntax: The Complete Reference
- Creating Your First Outbound Route (Step-by-Step)
- Assigning SIP Trunks to Outbound Routes
- Multi-Trunk Failover Configuration
- Outbound Caller ID Settings per Route
- Least Cost Routing (LCR) with Multiple SIP Trunks
- Route Priority and Conflict Resolution
- Advanced Route Features: PIN Sets, Time Conditions, Emergency
- Troubleshooting Outbound Route Failures
- Frequently Asked Questions
- Related Articles
1. How FreePBX Outbound Routing Works
When a user on your FreePBX system dials an external number, the call does not immediately exit through a SIP trunk. Instead, FreePBX evaluates it against a list of configured outbound routes in priority order — from highest to lowest. Each route contains one or more dial patterns that define which dialled numbers this route handles, and one or more trunk assignments that define which SIP trunk(s) to use when a match is found.
The first route whose dial pattern matches the number dialled "wins" — FreePBX sends the call through the first available trunk assigned to that route. If the primary trunk is unavailable, FreePBX automatically tries the next trunk in the list. If no trunks on the winning route are available, FreePBX does not move to the next route — it fails the call. This makes route design and trunk ordering critically important for reliability.
Understanding the outbound route system also means understanding number transformation. FreePBX can strip, add, or modify digits before passing the call to your SIP trunk. This is essential because different SIP trunk providers expect numbers in different formats — some require full E.164 format (+1NPANXXXX), others expect 10-digit format (NPANXXXX), and some expect 11-digit format with a leading 1 (1NPANXXXX). Dial pattern prefix/prepend settings handle this transformation automatically. For guidance on setting up your SIP trunk in FreePBX first, see: FreePBX SIP Trunk Setup Guide.
FreePBX Outbound Route Issues? We Configure It For You
NetViaVoice engineers set up FreePBX outbound routes, dial patterns, and SIP trunks daily. Get expert configuration support — same-day response guaranteed.
2. Dial Pattern Syntax: The Complete Reference
Dial patterns are the heart of outbound route configuration. A dial pattern defines which dialled numbers this route will handle, and — through the Prepend/Prefix settings — how those numbers are transformed before being sent to the SIP trunk. Getting dial patterns wrong is the #1 cause of outbound calling failures in FreePBX.
| Pattern Character | Meaning | Example |
|---|---|---|
X | Any single digit 0–9 | XXXXXXXXXX = any 10-digit number |
Z | Any single digit 1–9 (not 0) | ZXXXXXXXXX = 10-digit starting 1–9 |
N | Any single digit 2–9 (not 0 or 1) | NXXXXXXXXX = valid US area code range |
[1237-9] | Matches any digit in brackets | [1-9] = digits 1 through 9 |
. | Wildcard — matches one or more digits | 9011. = any international number after 9011 |
| (pipe) | Prefix strip separator | 9|XXXXXXXXXX = strip leading 9, match rest |
| Prepend field | Add digits to front before sending to trunk | Prepend 1 to send 1NPANXXXX to trunk |
! | Immediately match and route without waiting | 911! = match 911 instantly (emergency) |
Most-Used Dial Patterns for US Businesses
| Use Case | Dial Pattern | Prepend | Strip | Result Sent to Trunk |
|---|---|---|---|---|
| 10-digit US local | NXXNXXXXXX | 1 | 0 | 1 + 10 digits = 11-digit |
| 11-digit US (1+10) | 1NXXNXXXXXX | — | 0 | 11 digits as dialled |
| Toll-free | 1800NXXXXXX | — | 0 | 11-digit toll-free |
| All toll-free variants | 1[2-9]00NXXXXXX | — | 0 | 800/888/877/866/855 |
| International via 011 | 011. | + | 3 | + followed by country+number |
| E.164 International | +1NXXNXXXXXX | — | 0 | E.164 as dialled |
| Emergency (911) | 911 | — | 0 | 911 — always route first |
| 9-digit prefix dialling | 9|NXXNXXXXXX | 1 | 1 | Strip 9, prepend 1 |
| UK numbers | +44. | — | 0 | +44 + number |
| Catch-all | . | — | 0 | Everything (use last) |
Pro Tip: Always configure a specific catch-all route (. pattern) as your lowest-priority outbound route. This ensures unmatched numbers have somewhere to go — with appropriate trunk and logging — rather than silently failing with no feedback to the user.
3. Creating Your First Outbound Route (Step-by-Step)
Here is the complete process for creating an outbound route in FreePBX's GUI, from accessing the module to saving and testing your configuration:
Open the Outbound Routes Module
Log into the FreePBX Admin GUI. Navigate to Connectivity → Outbound Routes. Click + Add Outbound Route.
Set the Route Name and CID Override
Give the route a descriptive name (e.g. US-Local-NetViaVoice). Optionally set a Route CID to override outbound caller ID for all calls through this route. Leave blank to use the extension's own CID.
[Type]-[Region]-[Trunk] format — e.g. Local-US-NVV, Intl-NetViaVoice, EmergencyConfigure the Dial Patterns Tab
Click the Dial Patterns tab. Add one or more patterns using the table above. For each pattern, set the Prepend field (digits to add before sending to trunk) and Prefix field (digits to strip from the dialled number).
Assign Trunk(s) on the Trunk Sequence Tab
Click the Trunk Sequence tab. From the dropdown, select your primary SIP trunk (e.g. NetViaVoice-SIP). Add it at position 0. To add failover, click the + button and add a secondary trunk at position 1.
Set Route Position in Priority Order
Back in the Outbound Routes list, drag routes to set their evaluation order. More specific routes (e.g. Emergency 911) must be above broader routes (e.g. US Local), which must be above catch-all routes.
Submit and Apply Config
Click Submit to save the route, then click the red Apply Config button at the top of the page to make the changes live. Always apply config — saved-but-unapplied routes do not take effect.
4. Assigning SIP Trunks to Outbound Routes
A SIP trunk must be fully configured in FreePBX (under Connectivity → Trunks) before it can be assigned to an outbound route. The trunk defines the connection parameters — SIP server address, credentials, codecs, and registration method — while the outbound route defines when to use it and how to format the dialled number.
🔗 Trunk Assignment Best Practices
- One trunk per route minimum: Every outbound route needs at least one trunk assigned. A route with no trunk assigned will fail all calls silently.
- Match trunk capabilities to route type: If your NetViaVoice trunk is provisioned for US local calling, only assign US local dial patterns to routes using that trunk.
- Name trunks descriptively: Use names like
NetViaVoice-US-PrimaryandNetViaVoice-Intl-Backup— not generic names likeSIP1that become confusing in multi-trunk setups. - Verify trunk registration before testing routes: In FreePBX Dashboard → Asterisk Info → Peers, confirm your SIP trunk shows as
OKbefore testing outbound calls through it. - Check trunk outbound format: Confirm what number format your SIP trunk provider expects (E.164, 10-digit, 11-digit) and configure Prepend/Strip accordingly in the dial pattern.
5. Multi-Trunk Failover Configuration
FreePBX natively supports automatic trunk failover within a single outbound route. When you assign multiple trunks to a route's Trunk Sequence, FreePBX tries them in order — if Trunk 0 is unavailable, unregistered, or returns a busy/failure response, it automatically tries Trunk 1, then Trunk 2, and so on. No manual intervention required.
| Failover Trigger | FreePBX Behavior | SIP Response Code |
|---|---|---|
| Trunk unregistered | Immediately tries next trunk | N/A (no registration) |
| 503 Service Unavailable | Tries next trunk in sequence | 503 |
| 486 Busy Here | Does NOT failover by default | 486 |
| 408 Request Timeout | Tries next trunk after timeout | 408 |
| 404 Not Found | Tries next trunk | 404 |
| No response (timeout) | Tries next trunk after 32s | N/A |
Important: FreePBX does NOT failover on a 486 Busy response by default — it treats this as a valid "busy" answer and plays a busy tone to the caller. To enable failover on 486, add the Asterisk setting Retry on 486=YES in the trunk's advanced options in FreePBX.
6. Outbound Caller ID Settings per Route
FreePBX provides several layers of caller ID control for outbound calls. Understanding the priority order is essential to ensure the right number is presented to called parties:
| CID Layer | Location in FreePBX | Priority | Best Use |
|---|---|---|---|
| Route CID Override | Outbound Route → Route CID | Highest | Force a specific number for all calls on this route |
| Extension CID | Extension → Device Options → Outbound CID | High | Individual agent's direct number shown on outbound |
| Ring Group / Queue CID | Ring Group → CID Name Prefix | Medium | Team or department number for call centre agents |
| Trunk CID | Trunk → Outbound Caller ID | Fallback | Default number if no other CID is set |
| SIP Trunk Provider Setting | NetViaVoice portal | Override all | Carrier-side CID enforcement (if enabled) |
7. Least Cost Routing (LCR) with Multiple SIP Trunks
Least Cost Routing (LCR) is the practice of automatically routing calls through the cheapest available trunk based on the destination number. In FreePBX, LCR is implemented by creating separate outbound routes for different destination types, each using the most cost-effective trunk for that call type.
💰 LCR Architecture in FreePBX
Route 1 (Highest Priority): Emergency Calls
Pattern: 911 — Trunk: Primary local SIP trunk. Emergency calls must always go first and through a reliable domestic trunk — never through a cheap international route.
Route 2: Local US Calls
Pattern: NXXNXXXXXX — Trunk: Local calling SIP trunk with free or low local rate (e.g. NetViaVoice US SIP trunk). Zero per-minute or very low local rate.
Route 3: Toll-Free Numbers
Pattern: 1[2-9]00NXXXXXX — Trunk: Trunk with best toll-free termination rate. Some providers charge more for toll-free — route these specifically.
Route 4: International Calls
Pattern: 011. or +. — Trunk: International SIP trunk with competitive per-minute international rates. Keep international traffic separate from local to apply appropriate trunk and rate.
Route 5: Premium Rate / Catch-All
Pattern: 1900NXXXXXX (premium) + . (catch-all) — Trunk: Can be blocked (no trunk assigned to premium route) or logged and routed. Catch-all uses primary trunk as fallback.
8. Route Priority and Conflict Resolution
FreePBX evaluates outbound routes from top to bottom in the route list. The first route whose dial patterns match the dialled number "wins" — regardless of whether a more-specific route exists lower in the list. This means route ordering is as important as the dial patterns themselves.
Emergency Routes First
Always place your 911/emergency route at the very top. No other route should ever intercept an emergency number — route order guarantees this.
Specific Before Generic
Place toll-free routes above general 11-digit routes, and international routes above catch-all. Specific patterns must be evaluated before broader wildcards.
Catch-All at Bottom
Your catch-all route (pattern .) must be the last route in your list. If placed higher, it will match everything and bypass all specific routes below it.
Avoid Pattern Overlap
Two routes with overlapping patterns (e.g. NXXXXXXXXX and 1NXXXXXXXXX) can cause unexpected routing. Test each pattern to confirm which route wins for common dial strings.
9. Advanced Route Features: PIN Sets, Time Conditions, Emergency
PIN-Protected Routes
FreePBX allows you to require a PIN before a call exits through a specific route — useful for restricting international calling to authorised users. Enable this under Outbound Route → PIN Set. Create PIN sets under Admin → PIN Sets. Users must enter the PIN after dialling to proceed.
Time-Condition-Based Routing
While outbound routes themselves do not have built-in time conditions, you can implement time-based outbound routing using FreePBX's Custom Contexts module or by combining Time Conditions (which redirect calls to different destinations based on time) with different IVR paths that use different extension contexts for outbound. This is an advanced configuration typically used for after-hours routing to a different SIP trunk or to block outbound calls entirely outside business hours.
Emergency Route Best Practices
🚨 Configuring Emergency (911) Routes Correctly
- Create a dedicated
Emergencyoutbound route with pattern911(or999,112for international) - Place this route at the absolute top of your route list — above every other route
- Use pattern
911!(with exclamation) to match immediately without waiting for more digits - Assign only a verified, 911-capable SIP trunk — confirm with your provider that 911 Emergency Services calling is supported and that your location is registered for Enhanced 911 (E911)
- Set a Route CID on the emergency route to a registered callback number for your location — this is required for E911 compliance in most US states
- Test 911 routing annually — dial 933 (the E911 test code in the US) to verify your location information is correct without placing a live 911 call
10. Troubleshooting Outbound Route Failures
When outbound calls fail, the diagnostic path starts with determining exactly where the failure occurs — in FreePBX's route matching, in the SIP trunk negotiation, or in the carrier's network. Here is the structured troubleshooting approach:
| Symptom | Most Likely Cause | Fix |
|---|---|---|
| Call plays "All circuits busy" | No route matches the dialled number | Check dial patterns — verify format matches what user dials |
| Call fails with "Congestion" | Trunk is down or unregistered | Check trunk status in Asterisk Info → Peers; verify credentials |
| Wrong caller ID displayed | CID override at wrong layer | Check Route CID, Extension CID, and Trunk CID — find which layer overrides |
| International calls failing | Dial pattern not matching +/011 format | Add both 011. and +. patterns; check prepend/strip settings |
| 9-prefix calls not working | Prefix digit not stripped | Use pipe notation: 9|NXXNXXXXXX — strips the 9 before sending |
| Calls route to wrong trunk | Route priority conflict | Check route order — a higher route may be matching first with broader pattern |
| Failover not working | Failure type not triggering failover | Check if failure is 486 Busy — enable Retry on 486 in trunk advanced options |
| DTMF not working on outbound | DTMF mode mismatch with trunk | Set RFC 2833 in both trunk and codec settings. See: Codec Config Guide |
The most powerful diagnostic tool for FreePBX outbound failures is the Asterisk CLI. Enable verbose logging with asterisk -rvvvvv and make a test call — the console output shows exactly which route matched, which trunk was attempted, and what SIP response was received. This eliminates guesswork and narrows most outbound failures to a root cause within minutes.
11. Frequently Asked Questions
For standard US 10-digit dialling (area code + 7-digit number), use the dial pattern NXXNXXXXXX in your outbound route. Here is the breakdown:
- N = first digit of area code (2–9, since area codes never start with 0 or 1)
- XX = remaining two digits of area code (any digit 0–9)
- N = first digit of exchange (2–9)
- XXXXXX = remaining 6 digits
If your SIP trunk expects 11-digit format (which most US carriers including NetViaVoice support), set the Prepend field to 1. This tells FreePBX to add a leading 1 before sending the number to the trunk — so the user dials 10 digits but the trunk receives 11.
If your SIP trunk uses E.164 format, set Prepend to +1 instead. Always confirm with your SIP trunk provider which format they expect.
Calls routing through the wrong trunk is almost always a route priority problem. FreePBX evaluates outbound routes from top to bottom and sends the call through the trunk assigned to the first matching route. If a higher-priority route has a dial pattern that also matches your number, it wins — regardless of whether a more appropriate route exists lower in the list.
To diagnose and fix this:
- Go to Connectivity → Outbound Routes and review the route order from top to bottom
- For the number that is routing incorrectly, trace through each route from the top and identify the first pattern that matches
- If a broader pattern (e.g.
.catch-all orNXXXXXXXXX) appears above a more specific route, drag it below the specific route - Use the Asterisk CLI (
asterisk -rvvv) to see exactly which route and trunk are selected when you make a test call
Remember to click Apply Config after reordering routes — saved changes do not take effect until applied.
To enable international calling in FreePBX via a SIP trunk, you need an outbound route with dial patterns that match international dialling formats. In the US, international calls are typically dialled as 011 + country code + number. Here is how to configure it:
- Create a new outbound route named
International - Add dial pattern
011.(matches 011 followed by any digits) — set Strip to3(removes the "011") and Prepend to+(adds international plus sign) - Also add pattern
+NXXXXXXXXXX.to match E.164 format if your users or softphones dial with a leading + - Assign your international-capable SIP trunk (confirm with NetViaVoice that international termination is enabled on your account)
- Place this route BELOW your US local and toll-free routes in priority order — but above any catch-all
If international calls are blocked on your SIP trunk account by default, contact NetViaVoice to enable international termination for your specific destinations.
FreePBX handles trunk failover automatically within a single outbound route when multiple trunks are assigned to the route's Trunk Sequence. Here is exactly how it works:
- FreePBX attempts the call via the trunk at Sequence 0 (your primary trunk)
- If the primary trunk is unregistered, returns a 503 Service Unavailable, 408 Timeout, or 404 Not Found, FreePBX automatically tries Sequence 1 (your failover trunk)
- If Sequence 1 also fails, FreePBX tries Sequence 2, and so on
- If all trunks in the sequence fail, the call fails with a congestion tone
Important exception: A 486 Busy Here response does NOT trigger failover by default — FreePBX treats this as a valid response (the carrier is available but busy) and presents a busy tone to the caller. To enable failover on 486, set Retry on 486 = YES in the trunk's Advanced Settings tab.
Failover only works within a single route — FreePBX does not cascade to a secondary outbound route if all trunks in the first route fail. For more on managing multiple SIP trunks in 3CX (similar concepts apply), see: 3CX and Multiple SIP Trunks.
FreePBX provides several methods to restrict specific extensions from accessing certain outbound routes:
- Route Password / PIN Sets: Enable a PIN requirement on an outbound route (e.g. your international route). Only users who know the PIN can complete calls through that route. Create PIN sets under Admin → PIN Sets, then assign the PIN set to the route.
- Custom Contexts (module required): Install the Custom Contexts module from the FreePBX module admin. This allows you to define per-extension or per-extension-group outbound access rules — specifying exactly which routes each extension can use.
- Class of Service (COS) with commercial modules: FreePBX's commercial modules include a more granular Class of Service system for enterprise deployments requiring complex extension-level call restriction policies.
- Outbound Route → Route Password: In some FreePBX versions, the route itself has a password field — users must dial the password as a prefix to access the route.
For most small business deployments, the PIN Set approach provides sufficient restriction with minimal configuration complexity. For more advanced multi-trunk management, see our guide: 3CX and Multiple SIP Trunks and 3CX NAT Configuration.
⚙️ Need FreePBX Outbound Route Configuration Help?
NetViaVoice engineers configure FreePBX outbound routes, dial patterns, SIP trunks, and failover routing for businesses worldwide. Whether you are starting a fresh deployment or troubleshooting existing call routing problems — we resolve FreePBX issues fast, with full support for all NetViaVoice SIP Trunking customers.