A complete configuration guide for FreePBX 17 outbound routes and dial patterns. Set up US/Canada dialing, international calls, emergency routing, trunk failover, and CallerID manipulation with IPComms SIP trunking.
Outbound routes in FreePBX control how outgoing calls leave your phone system. When a user dials a number from their extension, FreePBX evaluates each outbound route in priority order, comparing the dialed number against the route's dial patterns. The first route with a matching pattern wins, and FreePBX sends the call out through the trunk (or trunks) assigned to that route.
This routing logic lets you accomplish several important objectives:
● Cost optimization: Route domestic calls through one provider and international calls through a cheaper international carrier.
● Emergency routing: Ensure 911 calls always go out a specific trunk with a verified physical address.
● Trunk failover: Assign primary and backup trunks so calls automatically fail over if your primary provider is unreachable.
● Number manipulation: Prepend area codes to 7-digit dials, strip leading digits, or rewrite CallerID per route.
● Access control: Restrict international dialing to specific extensions or require a PIN for toll calls.
2. Prerequisites
Before configuring outbound routes, make sure you have the following in place on your FreePBX 17 system:
FreePBX System
FreePBX 17 installed and running
Admin GUI access on port 80/443
At least one extension created
A softphone or IP phone registered
SIP Trunk
IPComms SIP trunk configured
Trunk showing "Registered" status
DID number(s) assigned
Outbound CallerID set on trunk
3. Creating Your First Outbound Route
Log into the FreePBX admin GUI and navigate to Connectivity > Outbound Routes. Click Add Outbound Route to open the route configuration form.
Route Settings Tab
The Route Settings tab contains the core configuration for the route:
Field
Value
Description
Route Name
US_Canada_Outbound
A descriptive name for the route (no spaces allowed)
Route CID
(leave blank or enter DID)
Override CallerID for all calls on this route
Override Extension
No
Set to Yes to force route CID over extension CID
Route Password
(blank)
Optional PIN required before the call proceeds
Route Type
Intra-Company / Emergency
Emergency routes bypass call limits and restrictions
Music On Hold
Default
MOH class played during transfers or holds
Time Group
---
Optional time-based restriction for the route
Trunk Sequence
Under Trunk Sequence for Matched Routes, select the trunk(s) to use for this route. FreePBX tries them in order from top to bottom:
Click the Dial Patterns tab in the outbound route editor. Each dial pattern has four fields that work together to match and manipulate dialed numbers before sending them to the trunk.
The Four Dial Pattern Fields
Field
Purpose
Example
Prepend
Digits added to the front of the number after matching, before sending to the trunk
1 (add country code)
Prefix
Digits the user dials that are stripped off before sending. Must be dialed but are removed.
9 (dial 9 for outside line)
Match Pattern
The pattern the remaining digits (after prefix removal) must match
NXXNXXXXXX
CallerID
Optional: Only match if the calling extension's CID matches this pattern
2125551234
Pattern Wildcards
FreePBX uses Asterisk-standard digit placeholders in the Match Pattern field:
Wildcard
Matches
Digits
X
Any single digit 0 through 9
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Z
Any single digit 1 through 9 (no zero)
1, 2, 3, 4, 5, 6, 7, 8, 9
N
Any single digit 2 through 9 (no zero or one)
2, 3, 4, 5, 6, 7, 8, 9
[1-5]
Any single digit in the specified range
1, 2, 3, 4, 5
.
One or more of any digit (wildcard)
Any string of digits (at least one)
!
Zero or more of any digit (wildcard)
Any string of digits (can be empty)
How Matching Works: An Example
Consider this dial pattern configuration:
Prepend: 1
Prefix: 9
Match: NXXNXXXXXX
When a user dials 9-212-555-1234:
● FreePBX sees the prefix 9 and strips it, leaving 2125551234
● The remaining digits match NXXNXXXXXX (10-digit NANP number)
● FreePBX prepends 1, sending 12125551234 to the trunk
5. Essential Dial Patterns for US/Canada
The following table provides a complete set of dial patterns for handling North American dialing. Add these to your primary outbound route to cover all standard call types.
Complete US/Canada Dial Patterns
Call Type
Prepend
Prefix
Match Pattern
Sent to Trunk
10-digit domestic
1
NXXNXXXXXX
1NXXNXXXXXX
11-digit with 1
1NXXNXXXXXX
1NXXNXXXXXX
7-digit local
1212
NXXXXXX
1212NXXXXXX
Toll-free 800
1800NXXXXXX
1800NXXXXXX
Toll-free 888
1888NXXXXXX
1888NXXXXXX
Toll-free 877
1877NXXXXXX
1877NXXXXXX
Toll-free 866
1866NXXXXXX
1866NXXXXXX
Toll-free 855
1855NXXXXXX
1855NXXXXXX
Toll-free 844
1844NXXXXXX
1844NXXXXXX
Toll-free 833
1833NXXXXXX
1833NXXXXXX
International
011
.
(country code + number)
Directory assistance
411
411
Emergency Dial Patterns (Separate Route)
Emergency calls should always be configured in a separate outbound route with the highest priority (lowest number). Create a route called Emergency_911 and set the Route Type to Emergency.
Call Type
Prepend
Prefix
Match Pattern
Direct 911
911
9 + 911 (outside line)
9
911
6. Route Priority & Trunk Failover
Route priority determines the order in which FreePBX evaluates outbound routes. A lower priority number means the route is checked first. You can view and reorder route priorities under Connectivity > Outbound Routes in the main list view.
Recommended Route Priority Order
Priority
Route Name
Purpose
0
Emergency_911
911 and 9-911 patterns (always first)
1
US_Canada_Outbound
Domestic NANP calling
2
Toll_Free_Outbound
1-800/888/877/866/855/844/833 calls
3
International_Outbound
011 + international calls
Configuring Trunk Failover
Within each route, you can assign multiple trunks in the Trunk Sequence for Matched Routes section. FreePBX attempts trunks in sequence order. If trunk 0 fails (registration down, congestion, or SIP error), it automatically tries trunk 1, and so on.
# Example: Trunk Sequence with Failover
# Trunk Sequence for Matched Routes
0 IPComms_Primary # Try this trunk first
1 IPComms_Secondary # If primary fails, try secondary
2 Backup_Provider # Last resort backup
To add failover trunks:
● In the route editor, scroll to Trunk Sequence for Matched Routes
● Select your primary IPComms trunk in the first dropdown (position 0)
● Click the + button to add another row
● Select your backup trunk in position 1
7. CallerID Manipulation
FreePBX gives you multiple levels of CallerID control for outbound calls. Understanding the priority order is critical to ensuring the correct number shows to the called party.
CallerID Priority Order (Highest to Lowest)
Priority
Setting Location
Where to Configure
1 (Highest)
Route CID (with Override = Yes)
Connectivity > Outbound Routes > Route Settings
2
Extension Outbound CID
Applications > Extensions > Edit Extension
3
Route CID (with Override = No)
Connectivity > Outbound Routes > Route Settings
4 (Lowest)
Trunk Outbound CallerID
Connectivity > Trunks > Edit Trunk > Outbound
Setting Route CID
In the outbound route's Route Settings tab, enter a CallerID number in the Route CID field. The Override Extension toggle controls whether this overrides per-extension CID settings:
● Override Extension = No (default): The extension's Outbound CID takes priority. Route CID is only used if the extension has no CID set.
● Override Extension = Yes: The Route CID is forced on all calls through this route, regardless of extension settings.
Per-Extension Outbound CID
To set a different CallerID for each extension, go to Applications > Extensions, edit the extension, and enter the DID number in the Outbound CID field. Use the format:
# Extension Outbound CID format
"John Smith" <2125551234>
8. Advanced: Time Conditions & Class of Service
FreePBX provides several mechanisms to restrict or condition outbound routing based on time of day, extension groups, or PIN codes.
Time-Based Route Restrictions
You can restrict an outbound route to only work during specific times using Time Groups and Time Conditions:
Step 1: Create a Time Group
Navigate to Admin > Time Groups and create a new group. For example, to allow international calls only during business hours:
# Time Group: Business_Hours
Time Start: 08:00
Time Finish: 18:00
Day Start: Monday
Day Finish: Friday
Step 2: Assign to Route
In your International outbound route, select the Time Group from the Time Group dropdown on the Route Settings tab. The route will only match calls during the specified time window. Outside that window, calls will fall through to the next route or receive a "all circuits busy" message.
PIN-Protected Routes
For toll calls or international dialing, you can require users to enter a PIN before the call proceeds. In the route's Route Settings tab, enter a numeric password in the Route Password field:
When a user dials an international number matching this route, FreePBX will prompt them to enter the PIN before completing the call.
CallerID-Based Routing (Class of Service)
You can restrict which extensions can use a route by specifying CallerID patterns in the dial pattern's CallerID field. This acts as a basic Class of Service mechanism:
# Only allow extensions 100-199 to use this route
Prepend: (blank)
Prefix: 011
Match: .
CallerID: 1XX
# Only allow extension 300 (executive) to dial international
Prepend: (blank)
Prefix: 011
Match: .
CallerID: 300
9. Testing & Troubleshooting
After configuring your outbound routes and dial patterns, apply the changes and test each call type to ensure proper routing.
Apply Configuration
After saving your routes, click the red Apply Config button in the FreePBX top bar. This reloads the Asterisk dialplan with your new routing rules.
Testing Outbound Routes
Make test calls for each dial pattern type from a registered extension:
● 10-digit domestic: Dial a local number without the 1 prefix
● 11-digit with 1: Dial 1 + area code + number
● Toll-free: Dial 1-800-555-1212 or similar
● International: Dial 011 + country code + number
Monitor Routing Decisions in Asterisk CLI
Open the Asterisk CLI to watch routing decisions in real time:
# Connect to Asterisk CLI with verbose output
sudo asterisk -rvvv
# Increase verbosity to see routing details
core set verbose 5
# Enable PJSIP SIP message logging
pjsip set logger on
When you place a test call, the CLI will show which route and trunk were selected:
-- Executing [12125551234@from-internal:1] Macro("PJSIP/100-00000001", "dialout-trunk,1,12125551234,,off")
-- Attempting to place outbound call via trunk IPComms_SIP_Trunk
-- Called PJSIP/12125551234@IPComms_SIP_Trunk
-- PJSIP/IPComms_SIP_Trunk-00000002 is ringing
Common Issues & Solutions
Symptom
Cause
Solution
"All circuits are busy"
No route matches the dialed number, or trunk is down
Check dial patterns match the dialed digits. Verify trunk registration status.
Wrong trunk selected
Route priority order is incorrect, or a more specific pattern matches first
Review route priorities. More specific patterns should be in higher-priority routes.
No audio after connect
NAT/firewall blocking RTP, or external IP misconfigured on trunk
Open UDP 10000-20000. Set correct external IP in PJSIP settings. Ensure direct_media=no.
CallerID not showing
CID override settings or trunk CID configuration
Check extension CID, route CID, and trunk CID priority order. Ensure CID is a valid DID.
International calls fail
011 prefix not being stripped, or number format incorrect
Confirm the 011 is in the Prefix field (stripped) and the remaining digits match . pattern.
Call drops after 30 seconds
SIP ACK not reaching the PBX through NAT
Enable force_rport=yes and rewrite_contact=yes on the trunk.
Debug Commands Reference
# Show all outbound routes and their patterns
sudo asterisk -rx "dialplan show from-internal"
# Show trunk registration status
sudo asterisk -rx "pjsip show registrations"
# Show active channels during a call
sudo asterisk -rx "core show channels"
# Enable full PJSIP debug logging
sudo asterisk -rx "pjsip set logger on"
# Check FreePBX applied config for errors
sudo fwconsole reload
Stop worrying about SIP trunk capacity. We have you covered.
SIP trunking from a US carrier since 2002: $0.009 per minute inbound, $0.010 outbound, numbers from $1.50 a month, $0 per channel, no contracts.