Restrict PSTN Call


I want to restrict some sip phones so that they will not able to dial pstn.
I know there is “Authentication” app that i can use but, i don’t want the user to press the password first before they are making pstn call.
Said I have SIP phone with extension 4112 and 4242
I want to allow 4112 to dial 9xxxxx
but the 4242 is not allow. how to achive this?

you need to read up on contexts and the way Asterisk uses them.

if you give 4242 access to a context in extensions.conf that doesn’t include the extension definitions/stanzas for 9XXXXX then if they do dial it, there’s no match, and therefore no call.

I see…

One last question

Is it possible for a SIP Phone belong to 2 context?

no, but you can “include =>” one context within another.

seriously, read the free book linked to in the sticky at the top of this forum. once you understand contexts it’ll be like a big light coming on in your understanding of Asterisk.

agree w/ baconbuttie most of this info is very widely available. check out the ebook asterisk: the future of telephony (see the sticky post at the top of the forum) or buy it in dead-tree format on o’rilley books.

to throw in a bit more detail:

exten => something,1,whatever
include => phone2s-context

exten => somethingelse,1,whatever