How-to limit outbound calls


I’m looking for the best way to limit outbound call.

Here is the point: I have several SIP phones (some are softphones, other hard) and I want to forbid some of this phones to call some destinations.

Is the best way : using AGI or in the .conf area of Asterisk ?

Could you provide some example ?


not necessarily the best way (as that’s much a matter of opinion)
however probably one of the easiest ways would be to simply put all your sip accounts into one context, let’s call it “limited” and not allow the limited context to call the various numbers you want

for example, let’s assume you want your “limited group” to be able to call any number starting with area code 515 except the numbers in area code 515 starting with the digits 555. here is an example



; these section allows outbound calls starting with area code 515 and
; having 7 training digits
exten => _515XXXXXXX,1,Dial(Zap/4/${EXTEN})
exten => _515XXXXXXX,2,Congestion()

; this section is more precise then the above section so
; if someone calls anything with area code 515 and the first 3 digits (of 7)
; 555, then they will recieve a message indicating they are not authorized
; to call 515555xxxx and then the system will hangup.
exten => _515555XXXX,1,Playback(sorry_not_authorized)
exten => _515555XXXX,2,Hangup()

Note: in this example, the outgoing line is hardcoded to be Zap/4
you should replace that with your outgoing line or line groups.

also in the app Playback, I"ve passed the argument “sorry_not_authorized”), this assumes you have some type of message called sorry_not_authorized in some valid sound format on your system in the proper sounds directory.

I’m going to try this.
I found out in … t=outbound an idea very close to yours and easy to implement (no coding).
I will create context specific to group of users and define within these context specific dialplan.