Restrict or block calls between 2 or more extensions

hi want to restrick/block the calls between 2 or more extensions or between extensions groups
i dont want that extension 201 can receive calls from 202 but 201 can call 202
or dont want to make calls from 202 to 201
or dont want comunication between 203 and 204
or i dont want comunication between the extensions range 200-299 and the 100-199 exept the 102 that can call every extension
how can i do something like that its there a way to do that i need a guide or example
all my extensions are sip and my trunks too
i have asterisk 11.5 please helpme

This is very basic, you should read this asteriskdocs.org/ and learn the concepts of (Context,Gotoif,Expressions,Variables,pattern matching). There are many ways to achieve what you want. Here you have a little and fast example

[quote][admin]
exten =>_1XX,1,GotoIf($[$["${CALLERID(num)}" = “102”] & $["${EXTEN}" = “101”]]?disallow:allow)

same=>n(disallow),Playback(ss-noservice)
same =>n,Hangup()

same =>n(allow),Dial(SIP/${EXTEN},25)
same =>n,Hangup()[/quote]

extension 101 can not receive calls from 102 but 101 can call 102

hi thanks for your answer i m learning im beginner/noob where its suppose to be that configuration in the extensions_custom.conf or where? i need to change another options?
i insert the code in the from-internal-custom
exten =>_1XX,1,GotoIf($[$["${CALLERID(num)}" = “102”] & $["${EXTEN}" = “101”]]?disallow:allow)
same=>n(disallow),Playback(ss-noservice)
same =>n,Hangup()
same =>n(allow),Dial(SIP/${EXTEN},25)
same =>n,Hangup()
and it works how can i add more extensions??? if i want more than 1 extension to dont have access to that extension extample the 103 and 104 or if i want and entire range like 1X0?

i dont know if i did the right thing hope if you can correct me
i add in the [from-internal-custom] this the first part it to block all the extensions from range 201-210 connect the extensions 101-112 except the 210
and the last part all the extensions from range 101-112 connect the extensions 201-210 except the 102,108,110,111 they can tall with all that extensions

exten =>_1XX,1,GotoIf($[$["${CALLERID(num)}" = “201” | “${CALLERID(num)}” = “202” | “${CALLERID(num)}” = “203” | “${CALLERID(num)}” = “204” | “${CALLERID(num)}” = “205” | “${CALLERID(num)}” = “206” | “${CALLERID(num)}” = “207” | “${CALLERID(num)}” = “208” | “${CALLERID(num)}” = “209” ] & $["${EXTEN}" = “101” | “${EXTEN}” = “102” | “${EXTEN}” = “103” | “${EXTEN}” = “104” | “${EXTEN}” = “105” | “${EXTEN}” = “106” | “${EXTEN}” = “107” | “${EXTEN}” = “108” | “${EXTEN}” = “109” | “${EXTEN}” = “110” | “${EXTEN}” = “111” | “${EXTEN}” = “112”]]?disallow:allow)
same=>n(disallow),Playback(ss-noservice)
same =>n,Hangup()
same =>n(allow),Dial(SIP/${EXTEN},25)
same =>n,Hangup()
exten =>_2XX,1,GotoIf($[$["${CALLERID(num)}" = “101” | “${CALLERID(num)}” = “103” | “${CALLERID(num)}” = “104” | “${CALLERID(num)}” = “105” | “${CALLERID(num)}” = “106” | “${CALLERID(num)}” = “107” | “${CALLERID(num)}” = “109” | “${CALLERID(num)}” = “112”] & $["${EXTEN}" = “201” | “${EXTEN}” = “202” | “${EXTEN}” = “203” | “${EXTEN}” = “204” | “${EXTEN}” = “205” | “${EXTEN}” = “206” | “${EXTEN}” = “207” | “${EXTEN}” = “208” | “${EXTEN}” = “209”]]?disallow:allow)
same=>n(disallow),Playback(ss-noservice)
same =>n,Hangup()
same =>n(allow),Dial(SIP/${EXTEN},25)
same =>n,Hangup()

its ther a way to make it more simple or optimize it?

It appears that you are using something like FreePBX, where the GUI maintains teh configuration files… Although the end result is going to be the use of contexts, the way that you set this up will be considerably different with the GUI, so you should get your support from the GUI community (e.g. www.freepbx.org) not the Asterisk one.

Remember the basic rule of GUIs: they may simple things very easy and complex ones impossible.