CDR database empty

I have searched quit a bit regarding my issue.

Here is my system info:
Current PBX Version:14.0.13.4
Current System Version:12.7.3-1707-3.sng7

The issue I am running into is that my CDR table is no longer being updated. This started a while ago, but I don’t know when so I don’t have an event which kicked off the problem. I have confirmed that I can open the database and the cdr table from the CLI so I know I have correct credentials. It seems it’s been over a year since the last entry. As a test I tried changing the connection in the advanced setting to treat the CDR database as a remote location. This did not help. I reset the database and ran repairs and still nothing.

As another test, in the advanced settings I changed the password for the remote CDR connection and the CDR report failed with a connection error so I know that the system is connecting to the right database when running reports. I just can’t seem to get it to create an entry in the cdr table.

I’ve seen reference to settings in cdr_odbc.conf, but I do not seem to have this file on my system. That said those post were a bit older so perhaps this file is no longer relevant in current versions. I would appreciate any advice as to directions to go to resolve the issue.

Thanks.

How is your database space? Drive space? What do the logs say around the CDR portion of the calls?

from bash

rasterisk -x ‘cdr show status’

1 Like

Drive space is good 16,470.31M / 111,497.61 M (16%)
Database is empty now as I had cleared and repaired it to try to get things working.
Looking in freepbx.log I see bunch of entires like the following ones:

cdr 14.0.5.19 (current: 14.0.5.14)
cdr 14.0.5.19 (current: 14.0.5.14)
cdr 14.0.5.19 (current: 14.0.5.14)
[2019-Jun-28 11:22:29] [INFO] (cdr/install.php:101) - Checking if field cnum is present in cdr table…OK!
[2019-Jun-28 11:22:29] [INFO] (cdr/install.php:101) - Checking if field cnam is present in cdr table…OK!
[2019-Jun-28 11:22:29] [INFO] (cdr/install.php:101) - Checking if field outbound_cnum is present in cdr table…OK!
[2019-Jun-28 11:22:29] [INFO] (cdr/install.php:101) - Checking if field outbound_cnam is present in cdr table…OK!
[2019-Jun-28 11:22:29] [INFO] (cdr/install.php:101) - Checking if field dst_cnam is present in cdr table…OK!
[2019-Jun-28 11:22:29] [INFO] (cdr/install.php:117) - Checking if field linkedid is present in cdr table…OK!
[2019-Jun-28 11:22:29] [INFO] (cdr/install.php:117) - Checking if field peeraccount is present in cdr table…OK!
[2019-Jun-28 11:22:29] [INFO] (cdr/install.php:117) - Checking if field sequence is present in cdr table…OK!
[2019-Jun-28 11:22:29] [UPDATE] (libraries/modulefunctions.class.php:2028) - Module: cdr Updated to version 14.0.5.19

Although I believe those entries are from when I did a module update a couple of days ago.

rasterisk -x ‘cdr show status’

Call Detail Record (CDR) settings

Logging: Enabled
Mode: Simple
Log unanswered calls: No
Log congestion: No

  • Registered Backends

    Adaptive ODBC

When you have an active call

watch "rasterisk -x 'cdr show active'"

Channels with Call Detail Record (CDR) Information
--------------------------------------------------
Channel                   Dst. Channel              LastApp         Start    Answer   End      Billsec  Duration
SIP/yourtrunk-000024da        <none>                    BackGround      18:37:09 18:37:09 18:37:15 00000006 00000006

if you get the active call then the odbc connector is built well. Now check that mysql is doing the right thing

It seems to work. I get this:

Channels with Call Detail Record (CDR) Information

Channel Dst. Channel LastApp Start Answer End Billsec Duration
SIP/MainTrunkOut-00000036 BackGround 22:59:19 22:59:19 22:59:36 00000016 00000016

After the above test, I checked the database and still no entries in the cdr table.

What version of Asterisk?

Start Asterisk CLI, run command:
module show like cdr_addon_mysql.so

I am running Asterisk 13.17.0

Running the command: module show like cdr_addon_mysql.so
I get:

Module Description Use Count Status Support Level
0 modules loaded

While calls are ongoing

watch "mysql -e 'show processlist'"

on the web GUI, Admin>Asterisk Modules
Do you see cdr_adaptive_odbc.so as a preloaded module?

1 Like

Yes, cdr_adaptive_odbc.so in in the preloaded modules.

This is the output from mysql -e ‘show processlist’

Every 2.0s: mysql -e ‘show processlist’ Wed Jul 3 12:30:11 2019

Id User Host db Command Time State Info Progress
80585 freepbxuser localhost asterisk Sleep 4 NULL 0.000
114846 freepbxuser localhost asterisk Sleep 19 NULL 0.000
126932 freepbxuser localhost:50084 asterisk Sleep 11513 NULL 0.000
128727 freepbxuser localhost asterisk Sleep 8 NULL 0.000
128733 root localhost NULL Query 0 NULL show processlist 0.000

mysql asteriskcdrdb -e 'SELECT * FROM cdr ORDER BY calldate DESC LIMIT 4'

Running that command return nothing. The cdr table has no records at this time. I had deleted the records earlier as an attempt to get things going. At this point no new records are being added to the cdr table. There are also no new records being added to the cel table. I can connect to the database from the CLI and I can work also with those two tables. As far as I can tell the database is happy.

cat /etc/asterisk/cdr*odbc*

cat: /etc/asterisk/cdrodbc: No such file or directory

Forum formatting editted

Here are my results:

[asteriskcdrdb]
connection=asteriskcdrdb
loguniqueid=yes
table=cdr
alias start => calldate