Slider 2TryLearn MoreSlash your Phone bills - Slider Image

Use SIP trunks, WebRTC & Apps

Slash your Phone Bill by 80%

Course Content - Advanced

Advanced Outbound Routing


Welcome to the online training series from 3CX. This module will take you through the Advanced Outbound Routing with 3CX.


In this module, we will focus on the Outbound rules in 3CX. We will see the different criteria that are used, and how they match an outgoing call.

We will see how the Outbound rules can be used to block outgoing calls from certain user extensions.

We will see how the system extensions can be configured in the Outbound Rules to make outgoing calls.

We will then talk about the emergency numbers and how they are configured in 3CX.

And finally, least cost routing will take up the last part of this module, and we will see how the outbound rules can be configured to take advantage of this cost saving measure.


For the purposes of this module, we are assuming that a SIP trunk is already configured in 3CX and that some basic knowledge of the Outbound rules is available.


There are 4 different outbound rule criteria which are used to configure outbound rules.

First is the prefix. This is what the dialled number starts with. There is no wildcard available for the outbound rule prefix.

Next is the “Calls from extension(s)” criterion, which will limit the rule for a specific extension or a number of extensions. This is where the call originates from.

The dialled number length can then be configured, to limit the rule to a particular dialed number length. For example the rule may only be valid for 8 digit numbers, which may signify a local call.

In addition to the calls from extensions field above you also have a choice of Extension Groups. In some cases, it may be tedious to remember which extensions belong to which department, so you can use the Extension Groups as an outgoing call routing group as well.


The Outbound Rules of 3CX are checked in a top down manner, always starting at the top and working down the list.

When a match is made, it will stop processing rules, and will not check the next rule, or any other subsequent rules.

If there are no criteria in the Outbound Rule, this rule will be ignored and the PBX will proceed on to the next rule. Having your criteria blank does not mean that “All Calls” will be processed. On the contrary this rule will be redundant.

The criteria fields of the Outbound Rules can accept single values. For example, a single extension.

Comma separated values can also be added, to have multiple values, for example 100,102 to have both extensions 100 and 102 as values.

You can also use the dash, or minus sign to signify a range of values. For example 100-105 will take extensions 100 to 105 inclusive.

Combinations of the above are also possible. For example 102,105-117,302 will take extensions 102 and 302 as well as the range of extensions 105 till 117.


In order for a call to be processed, the rule will need to match the criteria. The match will be the prefix and the number length and either an extension number or extension group.

This can be scripted or coded in the following format, as shown on the slide.


Once the criteria have been met, the PBX will then proceed to process the call.

Further processing will now be based on the dialled number.

The PBX has the capability to reformat the outgoing number, before sending it to the provider.

It will begin by stripping any digits from the the beginning of the number. When selecting the value of digits to strip, you are selecting how many digits to take away from the beginning of the dialed number.

After the stripping of the digits has been performed, the PBX will prepend any digits you require at the beginning. Please note that you will not be choosing how many digits to prepend, but you will need to choose which digits to prepend in this particular case.

The PBX will provide you with 5 outgoing routes. These are 5 different possible routings the call will be able to go  out from.

The PBX will check these in numerical order. If the first route fails for any reason, whether the provider defined in this route is busy or unavailable, the call will move to the next route. A provider being busy may mean that there are no available channels on that trunk to service the call or the provider returns an error message to the PBX. Being unavailable will mean that the PBX cannot reach the provider for any reason.

A call will fail when all the set routes fail or you have defined this particular rule as a blocking rule, with all routes set to “BLOCK CALL”. Once the PBX Hits a “BLOCK CALL” route, it will stop trying to further process the call.


In addition to configuring your outbound rules to allow calls, and to choose which trunk the particular call will go out from, you can also use the outbound rules to block calls to particular destinations, or from specific extensions.

The configuration is the same as any other outbound rule, but the 5 routes are now set to block the calls.

