IPComms
PricingAboutBlog
Tutorial February 18, 2026 18 min read

FreePBX Outbound Routes & Dial Patterns

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.

1. What Are Outbound Routes?

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.

How It Works: FreePBX evaluates outbound routes from lowest route priority number to highest. It checks each dial pattern within the route against the dialed number. The first match sends the call to that route's trunk sequence. If the trunk is unavailable, FreePBX tries the next trunk in the sequence before moving to the next route.

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

Need a SIP Trunk? If you have not yet configured a SIP trunk in FreePBX, follow our FreePBX SIP Trunk Setup Guide first. It walks through creating a PJSIP trunk with IPComms credentials and verifying registration.

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:

FieldValueDescription
Route NameUS_Canada_OutboundA descriptive name for the route (no spaces allowed)
Route CID(leave blank or enter DID)Override CallerID for all calls on this route
Override ExtensionNoSet to Yes to force route CID over extension CID
Route Password(blank)Optional PIN required before the call proceeds
Route TypeIntra-Company / EmergencyEmergency routes bypass call limits and restrictions
Music On HoldDefaultMOH 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:

# Trunk Sequence for Matched Routes
0  IPComms_SIP_Trunk     # Primary trunk
1  Backup_SIP_Trunk      # Failover (optional)

Select your IPComms trunk from the Trunk Sequence dropdown. To add a second trunk for failover, click the + Add button and select the backup trunk.

Important: Do not click Submit yet. You must add at least one dial pattern on the Dial Patterns tab before the route will function. A route with no dial patterns will never match any calls.

4. Understanding Dial Patterns

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

FieldPurposeExample
PrependDigits added to the front of the number after matching, before sending to the trunk1 (add country code)
PrefixDigits the user dials that are stripped off before sending. Must be dialed but are removed.9 (dial 9 for outside line)
Match PatternThe pattern the remaining digits (after prefix removal) must matchNXXNXXXXXX
CallerIDOptional: Only match if the calling extension's CID matches this pattern2125551234

Pattern Wildcards

FreePBX uses Asterisk-standard digit placeholders in the Match Pattern field:

WildcardMatchesDigits
XAny single digit 0 through 90, 1, 2, 3, 4, 5, 6, 7, 8, 9
ZAny single digit 1 through 9 (no zero)1, 2, 3, 4, 5, 6, 7, 8, 9
NAny 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 range1, 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

Best Practice: Most SIP trunk providers, including IPComms, expect to receive US/Canada numbers in 11-digit format (1 + 10 digits). Configure your dial patterns to ensure numbers are sent to the trunk in this format regardless of how users dial.

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 TypePrependPrefixMatch PatternSent to Trunk
10-digit domestic1NXXNXXXXXX1NXXNXXXXXX
11-digit with 11NXXNXXXXXX1NXXNXXXXXX
7-digit local1212NXXXXXX1212NXXXXXX
Toll-free 8001800NXXXXXX1800NXXXXXX
Toll-free 8881888NXXXXXX1888NXXXXXX
Toll-free 8771877NXXXXXX1877NXXXXXX
Toll-free 8661866NXXXXXX1866NXXXXXX
Toll-free 8551855NXXXXXX1855NXXXXXX
Toll-free 8441844NXXXXXX1844NXXXXXX
Toll-free 8331833NXXXXXX1833NXXXXXX
International011.(country code + number)
Directory assistance411411

7-Digit Dialing: For the 7-digit local pattern, replace 1212 in the Prepend field with 1 followed by your local area code. For example, if your office is in Dallas, use 1214 or 1972 as the prepend value.

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 TypePrependPrefixMatch Pattern
Direct 911911
9 + 911 (outside line)9911

E911 Compliance: IPComms supports E911 with registered location data. Ensure your trunk has a verified service address configured in the IPComms portal. The 911 dispatch center will receive your registered address with the emergency call.

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

PriorityRoute NamePurpose
0Emergency_911911 and 9-911 patterns (always first)
1US_Canada_OutboundDomestic NANP calling
2Toll_Free_Outbound1-800/888/877/866/855/844/833 calls
3International_Outbound011 + 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

IPComms Redundancy: IPComms provides geographically redundant SIP endpoints. You can configure two separate trunks pointing to different IPComms SIP servers (e.g., sip1.ipcomms.net and sip2.ipcomms.net) for maximum reliability.

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)

PrioritySetting LocationWhere to Configure
1 (Highest)Route CID (with Override = Yes)Connectivity > Outbound Routes > Route Settings
2Extension Outbound CIDApplications > Extensions > Edit Extension
3Route CID (with Override = No)Connectivity > Outbound Routes > Route Settings
4 (Lowest)Trunk Outbound CallerIDConnectivity > 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>

CNAM & CID Validation: Your outbound CallerID must be a valid DID number assigned to your IPComms account. Sending an unauthorized CallerID may result in call blocking or rejection under STIR/SHAKEN attestation rules. IPComms assigns A-level attestation to calls using verified numbers.

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:

# Route Settings for International_Outbound
Route Name:     International_Outbound
Route Password: 5678
Route Type:     Intra-Company

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

Custom Context Module: For more granular access control, consider installing the FreePBX Custom Contexts module. It lets you create custom dial permission classes that can be assigned per extension, giving you fine-grained control over which routes each user can access.

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

SymptomCauseSolution
"All circuits are busy"No route matches the dialed number, or trunk is downCheck dial patterns match the dialed digits. Verify trunk registration status.
Wrong trunk selectedRoute priority order is incorrect, or a more specific pattern matches firstReview route priorities. More specific patterns should be in higher-priority routes.
No audio after connectNAT/firewall blocking RTP, or external IP misconfigured on trunkOpen UDP 10000-20000. Set correct external IP in PJSIP settings. Ensure direct_media=no.
CallerID not showingCID override settings or trunk CID configurationCheck extension CID, route CID, and trunk CID priority order. Ensure CID is a valid DID.
International calls fail011 prefix not being stripped, or number format incorrectConfirm the 011 is in the Prefix field (stripped) and the remaining digits match . pattern.
Call drops after 30 secondsSIP ACK not reaching the PBX through NATEnable 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

Need Help? IPComms support can assist with trunk connectivity and routing issues. Contact us at support or check our FreePBX Troubleshooting Guide for additional diagnostic steps.

Ready to Configure Outbound Calling?

Get started with IPComms SIP trunking for FreePBX. Reliable connectivity, competitive per-minute rates, and full NANP coverage with E911 support.

Related Articles