Stock recent FreePBX use ODBC to access the CDR db. ODBC in turn can use various backends to connect to tha actual db, for example MariaDB, MySQL, PostgreSQL, FreeTDS (for MS Sql) etc. Have a look at /etc/odbcinst.ini if you want. This file lists some possible backend drivers (but not all of them need to be really installed on your system: the stock file is more like a sample). Anyway by default, Freepbx on CentOS 8 uses MariaDB as the backend so we'll need this.

Three packages are required for cdr (and cel) to work so if you're reading here, make sure you install them: asterisk-odbc unixODBC mariadb-connector-odbc .
The latter one, mariadb-connector-odbc, is tha package containing the backend driver we will be using.
If you're using MySQL instead of MariaDB, it's possible you'll have to install mysql-connector-odbc instead. If this is your case, please remember to change driver=MariaDB to driver=MySQL in odbc.ini prior to cpying it to /etc/odbc.ini (see below).

The ODBC data sources available to programs in your system (or DSNs, as are named in ODBC) are defined in /etc/odbc.ini. The stock FreePBX install procedure would create a fresh new /etc/odbc.ini with its own DSN, possibly overwriting the previous file.
Obviusly I don't like this behaviour because if I already have other data sources defined in that file, they will be lost. So in my package, a file called /etc/asterisk/odbc.ini is created instead for reference. Then it's left to the sysadmin to simply copy it in /etc/odbc.ini, overwriting it or adding it's content to the previous file.

FreePBX setup procedure should already have created the DB and tables for CDR and CEL. You can test if your ODBC install is working with isql, unixODBC command line SQL tool. Get user and password used bt FreePBX to connect to the DB from /etc/freepbx.conf. Look for $amp_conf['AMPDBUSER'] (whis should be 'freepbxuser') and $amp_conf['AMPDBPASS'] (whis should be a long random password, say 0123456789abcdef). So launch the following command. MySQL-asteriskcdrdb is the DSN name:

isql -v MySQL-asteriskcdrdb freepbxuser 0123456789abcdef

You shod get the isql prompt. If not, look for errors, maybe connection errors.
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL> 

Enter some valid statements:
SQL> select 1
+------------+
| 1          |
+------------+
| 1          |
+------------+
SQLRowCount returns 1
1 rows fetched

SQL> show tables
+--------------------------------------------------------------------------+
| Tables_in_asteriskcdrdb                                                  |
+--------------------------------------------------------------------------+
| cdr                                                                      |
| cel                                                                      |
+--------------------------------------------------------------------------+
SQLRowCount returns 2
2 rows fetched

SQL> select * from cdr
+--------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------------+------------+------------+----------------------------------------------+------------+---------------------+---------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------------+---------------------------------+---------------------------------------------------------------------------------+------------+
| calldate           | clid                                                                            | src                                                                             | dst                                                                             | dcontext                                                                        | channel                                                                         | dstchannel                                                                      | lastapp                                                                         | lastdata                                                                        | duration   | billsec    | disposition                                  | amaflags   | accountcode         | uniqueid                        | userfield                                                                                                                                                                                                                                                      | did                                               | recordingfile                                                                                                                                                                                                                                                  | cnum                                                                            | cnam                                                                            | outbound_cnum                                                                   | outbound_cnam                                                                   | dst_cnam                                                                        | linkedid                        | peeraccount                                                                     | sequence   |
+--------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------------+------------+------------+----------------------------------------------+------------+---------------------+---------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------------+---------------------------------+---------------------------------------------------------------------------------+------------+

and so on. This should confirm that your ODBC DSN is set up properly.
