Dial prefix for outside line

Sorry for asking such a newbe question… but… I have just built a new freepbx system and want to set our outbound route so that a 9 has to be dialled first to make an outbound call.

I can make outbound calls without a prefix so I know the trunks are working by simply entering XXXXXX in to the match pattern box ( basic 6 digit local number )

To use a 9 for an outside line I have entered a 9 into the prefix box but it doesn’t work. From what I can make out the rules suggest that if the match pattern is correct anything in the prefix box would be removed hence why I thought that’s where it goes.

On an older trixbox system I used to use 9|. but I can no longer enter that.

Many Thanks

The 9 goes in the Prefix box. What do you mean it doesn’t work? Check the log /var/log/asterisk/full and see what was dialed.

I have added the 9 back to the Prefix box and can confirm that UK National numbers are working fine i.e. 9 in prefix and XXXXXXXXXXX in the Match pattern box.

It may also be worth noting that I also have another outbound rule that allows outbound calls without the 9, i.e. nothing in prefix and XXXXXXXXXXX in Match Pattern. Not sure if this is confusing things but thought it was worth mentioning

So… this is where I am confused. In the UK most local calls are 6 digits… therefore i also have a rule with 9 in prefix and XXXXXX in Match pattern… this doesn’t work but the same rule without the 9 does…?

I have to be missing something somewhere… just can’t see it…


Because I’m trying to learn differences between Dial Patterns (matching patterns) in Outbound Routes and Dial Rules in Trunks (I’m a newbie) I found this How-To that you may find interesting too.

In my case, in Italy, PBX systems uses the digit “0” to access external PSTN lines (not the “9” typically used abroad) and, AFAIK, National calls to land-line users could have a number of digits between (at least) 6 and (at most) 10 (with the very first digit equals to zero “0”, not to be confused with the access code stated above), e.g. from (02)1234 to (0123)123456, but there are also national emergency services like 1xx that have only 3 digits (without zero “0” as leading digit), e.g. 118, 113 and so on.
There are Toll Free Numbers that start with (8xx) that could have a range of digits between 7 and 9.
Finally Mobile Phone Numbers always start with (3xx, which represents the Mobile Operator Prefix) and have then 7 digits for completing the number.
I’m trying to understand what type (or types) of Dial Pattern(s) I must implement on the Outbound Route I’ve defined.

The line access code “0” (to seize an outside line, “9” in your case) should be placed on the Prefix tag of Outbound Routes Dial Patterns section so it will be removed on a successful match and the whole dialled number (that matches a dialling pattern) will be then routed to the selected Trunk (in my case DAHDI/g0, as example) without that line access code (“0” in my case, “9” in your case).



We are testing some SIP lines which are new to us as we have always used ISDN. With the SIP lines you always need to dial the local dialing code, in our case 01455 ( we are in the UK )

Our system is also set to require a 9 for an outside line.

What i am confused is how to create a dial plan that adds “01455” to any XXXXXX ( 6 digit ) dialing number with a 9

At the moment my dial plan looks like (BLANK)+9|{XXXXXX]

I have tried (01455)+9|[XXXXXX] … but i didn’t work

Any pointers would be very much appreciated.