Macros For MySQL Functions
Jump to navigation
Jump to search
To Fetch Data From MySQL
[macro-MYSQLFETCH] exten => s,1,MYSQL(Connect connid localhost asterisk yourpassword asterisk) exten => s,n,MYSQL(Query resultid ${connid} ${ARG2}) exten => s,n,MYSQL(Fetch fetchid ${resultid} ${ARG1}) exten => s,n,MYSQL(Clear ${resultid}) exten => s,n,MYSQL(Disconnect ${connid})
To call the macro:
exten => s,n,Macro(MYSQLFETCH,DNDVALUE,SELECT value FROM features WHERE name="dnd" AND subname="status") exten => s,n,GotoIf($[${DNDVALUE} = 1 ]?LINEISDND,s,1)
- ==== MYSQL UPDATE ===========================================================
[macro-MYSQLUPDATE] exten => s,1,MYSQL(Connect connid localhost asterisk yourpassword asterisk) exten => s,n,MYSQL(Query resultid ${connid} ${URIDECODE(${ARG1})}) exten => s,n,MYSQL(Disconnect ${connid})
To call the macro:
exten => s,n,Macro(MYSQLUPDATE,${URIENCODE(UPDATE blacklist SET lastcalled=NOW(), numberofcalls=numberofcalls+1 WHERE number="${CALLERID(number)}")})