Mysql, CallerID checking?

Get help with installing, upgrading and running Asterisk.

Moderators: muppetmaster, Moderator, Support

Mysql, CallerID checking?

Postby aardvark82 » Thu Dec 17, 2015 12:34 pm

I have MySQL table with two fields - "callerID" and "active" (0/1). I want every call routed by Asterisk is matched against this table. If active=0, hangup. How to do this right way? odbc_func and GotoIf, or AGI + MySQL queries in script, or something else?

I know about Radius but it is supported horribly bad by our billing software....
Posts: 18
Joined: Fri May 16, 2014 4:06 am

Re: Mysql, CallerID checking?

Postby ambiorixg12 » Thu Dec 17, 2015 2:08 pm

You have mentioned all the elements needed to achieve your goal. Also you can use the Asterisk System() command, that could be the easier and faster method, Noticed ${cid:0:3} I did it because , I just need the first 3 characters to validate the caller id

Code: Select all
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)
Posts: 967
Joined: Sun Mar 04, 2007 9:32 pm
Location: Dominican Republic

Return to Asterisk Support

Who is online

Users browsing this forum: MSN [Bot] and 1 guest