Custom Contexts bug denying outbound route

I’m new to freepbx so forgive me if I’m getting this wrong (but I’ve been using asterisk and writing dialplans for years)…

I’m using the latest FreePBX (2.110.23) with Custom Contexts 2.8.0rc1.1. I have 2 outbound routes, and I noticed that even though I deny one of the routes, my dialplan still matches and uses that outbound route.

Tracing through the extensions_additional.conf I discovered that my custom context has “include => from-internal-additional”, and the context [from-internal-additional] includes “include => outbound-allroutes”. So all routes remain visible, even if individually denied!

Unless I deny “Entire Basic Internal Dialplan” from my custom context, my denied routes will still be accessible. (And that breaks other functionality I want to keep).

Furthermore, the priority of from-internal-additional places it after the first outrt include, and before the second. This too will mess up the route priorities for the custom context.


Yesterday I’m gone through Custom Context for the very first time
To deny matching dialplan to access outbound rules I noted I had to " Set all to: deny rules"
Any other combination of settings produces the outbound rules to be accessible anyway.
Probably I haven’t understood the context priority mechanism ,
I found no clear documentation about, let’s see how someone experienced answers about…

I don’t think Custom Contexts is still supported. Upgrade to the lastest FreePBX distro 5.211.65 and install the free commercial module “extension routing” which will allow you to control which extensions are allowed to use specific outbound routes.

If you want to stick with Custom Contexts you need to define the “Default Internal Context” as such:
Custom Internal Dialplan -> ALLOW
Call Parking -> DENY
ENTIRE Basic Internal Dialplan -> DENY

and then define the “Internal Dialplan” to allow/deny the routes you want
and then define the outbound routes you allow.

Not a bug, follow the link on the custum-contexts page:-

Dicko - That’s the page i used to configure my custom extensions module. And the custom extensions work great for limiting outbound route access - but only if I disable “Entire Basic Internal Dialplan”.

However, when I do so then I lose access to other internal extensions. Is that by design? So I can only access selected outbound routes OR internal extensions?

Seems wrong somehow

dcitelecom - I am running the latest FreePBX distro and I did see that module available. However, I also need to implemented a situation where the some extensions need access to all routes, but need them in different priorities. I think only custom contexts can do that?

(Or create duplicate outbound routes in every possible order and then enable a working combination - but sounds like wrong approach?)

Perhaps you need to read it again, from that link:-

If you allow “ENTIRE Basic Internal Dialplan”, then it overrides every other selection on the page. You would normally only use this with a time rule, to allow your unaltered dialplan to be used for a portion of the day. Allowing the “ENTIRE Basic Internal Dialplan” without using a time rule is usually pointless. If you want control over individual items, deny “ENTIRE Basic Internal Dialplan”, and allow only what you want.

one wonders what else you missed :wink:

I think you misunderstand - when I disable “Entire basic internal dialplan” then I lose access to internal extensions. How do I keep access to internal extensions while also disabling selected routes?

I think YOU misunderstand :slight_smile: When you deny basic internal dialplan and then allow all the subordinate internal dialplans/contexts then you haven’t changed anything, if however you have denied ext-local then you won’t have access to the ext-local context (which is the context within which local extensions communicate with each other), it is just like that, if you also deny ALL OUTBOUND ROUTES within that context, then you will have to allow within the out-bound routes the ones you want to with the priorities you care to define.

Please also be aware that this is an unsupported module and comes with the caveate that you should to be an “expert” to use it, in your case you assure us you are such a person so that should not be a problem in your case.

. . . you can easily read the generated custom contexts you created with all the #includes you chose in your extensions*.conf files

I think we’re back to where this post began…I’ve done the above. And I’ve looked at the includes and FreePBX is including all outbound routes twice. The second include is the problem…I think I’ll look at github or wherever the author(s) reside to see if they can shed light on this…

You are doing something wrong, allowing ONLY from-local and one outbound route produces in extentions_additional.conf a context

include => ocgtld-custom
include => ext-local
include => outrt-1
include => ocgtld_bad-number
include => bad-number
exten => s,1,Macro(hangupcall,)
exten => h,1,Macro(hangupcall,)

; end of [ocgtld]

(plus the rule match and bad number associated contexts)

( . . ONLY ext-local . . .)

I am using Custom Contexts and it works.

  1. You need to deny the entire Basic Internal Dialplan

  2. In the next section you only allow parts on the internal dialplan
    but you have to deny All Outbound Routes. (Make sure ext-local has a priority of 50)

  3. In the next section you allow the outbound route to want and deny the other.

  4. In the EXTENSION you go to the Custom Context dropdown list and
    select the context you created. Make sure it’s not the Allow All (default).

Exactly, just like it says in the previously posted link, the priority sets the order in which the various bits are “included” and by default reflect the order in the more normal FreePBX contexts, if in doubt, just read the link again, this time “with feeling” :-).

Well, I’ve read every comment, (with feeling and without) and no one seems to mention the fact that using any arrangement of custom context (except the “ALLOW ALL (Default)” which, as far as I can tell, just bypasses the module) will deny access from any extension to paging. Thoughts on how this might be remedied…?

I believe paging is part of:-


The version of custom contexts stated in this thread as 2.8 will not work on any current freepbx version. You’d need to use

And custom contexts. Don’t think I have the option of upgrading…but didn’t think there was a later version of c/c available anyway.

You provided no information about your system so your guess is as good as mine