Does anyone know how to use the "Outbound Permissions" module?

Does it work with freepbx 2.6 - Asterisk 1.4.26 on Centos 5.3, using only sip trunks??

I am very confused,…almost need visual aids to understand the supplied instructions.

I have 4 extensions and 2 trunks and assume I need to create 3 outbound routes.

Here is what I have done.

I have 1st outbound route ‘to-pstn’ with only 1 possible trunk 'sip-callcentric’
Route 1, this one, has 0002|nxxxxxx dial patterns

I have 2nd outbound route ‘to-ecomm’ with only 1 possible trunk 'sip-ecomm’
Route 2 has 0001|nxxxxxx dial patterns

I have 3rd outbound route ‘to-default’ with 2 possible trunks ‘sip-callcentric’ and ‘sip-ecomm’ in that order.
Route 3 has no prefix nxxxxxx to the normal dial patterns

I want 6020 and 6030 extensions to use ‘to-pstn’ and make outbound calls using the trunk ‘sip-callcentric’

So: I set 6020,6030 to allow on ‘to-pstn’ and did 6020,6030 redirect 0002 on ‘to-ecomm’

I want 6005 and 6015 extensions to use ‘to-ecomm’ and make outbound calls using the trunk ‘sip-ecomm’

So: I set 6005,6015 to allow on ‘to-ecommm’ and did 6005,6015 redirect 0001 on ‘to-pstn’

Last but not least: I set All to Deny on the

Everything goes out on the ‘sip-callcentric’ trunk. It is the only trunk on the ‘to-pstn’ route and the 1st trunk on the 3rd outbound route called ‘to-default’ that’s the one with normal dial patterns ‘nxxxxxx’.

I have been at it for hours with trial and error. I am spinning the chamber now. Can someone help me before I pull the trigger.

I feel kind of silly for asking this but something is not clicking when I read these detailed instructions.

Did you by any chance happen to read Basic usage of route prefixes to reroute calls from specific extensions?

You may also want to read How to give a particular extension different or restricted trunk access for outgoing calls.

Unfortunately I can’t point you to any visual aids, but perhaps those links may assist your understanding.

Thanks for the suggestion. I am fluent in 5 different programming languages but I just can’t seem to comprehend the language of those articles and this “how to”.

I’ve done a lot of things with Asterisk and FreePBX but something about this just doesn’t click.

I know Asterisk is not designed to do multi-tenant scenarios but it would have the basics if I could just get over this hump.

The people I am doing this for are not for profit and they really need to keep a handle on where there money is going. At present they have separate sip trunks for departments and people. Keeping all their calls on their asigned trunks would be huge.

I finally got my head around the route prefix concept and got that to work.

If I dial 9 I can force calls to 1 outbound round and if I dial 8 they go to the other. I think I had that working earlier in my trials but I thought the outbound route permissions thing was supposed to eliminate the need for a dialing prefix.

If someone tries to make a call without a prefix they get a “call cannot be completed as dialed” message. If any phone dials with an 8 or 9 prefix the call goes out on the associated route whether I have denied the extension permission or not.

That kind of defeats what I thought was the purpose of the “outbound route permissions” module. Or,…maybe it is not installed properly on my system.

I can see it on the main setup menu and module admin. I also have the allow/deny stanza on my extension config page.


1st outbound route



Only trunk in “Trunk Sequence”


2nd outbound route



Only trunk in “Trunk Sequence”


3rd outbound route


If someone tries to dial out with 8 and their extension is set No on permissions for to-pstn (1st route) and the redirect on No permission is set to 9 they should go back through the dial plan and get a hit here,…right,…wrong??? Help it’s not working.


Only trunk in “Trunk Sequence”


3rd outbound route

If someone tries to dial out with 9 and their extension is set No on permissions for to-ecomm (2nd route) and the redirect on No permission is set to 9 they should go back through the dial plan and get a hit here,…right,…wrong??? Help it’s not working.


Only trunk in “Trunk Sequence”


Any clues would be GREATLY appreciated!



The answer is Yes. What are you trying to accomplish? Your first post is not clear at all.

You’re STILL working on this?

First of all, don’t use single digit numbers as you prefixes as those can get confused with something you might actually dial. Your users should NEVER, repeat NEVER, be actually dialing these prefixes - that defeats the whole point. So instead, use prefixes in a sequence… 00001, 00002, 00003… etc. Make them the same length (don’t have some that are 4 digits, some that are 5, etc.)

