FreePBX/Asterisk on Ubuntu 20.04 router

I recently started to build/update my FreePBX Asterisk server, and noticed that there were no CDR (Call Detail Records) being recorded…

Despite googling around it, I could not find a good solution, until I noticed that the libraries being pulled in from ‘/usr/lib/odbc/’ had version 5 in them, and my installation had version 8…

So, I had downloaded the wrong ODBC library (why does FreePBX/asterisk use ODBC anyway?).

ls -la /usr/lib/odbc/        
total 80160
drwxr-xr-x   2 root root      4096 Aug 17 15:03 ./
drwxr-xr-x 112 root root     12288 Aug  7 13:09 ../
lrwxrwxrwx   1 7161 31415       16 Mar  9 01:18 libcrypto.so -> libcrypto.so.1.1
-rwxr-xr-x   1 7161 31415 23772232 Mar  9 01:18 libmyodbc8a.so*
-rwxr-xr-x   1 7161 31415 23793016 Mar  9 01:18 libmyodbc8w.so*
lrwxrwxrwx   1 7161 31415       13 Mar  9 01:18 libssl.so -> libssl.so.1.1

Meanwhile, the file /etc/odbcinst.ini shows

cat /etc/odbcinst.ini 
[MySQL]
Description=ODBC for MySQL
Driver=/usr/lib/odbc/libmyodbc5w.so
Setup=/usr/lib/odbc/libodbcmy5S.so
FileUsage=1

On to the solution… You’ll find the installation instructions (or FreePBX on Ubuntu) at https://wiki.freepbx.org/display/FOP/Installing+FreePBX+14+on+Ubuntu+18.04

And the offending part is at “Install MySQL ODBC Connector / The MySQL ODBC connector is used for CDRs. “

mkdir -p /usr/lib/odbc
curl -s https://cdn.mysql.com/Downloads/Connector-ODBC/5.3/mysql-connector-odbc-5.3.11-linux-ubuntu18.04-x86-64bit.tar.gz | \
  tar -C /usr/lib/odbc --strip-components=2 --wildcards -zxvf - */lib/*so

Should basically be substituted with:

mkdir -p /usr/lib/odbc
curl -s https://dev.mysql.com/get/Downloads/Connector-ODBC/5.3/mysql-connector-odbc-5.3.14-linux-glibc2.12-x86-64bit.tar.gz | \
  tar -C /usr/lib/odbc --strip-components=2 --wildcards -zxvf - */lib/*so

And, now you’re getting the ODBC 5 drivers, instead of the 8 drivers (which might be compatible calling-wise, but not name-wise).

The /usr/lib/odbc should now look like:

root@nuc:~# ll /usr/lib/odbc/
total 80160
drwxr-xr-x   2 root root      4096 Aug 17 15:03 ./
drwxr-xr-x 112 root root     12288 Aug  7 13:09 ../
lrwxrwxrwx   1 7161 31415       16 Mar  9 01:18 libcrypto.so -> libcrypto.so.1.1
-rwxr-xr-x   1 7161 31415 17239614 Oct 28  2019 libmyodbc5a.so*
-rwxr-xr-x   1 7161 31415 17259773 Oct 28  2019 libmyodbc5w.so*
-rwxr-xr-x   1 7161 31415 23772232 Mar  9 01:18 libmyodbc8a.so*
-rwxr-xr-x   1 7161 31415 23793016 Mar  9 01:18 libmyodbc8w.so*
lrwxrwxrwx   1 7161 31415       13 Mar  9 01:18 libssl.so -> libssl.so.1.1

After download the 5.3 drivers restart asterisk with

service asterisk restart

And you should start seeing CDR records in FreePBX.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>