Gustavo A Gonzalez wrote:>
> Hello! I am looking for a configuration sample to authenticate
> outgoing calls. The idea is that each user have a password to dial any
> number. I was reading about Asterisk cmd Authenticate, Disa, etc. But
> I don?t know how use this tools when I have running
>
exten => _9NXXXXXX,1,Set(RESTRICT=${DB(dialing/restricted)})
exten => _9NXXXXXX,n,GotoIf($["${RESTRICT}" = "YES"]?3:7)
exten => _9NXXXXXX,n,Gosub(check_password,s,1)
exten => _9NXXXXXX,n,GotoIf($["${admin.afterhours}" =
"Y"]?5:3)
exten => _9NXXXXXX,n,Set(CDR(userfield)=${admin.password})
exten => _9NXXXXXX,n,Playback(auth-thankyou)
exten => _9NXXXXXX,n,Set(_ARG1=${CALLERID(num)})
exten => _9NXXXXXX,n,Gosub(set_callerid,s,1)
exten => _9NXXXXXX,n,Dial(ZAP/G1/${EXTEN:1})
exten => _9NXXXXXX,n,NoOP(${DIALSTATUS})
exten => _9NXXXXXX,n,NoOP(Hangup Cause: ${HANGUPCAUSE})
exten => _9NXXXXXX,n,Hangup()
I have a cron job that locks the system with asterisk -rx 'database put
dialing restricted YES'
And the check_password looks like:
[check_password]
;***********************************************************
;* Connect to SQL database to see if there is a match for **
;* the entry made by the end user **
;***********************************************************
exten => s,1,Read(get-admin-password|enter-password|||3|)
exten => s,n,Gotoif($["${LEN(${get-admin-password})}" <
"1"]?10:3)
exten => s,n,MYSQL(Connect connid localhost username 'password'
Administration)
exten => s,n,GotoIf($["${MYSQL_STATUS}" =
"-1"]?mysql_failed,s,1)
exten => s,n,MYSQL(Query resultid ${connid} SELECT somestuff.aswell)
exten => s,n,MYSQL(Fetch fetchid ${resultid} somestuff.here)
exten => s,n,MYSQL(Disconnect ${connid})
exten => s,n,MYSQL(Clear ${resultid})
exten => s,n,Return()
exten => s,n,Playback(goodbye)
exten => s,n,Hangup()
Doug
--
Ben Franklin quote:
"Those who would give up Essential Liberty to purchase a little Temporary
Safety, deserve neither Liberty nor Safety."