Here’s the part that may be confusing you: You SHOULD have a route that has no prefixes at all (something you apparently don’t have at the moment). It’s not necessary that any extensions actually be allowed to use it (though normally this would be the route that the majority of your extensions use), but you need to have it.

Now for each extension you want to restrict, on the extension set-up page, you should of course ALLOW access (by checking YES) to the route you want to use, BUT DON’T PUT THE PREFIX IN THE BOX FOR THAT ROUTE. When you have checked YES, the contents of the Redirect Prefix field is IGNORED. Instead, look at your catch-all route - the one that has the same patterns but with NO prefixes. You should DENY access (by checking NO) but THAT is where you put the prefix of pattern for the route you WANT it to use.

As an example, you have three routes for NANP numbers (which includes toll free numbers - your toll-free patterns in your examples are redundant and could be taken out):

Route 1: 00001|1NXXNXXXXXX
Route 2: 00002|1NXXNXXXXXX

You want a particular extension to use Route 2, so on the extensions page, outbound route permissions section…

Route 1: Check NO and put NOTHING in the Redirect Prefix field
Route 2: Check YES and put NOTHING in the Redirect Prefix field
Route 3: Check NO and put 00002 in the Redirect Prefix field

Again, the redirect prefix is IGNORED when YES is checked. Maybe there should be some sort of warning pop up if you try to save the settings and a YES box is checked and there is something in the prefix field, but right now there isn’t.

I hope this helps!

I will try this out ASAP and let you know what happens. I am on stacation today and have had way to many beers to try it out now.

This problem did make me look like and fell like the ultimate d&umba$$ but I think I am pretty good for an Asterisk Rookie. I Started in the winter of 2008 and did my 1st box without FreePBX.

I also did a full blown 1.6x install on an MSI Wind with the Ubuntu Netbook remix. I will be posting the “Install Doc/Process” soon.

Either way I appreciate all your input and help.



I am hitting on all 8 cylinders now thanks to the above instructions from “Wiseoldowl”.

If anyone else runs into this problem I think I finally “get it” and might be able to help. I even took it a step further with 4 routes so that if need be, I could use this in a “pseudo multi-tenant” environment with no dialing prefixes.

As for me and my home system,…my daughter can’t use my outbound route and I cannot use hers. That way all those 3 hour calls to her girlfriends actually go to a separate account with the provider.

I believe I have this set up correctly, however it doesn’t appear to work. I think i may be experiencing a bug, however.

I have a route that matches 1NXXNXXXXXX with permission denied at top of list. I have a redirect with code 00001. When i watch my log, i see an error (listed below). I get a message from my sip provider saying the number i’ve dialed is invalid. It appears that the redirect prefix gets added to the number and dialed out. In addition, it appears that the trunk used was the first trunk in the first 1NXXNXXXXXX

I found a post that referenced a similar bug, but everyone here seems to be referring to it as working. I downloaded the module from shows the status of the bug as “fixed” but not sure if that is something that either works differently under the trixbox variety of freepbx or if the latest version posted on the download page doesn’t include the referenced fixes.

[Dec 23 16:32:45] VERBOSE[4225] logger.c: – AGI Script Executing Application: (Goto) Options: (reroute|1)
[Dec 23 16:32:45] NOTICE[4225] pbx.c: No such label ‘reroute|1’ in extension ‘s’ in context ‘macro-dialout-trunk’
[Dec 23 16:32:45] WARNING[4225] pbx.c: Priority ‘reroute|1’ must be a number > 0, or valid label
[Dec 23 16:32:45] VERBOSE[4225] logger.c: – <SIP/201-b6e04f88>AGI Script checkperms.agi completed, returning 0
[Dec 23 16:32:45] VERBOSE[4225] logger.c: – Executing [[email protected]:3] e[1;36;40mGosubIfe[0;37;40m(“e[1;35;40mSIP/201-b6e04f88e[0;37;40m”, “e[1;35;40m0?sub-pincheck,s,1e[0;37;40m”) in new stack
[Dec 23 16:32:45] VERBOSE[4225] logger.c: – Executing [[email protected]:4] e[1;36;40mGotoIfe[0;37;40m(“e[1;35;40mSIP/201-b6e04f88e[0;37;40m”, “e[1;35;40m0?disabletrunk,1e[0;37;40m”) in new stack
[Dec 23 16:32:45] VERBOSE[4225] logger.c: – Executing [[email protected]:5] e[1;36;40mSete[0;37;40m(“e[1;35;40mSIP/201-b6e04f88e[0;37;40m”, “e[1;35;40mDIAL_NUMBER=000011812XXXXXXXe[0;37;40m”) in new stack