22 August 2010

Fixing mySQL CDR module compile error for Asterisk 1.6 in Ubuntu

There is a bug in the Ubuntu release (still in 10.04) that causes a mismatch between the Asterisk 1.6 package and its addon package. This results in the error message:
WARNING[4238] loader.c: Module 'app_addon_sql_mysql.so' was not compiled with the same compile-time options as this version of Asterisk.
To produce this error you just need to apt-get install asterisk-mysql in an effort to get the cdr logging to a mySQL database (assuming that you also used aptitude to install Asterisk 1.6 of course).

In order to fix it do the following:
aptitude purge asterisk-mysql
apt-get build-dep asterisk-mysql
apt-get -b source asterisk-mysql
dpkg -i asterisk-mysql_1.6.2.0-1_i386.deb
Do this in a temp folder as it will create a number of .deb packages. You may need to change the filename depending on your hardware architecture.

The idea is to uninstall the faulty package that Ubuntu created and then compile a copy of the addons that matches the current Asterisk version.

Since you've had the error of loading I can assume that you've edited modules.conf and cdr.conf properly.

If you run asterisk CLI and then use the command "module show like mysql" you should see the modules have loaded.

Assuming that you have properly defined your database table
you should be one step closer to having your CDR recording in mySQL.