Hi
I'm trying to configure asterisk for asking users to enter a PIN code after dialing out a external number, I want to check if the user PIN code has rights for making the call that is attempting (for example long distance), The PIN code is located in a Mysql Dababase:
What I'm trying to do is something like this:
- Users dial 9 + external number
-The number is saved in a variable
-The user is asked to enter the PIN code
-I run agiphp script that check if the PIN code exists and has rights for the type of number dialed (No problem with this script)
-I send the call out for DAHDI channel 1 or restrict the call if the PIN used has not permision
I dont have any problems with the agiphp mysql script, What I'm trying to do in the dial plan is the following:
exten => _9X.,n,Set(OUTGOINGNUMBER=${EXTEN:1}); saved dialed number in OUTGOINGNUMBER
exten => _9X.,Read(pin,astcc-digit-account-number&astcc-followed-by-the-pound-key); ask for PIN
same => n,Playback("one-moment-please")
same => n,AGI(ckeckpinlevel.php,${pin}${OUTGOINGNUMBER}); check if PIN has rights
same => n,GotoIf($[${EXISTS(${permisionok)}]?call); If has pemition goto call
same => n,Congestion(2); User PIN is restricted
same => n,Hangup
same => n(call),Dial(DAHDI/1/${OUTGOINGNUMBER}); Dialing external number
I dont know If this is the way to do it?
Please, Any ideas?
I'm trying to configure asterisk for asking users to enter a PIN code after dialing out a external number, I want to check if the user PIN code has rights for making the call that is attempting (for example long distance), The PIN code is located in a Mysql Dababase:
What I'm trying to do is something like this:
- Users dial 9 + external number
-The number is saved in a variable
-The user is asked to enter the PIN code
-I run agiphp script that check if the PIN code exists and has rights for the type of number dialed (No problem with this script)
-I send the call out for DAHDI channel 1 or restrict the call if the PIN used has not permision
I dont have any problems with the agiphp mysql script, What I'm trying to do in the dial plan is the following:
exten => _9X.,n,Set(OUTGOINGNUMBER=${EXTEN:1}); saved dialed number in OUTGOINGNUMBER
exten => _9X.,Read(pin,astcc-digit-account-number&astcc-followed-by-the-pound-key); ask for PIN
same => n,Playback("one-moment-please")
same => n,AGI(ckeckpinlevel.php,${pin}${OUTGOINGNUMBER}); check if PIN has rights
same => n,GotoIf($[${EXISTS(${permisionok)}]?call); If has pemition goto call
same => n,Congestion(2); User PIN is restricted
same => n,Hangup
same => n(call),Dial(DAHDI/1/${OUTGOINGNUMBER}); Dialing external number
I dont know If this is the way to do it?
Please, Any ideas?