Again, reminding you that the ordering of the rules is very important and that once the criteria have been met, the PBX will not move on to the next rule, to find a better match.


Outgoing calls do not necessarily need to be from a user extension. Sometimes outgoing calls are made from the PBX System Extensions.

There is a feature in the voicemail system, which allows outgoing calls to be made, from within the PBX Voicemail system. After authenticating to the voicemail system, entering the options of voicemail will give you an option to dial a number. This is disabled by default for security reasons. If enabled, the PBX is in a position to place calls from within the voicemail menu.

When making audio conference calls, the PBX will be able to make the outgoing calls to the external participants.

Sometimes when a call is being processed by the PBX, the call will need to be forwarded to an outside number. For example, when there is an extension exception in the forwarding rules which forwards to an outside number. Or, if the destination if no answer in a call queue or ring group is set to go to an external destination.

A call to an external destination, does not necessarily need to pass through a queue or ring group, but may be defined in an inbound rule to forward immediately and directly to an external number.

When using Call Queues, the Queue Callback feature will need to place calls to an external location.

These will all need to be configured in the outbound rules to allow calls to the external locations defined.

[SLIDE 10]

The system extensions of the PBX are not user extensions. They do not have a phone provisioned on them and they are not part of any extension group in the PBX.

Outbound calls from system extensions will fail when you have extension criteria and/or extension group criteria defined. The PBX will look for rules which do not have extension based restrictions defined in order to process the call.

The solution is the following. Order your rules so any extension specific rules are at the top of the list. Insert a blocking outbound rule for all user extensions or the extension groups underneath the extension rules.

Underneath this catch all blocking rule, add the rule or rules without extension or extension group restrictions.

[SLIDE 11]

The example shown here will allow user extensions to perform the calls to destinations they are allowed to make calls to. In the blue box, there is a rule which will block any other calls, originating from the extensions, from going out. Then in the orange section, the system extensions are allowed to go out, to specific destinations, with only the dialled number prefix being the restriction available for these extension less calls.

[SLIDE 12]

When making a call, the least cost that can be incurred is zero. It is always desired, when making an outgoing call that given the circumstances, that the least cost will be incurred in any outgoing call.

The PBX can be programmed to minimise the cost of outgoing calls.

This is achieved using the outbound rules and determining which trunk is cheapest for each destination. An outgoing rule can then be created for each costing route, in order to take advantage of lower rates through a particular provider.

It is very important in this particular case to notice the ordering of the rules as well as the order of the Providers in the 5 outgoing routes.

[SLIDE 13]

An example scenario would be the following:

Use a PSTN Gateway to process local landline calls. The local Telco may provide cheaper calls to the local networks.

Use a GSM Gateway to make calls to local mobile numbers. You may have a few SIM cards from the local mobile provider with unlimited calls to either their own or all networks.

A VoIP Provider may be used for long distance national and/or International calls.

A Bridge may be used to call extensions on a remote PBX, or use any resources connected to this PBX, for example gateways and/or VoIP Providers.

[SLIDE 14]

An example of the dialled number formatting for the UK is as follows.

For local calls within London, the number can start with any number from 1-9.

Long distance calls from London to other parts of the UK, like Manchester will start with 0 followed by the area code of the area you wish to dial.

Calling internationally, from London to Spain for example will have the number starting with 00 and followed by the country code, which in this case would be 34.

Calls over a bridge may sometimes need a prefix to be defined, in order to identify that it is a

call that needs go over a bridge. In this particular case, calling to a remote bridged extension of 153 may require a prefix, for example 6 followed by the extension number. Module 4.3 covers the configuration of bridges in more detail.

[SLIDE 15]

Configuring the rule for local calls is very simple. The outbound rule name will need to be descriptive, to indicate that this is for local calls. Please note that this will not affect the capability of the PBX to process calls, it is just very helpful when administering the PBX and eases troubleshooting. The prefix will need to be 1-9. The first route will then be defined as the PSTN gateway.

[SLIDE 16]

