[asterisk-users] MySQL query from extensions?

Doug Lytle support at drdos.info
Fri Apr 13 12:41:07 MST 2007


Barton Fisher wrote:
> What wrong with this:
>
> [get-dnisinfo]
> ; sub-routine to get owner's password
> exten => s,1,Verbose(  == )
> exten => s,n,MYSQL(Connect connid localhost root password dax)
> exten => s,n,MYSQL(Query resultid ${connid} SELECT\ password\ FROM\ 
> dnislookup\ WHERE\ dnis=\'${IVR-Exten}\')
> exten => s,n,MYSQL(Fetch fetchid ${password} password)
> exten => s,n,Verbose(  == Password found was 
> [${password}]-[${connid}]-[${fetchid}]-[${resultid}] )
> exten => s,n,MYSQL(Clear ${password})
> exten => s,n,MYSQL(Disconnect ${connid})
> exten => s,n,return
This is what I do for our speed dialing, it would appear that the 
problem is in your fetch:

; *******************************************************
; Set speed.dial name and number from the database entry 
; *******************************************************

exten => s,4,MYSQL(Connect connid 192.168.101.25 anonymous '' speeddials)
exten => s,5,MYSQL(Query resultid ${connid} SELECT phone \, name FROM 
company WHERE number = ${ARG1})
exten => s,6,MYSQL(Fetch fetchid ${resultid} speed.dial speed.name)
exten => s,7,MYSQL(Disconnect ${connid})
exten => s,8,MYSQL(Clear ${resultid})


Doug

-- 
 
Ben Franklin quote:

"Those who would give up Essential Liberty to purchase a little Temporary Safety, deserve neither Liberty nor Safety."




More information about the asterisk-users mailing list