Help with extensions.conf

Hi, i’m starting with asterisk this year, in the company that i work, we’re trying to “Block” external and transfer, calls for some people…

we use khomp channel bank, i did a dialplan for a sip and work well…

[test]
exten => _XXXX,1,NoOp("My Extension = ${CALLERID(num)}")
exten => _XXXX,2,GotoIf($["${CALLERID(num)}" = "100"]?call:hangup)
exten => _XXXX,n(call),Dial(SIP/${EXTEN})
exten => _XXXX,n(hangup),Hangup()
exten => _XXXX,n,Hangup()

this context is for 1 sip only, if my extension number is 100 i can call…
but I need one context for all channels…

i have 24 khomp channels, 15 channels can make calls, and the other 9 cant make…
how i can make this work ?
Sorry about this bad english,i’m from Brazil !
Thank you guys !

If the khomp is a dahdi device, just give them different contexts.

If it is a SIP device, does it identify the channel in some way. If it does, route to a context based on that information, If it doesn’t, you are out of luck.

change the variable ${CALLERID(num)} for the ${CONTEXT} variable and make2 different contexts for example like admins & users… put the devices that you want to block in the users context… using you dial plan could be something like this…

NO TESTED JUST FOR GIVE YOU AND IDEA.

[test]
exten => _XXXX,1,NoOp(“My context = ${CONTEXT}”)
exten => _XXXX,2,GotoIf($["${CONTEXT}" = “users”]?call:hangup)
exten => _XXXX,n(call),Dial(SIP/${EXTEN})
exten => _XXXX,n(hangup),Hangup()
exten => _XXXX,n,Hangup()