You can also define a local number in long distance format, in case someone accidentally dials the number in its entirety, or has a local number stored in a phonebook, in the long distance format. In this case you would add the number prefix as 020 and route the call through the PSTN gateway, after stripping away the 3 digits used for the London area code.

[SLIDE 17]

Likewise, you can also add a rule for the local numbers dialled in international format. The prefix would now be 004420 and routed through the PSTN Gateway after stripping away the 6 digits of the international country code of the UK and area code of London.

[SLIDE 18]

The rule to match the calls to mobile numbers would be configured with a prefix of 07.

The call would then be routed through the GSM Gateway which will process the calls at a lower cost than if they were processed through the PSTN Gateway. The PSTN Gateway could then be used as a backup route, if the GSM gateway is busy or unavailable to process the call.

[SLIDE 19]

For long distance calls, the outbound rule will need a prefix of 0. The routing would be via the PSTN gateway for Route 1 and the VoIP Provider will be defined as Route 2. This is to provide capacity in case the PSTN Gateway does not have enough channels, or is not available.

[SLIDE 20]

To make international calls, the prefix would need to be 00 and the routing would need to go through the VoIP Provider.

[SLIDE 21]

The order in which the rules are listed is very very important. There is a possibility that the rules will need to be reordered in order for the calls to be routed correctly.

For example, our intention in the following example is to have the international calls routed through the VoIP Provider.

From the rules shown here, we can see that when an extension dials 00, it will match the rule starting with a prefix of 0, which will route the calls through the PSTN Gateway and consequently, through the local telco which may have higher rates than the VoIP Provider.

Therefore our rules are ordered incorrectly.

[SLIDE 22]

Fortunately it is very easy to resolve this. All that is required is to select the rule for the international calls and press the “Move Up” button and move the rule above the local calls rule.

This will result in calls starting with a prefix of 00 going through the VoIP Provider instead of the PSTN gateway.

[SLIDE 23]

Calls through the Bridge, to bridged extensions are also configured through the outbound rules of the PBX.

You will need to have a prefix to signal the PBX to send the calls through the Bridge. In this case we will use the prefix of 6. If your remote PBX is using a 3 digit extension numbering scheme, you will define the length of the called numbers to 4. That is the prefix and the extension number.

The call will be routed through the Bridge connection, but in this case, you will strip the 1st digit, the 6 in this case so only the 3 digit extension number is sent to the remote PBX.

[SLIDE 24]

Calls through the Bridge, for remotely connected resources is also possible. In the example here, we can send calls destined for Germany, to go through the Bridge to a PBX we have in Germany and then be used to process the call using its own outbound rules.

The rule prefix to match calls to Germany would be 0049 or +49

The call will then be routed through the Bridge to the German Office. The 4 digit international dial code for Germany will be stripped from the number. If you are using +49 you would strip 3 digits only.

In order to process the number locally the provider would need a 0 in front of the dialled number, so we will prepend this to the number before sending it through the Bridge. The remote bridge would then use its outbound rules to process the call as a local call.

We can also send the call through the VoIP Provider as the 2nd route, but this call will be processed without any modification to the number.

[SLIDE 25]

Emergency numbers are the telephone numbers for the Police, Ambulance or Fire Department. Usually the emergency numbers are 3 digit numbers, which may overlap with the extension numbering.

During the deployment of the PBX, you will need to identify the emergency numbers which will be used. Avoid configuring extensions with these numbers. Common emergency numbers are: 112 in Europe, 911 in the United States, 999 in the United kingdom and 000 in Australia.

Emergency numbers will be configured from within the PBX settings. This will define a default outbound rule, which will be defined as the entire emergency number being the prefix.

[SLIDE 26]

Thank you, and goodbye!

Free for up to 1 year! Select preferred deployment:


for Linux on a $200 appliance or as a VM

Get the ISO


for Windows as a VM

Download the setup file

On the cloud

In your Google, Amazon, Azure account

Take the PBX Express