# Extensions between calls blocking

**URL:** <https://community.freepbx.org/t/extensions-between-calls-blocking/23107>\
**Category:** Tips and Tricks\
**Created:** [July 12, 2014, 4:15am UTC](https://community.freepbx.org/t/extensions-between-calls-blocking/23107 "2014-07-12T04:15:37Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rfernandez\_net](https://community.freepbx.org/letter_avatar_proxy/v4/letter/r/fbc32d/32.png) [@rfernandez\_net](https://community.freepbx.org/u/rfernandez_net)\
**Post date:** [July 12, 2014, 4:15am UTC](https://community.freepbx.org/t/extensions-between-calls-blocking/23107/1 "2014-07-12T04:15:38Z")

</div>

hi friends!! i was searching for make a custom context for block calls between extensions

Scenario:

Lets supose that we have in the range A: extensions from 100 to 199 and in range B: 200 to 299 and in C 1000 to 1999

i was looking in the forum and i found this context:

[from-group-15xx]  
exten =\> 1[012346789]XX,1,playback(ss-noservice)  
exten =\> 1[012346789]XX,n,Hangup()  
include =\> from-internal

as i read in the article they said that it is blocking all the extensions but not the 15xx im trying to do my own but it is not working let me cut and paste my code:

[from-group-1x]  
exten =\> 1[013456789]X,1,playback(ss-noservice)  
exten =\> 1[013456789]X,n,Hangup()  
include =\> from-internal

[from-group-2x]  
exten =\> 1[0123456789]X,1,playback(ss-noservice)  
exten =\> 1[0123456789]X,n,Hangup()  
include =\> from-internal

thanks in advance!!

---

<div class="post-metadata">

**Author:** ![lgaetz](https://community.freepbx.org/user_avatar/community.freepbx.org/lgaetz/32/22393_2.png) [@lgaetz](https://community.freepbx.org/u/lgaetz)\
**Post date:** [July 12, 2014, 11:38am UTC](https://community.freepbx.org/t/extensions-between-calls-blocking/23107/2 "2014-07-12T11:38:12Z")

</div>

You are on the right track, but you are missing one critical part. When trying to match an extension by pattern in Asterisk, you must prefix the pattern with an underscore. Your context should look like this:

```
[from-group-1x]
exten => _1[013456789]X,1,playback(ss-noservice)
exten => _1[013456789]X,n,Hangup()
include => from-internal
```

---

<div class="post-metadata">

**Author:** ![rfernandez\_net](https://community.freepbx.org/letter_avatar_proxy/v4/letter/r/fbc32d/32.png) [@rfernandez\_net](https://community.freepbx.org/u/rfernandez_net)\
**Post date:** [July 14, 2014, 4:10am UTC](https://community.freepbx.org/t/extensions-between-calls-blocking/23107/3 "2014-07-14T04:10:19Z")

</div>

thank you!!! im testing the context, i will put now how i made it to work (obviouslly with your help:  
we will block with this all the extensions diffeent from&nbsp; 100 domain  
[from-group-10x]  
exten =\> \_[23456789]XX,1,playback(ss-noservice)  
exten =\> \_[23456789]XX,n,Hangup()  
include =\> from-internal

;we will block with this all the extensions diffeent from 200 domain  
[from-group-20x]  
exten =\> \_[13456789]XX,1,playback(ss-noservice)  
exten =\> \_[13456789]XX,n,Hangup()  
include =\> from-internal

now one question! lets suppose that i want to block the 110 and above the context will be:

[from-group-10x-decimal]  
exten =\> \_[23456789][123456789]X,1,playback(ss-noservice)  
exten =\> \_[23456789][123456789]X,n,Hangup()  
include =\> from-internal

can be? or it is my immagination only?

best regards!

---

<div class="post-metadata">

**Author:** ![dicko](https://community.freepbx.org/user_avatar/community.freepbx.org/dicko/32/8712_2.png) [@dicko](https://community.freepbx.org/u/dicko)\
**Post date:** [July 14, 2014, 4:17am UTC](https://community.freepbx.org/t/extensions-between-calls-blocking/23107/4 "2014-07-14T04:17:40Z")

</div>

23456789 = 2-9 for convience also = n

---

<div class="post-metadata">

**Author:** ![rfernandez\_net](https://community.freepbx.org/letter_avatar_proxy/v4/letter/r/fbc32d/32.png) [@rfernandez\_net](https://community.freepbx.org/u/rfernandez_net)\
**Post date:** [July 14, 2014, 4:31am UTC](https://community.freepbx.org/t/extensions-between-calls-blocking/23107/5 "2014-07-14T04:31:30Z")

</div>

mmphpmh (smoking and thinking)

[from-group-10x-decimal]  
exten =\> \_[2-9][1-9]X,1,playback(ss-noservice)  
exten =\> \_[2-9][1-9]X,n,Hangup()  
include =\> from-internal

something like that? (sounds like a “perl array” ) =)

---

<div class="post-metadata">

**Author:** ![fmunoz86](https://community.freepbx.org/letter_avatar_proxy/v4/letter/f/49beb7/32.png) [@fmunoz86](https://community.freepbx.org/u/fmunoz86)\
**Post date:** [June 27, 2015, 7:30pm UTC](https://community.freepbx.org/t/extensions-between-calls-blocking/23107/6 "2015-06-27T19:30:13Z")

</div>

hey

I’m having some problems getting this configure in Box this is my first time attempting to edit any files in asterisk DIR  
Question 1  
-the file that i need to edit is extensions\_custom.conf ?

What im attempting con accomplish

I have 9 range of extinctions that i need to block My range are 20xx , 30xx, 40xx 50xx 60xx 70xx 80xx 90xx  
I dont want this ranges to communicate internally.

Base on the information i have been reading this is what i have don but is not working for me

[from-group-20xx]  
exten =\> \_[13456789]XXX,1,playback(ss-noservice)  
exten =\> \_[13456789]XXX,n,Hangup()  
include =\> from-internal

[from-group-30xx]  
exten =\> \_[12456789]XXX,1,playback(ss-noservice)  
exten =\> \_[12456789]XXX,n,Hangup()  
include =\> from-internal

Any Help Please

---

<div class="post-metadata">

**Author:** ![fmunoz86](https://community.freepbx.org/letter_avatar_proxy/v4/letter/f/49beb7/32.png) [@fmunoz86](https://community.freepbx.org/u/fmunoz86)\
**Post date:** [July 11, 2015, 12:38am UTC](https://community.freepbx.org/t/extensions-between-calls-blocking/23107/7 "2015-07-11T00:38:47Z")

</div>

Hi

I new to free pbx and i have the same problem im flowing the blog but im a bit lost … in what file do i need to make this changes ?
