[Asterisk-Users] Mysql cmd with Asterisk Problems

Matthew Boehm mboehm at cytelcom.com
Wed May 18 09:12:30 MST 2005


pbx at itsngroup.com wrote:
> Hello all:

> The problem is with the fetch command.
> Here is the macro code:
> Mysql(QueryString=SELECT\ ivr-password\ from\ users\ where\
> ivr-id=${userid}) Mysql(Query r ${connid} ${QueryString})
> Mysql(Fetch fetchid ${r} dbuserpass)
> Mysql(Clear ${resultid})
> Mysql(Disconnect ${connid})

?? That is a mess. Here is our real world example:

 exten => _9.,1,MYSQL(Connect connid 22.55.33.33 username password database)
 exten => _9.,2,MYSQL(Query resultid ${connid} SELECT COUNT(*) FROM
customer_lines WHERE customer_id = 5000001)
 exten => _9.,3,MYSQL(Fetch fetchid ${resultid} limit)
 exten => _9.,4,MYSQL(Clear ${resultid})
 exten => _9.,5,MYSQL(Disconnect ${connid})
 exten => _9.,6,Set(GROUP()=cytel)
 exten => _9.,7,GotoIf($[ ${GROUP_COUNT()} > ${limit} ] ? 200)

The above runs every time someone makes an outgoing call so the code works.

-Matthew




More information about the asterisk-users mailing list