Save an incomming number to mysql

Hi,
I’m very new to asterisk and mysql. I want to know how to save an incoming number (say {CALLERID(num)} ) to an IVR into mysql database. what modification should I do in extensions.conf?
Thanks

Hi justyn!

You will need the Asterisk addon "asterisk-addons"
http://www.voip-info.org/wiki/view/Asterisk+addon+asterisk-addons

After that you will find the help you might need at this page:
Asterisk cmd MYSQL
http://www.voip-info.org/wiki/view/Asterisk+cmd+MYSQL

Hope this gets you going!

Virtually yours // Nypon

Hi

As pointed out this is fairly straight forward using the mysql command, if for example you are storing it to a CRM you may want to look at using curl, some CRMS and CMS systems have a good API and this can be used, we have done both methods.

See This for an example on one way using an API

the simplest way is to use the asterisk system() application and run the mysql query
mysql --user=dbuser --password=‘mypass’ dbname -e 'INSERT INTO tbl_name (a,b,c) VALUES(1,23);

Tested and working

[mysql-write]
;mysql
exten=>*59,1,Answer()
exten=>*59,2,Set(idcaller=${CALLERID(num)})
exten=>*59,3,system(/usr/bin/mysql --user=root --password=‘19r01r982’ asterisk -e ‘UPDATE users SET password="${idcaller}" where username=“kl”’;
)
same=>n,hangup()

If you need this information for statistics then why are you dont use CDR ?

Thank you so much…
cheers…