Dialing Rules per User PIN

Dear All,

All users are require to enter their PIN for outgoing call, I need to set the Dialing Rules per User PIN basis?

for example:

User with PIN 8899 can only do to local and mobile call
User with PIN 6780 can only do local call only

They should be able to use it on any SIP station with their own Dialing Rules.

Please help

Thanks & Regards


This can be easily done using the PHPAGI class, but you can too do it using the the Asterisk dial plan only. Where exactly do you need help, post what have you done to achieve this task and we can give you a push to get your goal


What I have now is only have create their PIN, and I dont know to set the dial plan per user PIN basis.
Could you please help?

I am running Asterisk 1.8.x

Many thanks in advance.



If you know how to use the PHPAGI class i can share some piece of code …

No tested and just thinking fast, this could be another way of the infinitive ways to to get this work


Create 2 password files, one with the premium pins, for call to mobiles and local and the second one just with the pins for local calls.

User with pins for calls to mobiles dial *4 and Asterisk will ask for the pin if the pin it is correct will be get access to the mobile context.

User with pins for just dial local dial *5 and Asterisk will ask for the pin if the pin it is correct will get access to the local context.

Hi… Thanks a lot :smile: for the hints
I will try it… get back to you soon.



Welcome, remember this is just an idea, you can improve it or modify it. Just let me know please if it work for you.

could you please advise, where should I define the localphone?


sorry, may be I am asking a basic question… (I am still learning)

Thanks a lot in advance


Any other question here you can find the answer