unable to access mysql database from asterisk dialplan

General discussions about Asterisk.

Moderators: Moderator, Support

unable to access mysql database from asterisk dialplan

Postby mqacim » Fri Jan 29, 2016 5:48 am

I have updated from Asterisk 1.6 to Asterisk 11. I was using MySQL command in asterisk dialplan to access the data base on Asterisk 1.6, but now this command seems to be not working. After going through some previous posts, I guess that MySQL command is not supported by Asterisk 11. Can someone please tell me what can be the alternative to MySQL and how can i configure such alternative?

Following is what I'm trying to do in dialplan:
Code: Select all
exten => _xxxx,n,MYSQL(Connect connid localhost user pswd db)
exten => _xxxx,n(noerror),MYSQL(Query resultid ${connid} SELECT system FROM user_to_system WHERE callerID='${CID}')
exten => _xxxx,n(fetchrow),MYSQL(Fetch foundRow ${resultid} system)
exten => _xxxx,n,MYSQL(Clear ${resultid})
exten => _xxxx,n,MYSQL(Disconnect ${connid})
mqacim
Newsterisk
 
Posts: 5
Joined: Tue Oct 13, 2015 12:31 am

Re: unable to access mysql database from asterisk dialplan

Postby ambiorixg12 » Fri Jan 29, 2016 3:30 pm

Some alternatives AGI, odbc function, System cmd....

[cidlookup]
exten=>_x.,1,Noop( checking the callerid ${CALLERID(num)})
same=>n,Set(__cid=${SHELL(mysql --user=root --password='12340' --skip-column-names dialer -e 'select dnc_phone from dnc where dnc_phone="${CALLERID(num)}" limit 0,1 ')})
same=>n,Noop( result ${cid:0:3})
same => n,GotoIf($["${CALLERID(num)}"="${cid:0:3}"]?allow:disallow)
same=>n(allow),Playback(demo-thanks)
same=>n,Hangup()
same=>n(disallow),Playback(im-sorry)
same=>n,Hangup()
ambiorixg12
Astmaster
 
Posts: 967
Joined: Sun Mar 04, 2007 9:32 pm
Location: Dominican Republic


Return to Asterisk General

Who is online

Users browsing this forum: No registered users and 8 guests