Asterisk Mysql Contacts
Hi. i have an asterisk 11 installation that i run in my soho environment. My system has mysql to store all the cdrs. I would like make use of the mysql and store numbers and names. eg
+4922123456789 “Atux Null”. So when the +4922123456789 calls in my system the name “Atux Null” will pop up next to the number. at the moment i have a database called MyNames in mysql that has this information, but i do not know how to make the dialplan read from this database. I would like to ask if there is a way to implement this easily in my dialplan, please.
4 thoughts on - Asterisk Mysql Contacts
[asterisk dialplan mysql]
The answer is: yes
If you’d search for “asterisk dialplan mysql”, you’get something like https://www.voip-info.org/wiki/view/Asterisk+cmd+MYSQL
You might want to look into AGI plus your favorite scriptinglanguage though.
use func_odbc, create a new function that does a lookup.
[CALLERID]
prefix=LOOKUP
dsn=MyDB
readsql=SELECT CALLERID from MyNames where CallerIdNum ‘${SQL_ESC(${ARG1})}’
exten => s,n,Set(CALLERID(NAME)=LOOKUP_CALLERID(${CALLERID(NUM)}))
that is a good approach.. thinking over implementing this too.. and filling the numbers using a trigger on cdr table.. is there a good manual how to set up odbc connection to mysql? I
actually never used odbc on non microscrap systems..
Yes there is.
You can follow the ODBC section in this document:
https://wiki.asterisk.org/wiki/display/AST/Setting+up+PJSIP+Realtime