I would like to prompt my SIP/IAX users to enter a pin (same pin for all my users - I wanna keep it simple for now) before placing an international call…
this is what I currently have in my extensions.conf:
_.X => {
Playback(Please-enter-your-pin);
Read(pin);
if (${pin}=12345) {
Dial(Zap/g2/${EXTEN});
} else {
Playback(error);
Hangup(); // You may want a goto statement here instead to give them another chance
}
}
[code] -= Info about application ‘Authenticate’ =-
[Synopsis]
Authenticate a user
[Description]
Authenticate(password[|options]): This application asks the caller to enter a
given password in order to continue dialplan execution. If the password begins
with the ‘/’ character, it is interpreted as a file which contains a list of
valid passwords, listed 1 password per line in the file.
When using a database key, the value associated with the key can be anything.
Users have three attempts to authenticate before the channel is hung up. If the
passsword is invalid, the ‘j’ option is specified, and priority n+101 exists,
dialplan execution will continnue at this location.
Options:
a - Set the channels’ account code to the password that is entered
d - Interpret the given path as database key, not a literal file
j - Support jumping to n+101 if authentication fails
m - Interpret the given path as a file which contains a list of account
codes and password hashes delimited with ‘:’, listed one per line in
the file. When one of the passwords is matched, the channel will have
its account code set to the corresponding account code in the file.
r - Remove the database key upon successful entry (valid with ‘d’ only)
[/code]
[quote=“Ezz123”]cool… I used authenticate and worked well…
Thanks[/quote]
I’m looking to do something similar, but I want users to login once (in the morning) when they come into the office to use their extension, and log off, when leaving - or timeout after 1Hr or so.
Am a bit of a newbie and am using FreePBX mostly for my config, but i’m not new to CLI & Linux
Then use authenticate and set a flag in the database that to make a call must be 1 if its not get the user to authenticate and set it
Ian[/quote]
Thanks Ian (Astmaster) That sounds great, except i’m not sure how i would go about it. Is this something i’d do in my extensions_custom.conf or through the an AGI script (of which i wouldnt know how to hook it into asterisk so it would be called on asterisk reload)
If you could give me some basic direction i’d really appreciate it.
Scenario 1:
Setup is users dial “0” to get a dialtone for outbound calls - and “0” is just a queue that will connect to the first available FX0 port (Grandstream GWX41004/8 /w 2 stage dialing)
Scenario 2:
Setup is where users just dial the number they want (unaltered) and the oubound routes have rules that match local, cellphone, and internation numbers - all these go through at “FreePBX” trunk (GWX41004/8 /w 1 stage dialing) or through some SIP trunks I have with Broadvoice etc…
I would like for both scenarios to need authentication for outbound calls, by logging in to an extension & logging out - its the users responsability to lock/unlock their phone.