Restrict internal extension calls


I am currently using AsteriskNow which include this FreePBX.

Now I am looking solution how to restrict calls.

I have extension/extension groups 100 000 - 199 999 and 200 000 - 299 999. How I can make rule that only allow internal call between 100 000 - 199 999 extensions but not can’t make call 200 000 - 299 999?

I have understand that I need to make modifications in sip_custom.conf and extensions_custom.conf?

I have found those configuration files under /etc/asterisk/ but it’s only way to edit those using SSH? I have also found that there should be something file editor in FreePBX?

Use the class of Service module instead of screwing around with the config files

1 Like

Thanks but there is not any free module?

I tested that module but didn’t found solution how I can restrict calls between extensions.

it works perfectly. we use it at some schools to prevent the students from dialing the paging system. you can say that extension x cannot dial extension y which i assumed is what you were trying to do

Hmm… then I do not know how to use that module because problem is that what you are saying that when I make call like 100101 to 200101 I want that to happened.

Do I need make like paging group and that way block calls?

Because now I tested in extension_custom.conf and put these in

exten => _[23456789]XXXXX,1,playback(ss-noservice)
exten => _[23456789]XXXXX,n,Hangup()
include => from-internal

exten => _[13456789]XXXXX,1,playback(ss-noservice)
exten => _[13456789]XXXXX,n,Hangup()
include => from-internal

Those works fine.

@bksales boy do I wish it was that easy.

Please correct me if I’m wrong however my understanding is that the COS module will restrict all kinds of stuff like trunks, paging, queues etc however there is no extension to extension restrictions.

There is no way from the interface to restrict extension to extension calling.

Yes, that is same conclusion which I found.

Could one of the season veterans chime in with an official response please.

COS will not let you restrict dialing between extension. Only between other things like ring groups, queues, feature codes and routes. But it has no ability to restrict what extensions can be called.

On the other hand, you can write a replace from “from-internal” like “from-internal-1000:” which would stop you from dialing “2xxx” numbers and “from-internal-2000” to block “1xxx” numbers.

Use “from-local” from extensions.conf as you template.

@cynjut Do you mean that I will use that from-internal-100000 and context from-internal-200000 in FreePBX extensions context?

But if I do that then nothing works because I need to also make in extension_custom.conf like this

exten => _[23456789]XXXXX,1,playback(ss-noservice)
exten => _[23456789]XXXXX,n,Hangup()
include => from-internal

exten => _[13456789]XXXXX,1,playback(ss-noservice)
exten => _[13456789]XXXXX,n,Hangup()
include => from-internal

Then I can allow extensions make calls inside 100000 and 200000 extension but also when I make more extensions like 300000 group I can make new modification in extensions_custom.conf file?

exten => _[12456789]XXXXX,1,playback(ss-noservice)
exten => _[12456789]XXXXX,n,Hangup()
include => from-internal

Which allow 300000 extensions makes internal call between them.


Just stay in the [from-internal-custom] context. There is no need to include the from-internal context as the custom context is executed before the from-internal context.

All you have to do to limit calls between extensions is to use something like that:

;disallow calls from extensions 1XXXXX to 2XXXXX
exten => _2XXXXX/_1XXXXX,1,Hangup

;disallow calls from extensions 2XXXXX to 1XXXXX
exten => _1XXXXX/_2XXXXX,1,Hangup

Insert these lines to the extensions_custom.conf file and then run the command:

rasterisk -x'dialplan reload'

from the Linux console.

Thank you,

Daniel Friedman
Trixton LTD.

1 Like

Or in [ext-local-custom], starting at

exten => s,1,

Logically if the length of ${EXTEN} and ${DB(AMPUSER/${AMPUSER}/cidnum)} are both 6 and ${EXTEN:0:1} is not equal to the the first digit of the same cidnnum,` then you could, perhaps, reasonably and preemptively signal unavailable and then hangup.

The simplest way is Custom Contexts.
This example shows access to just one ring group and to a limited extension range.

So, the answer to the original question is obviously “Yes”.

There are lots of ways of blocking this. Pick one and go for it.

I started using that Custom Contexts solution and that is working fine. Thanks for helping.

Any chance you could share some detail about how you got this to work by using Custom Contexts, UnknowPerson?

This thread was a lot of help. Blocking extension to extension did not work for me though. I created a new context in extensions_custom.conf called [From-Internal-new] and added that context to a test extension. I then copied everything from the context [From-internal-additional] located in extensions_additional.conf. I started commenting out lines to see which one would stop extension to extension calling. The 2 lines that stop this is ext-findmefollow and ext-local.

I will play with this more in the future, but it worked for stopping extension to extension calls. You will probably have to make a custom From-internal like context for each group and a custom ext-local like context for each of those groups.