Asterisk : Select Multiple column from MySQL

Here is an example to select multiple column of a table from select statement in asterisk.

exten => h,1,MYSQL(Connect conn localhost username password database)
exten => h,n,MYSQL(Query res ${conn} ‘SELECT call_id,callerid,calltime FROM todaycall WHERE calltime=curdate() order by calltime desc limit 1′)
exten => h,n,MYSQL(Fetch fid ${r} call_id callerid calltime)
exten => h,n,MYSQL(Clear ${r})
exten => h,n,MYSQL(Disconnect ${conn})
exten => h,n,NoOp(“${call_id}’,’${callerid}’,’${calltime}'”)









For any query or issue, feel free to discuss on

Leave a Reply