Reports > CDR is empty not showing anything

I transferred my phone system to a new cloud machine using a backup/restore function last night.
CDR records from backup yesterday are showing, but new CDR records today are not showing in the interface.
Both incoming and outgoing calls are working fine; however, the call detail records (CDR) are empty. The call statistics in the dashboard also show that 0 calls have been made. I’m not sure what can be done to fix this issue. Could you please advise me on what steps I should take to resolve this problem?

1 Like

Sonata Stats is also showing 0 for today.
Basically, there have been no call logs on this new cloud server since it was restored yesterday.
The folder /var/log/asterisk/cdr-csv/ is empty (I am not sure where the old logs that came together with the restore are located).
I have tried reinstalling VPBX4.
Also tried running Vitalpbx build-db
I really want this fixed ASAP.
Any advice is appreciated.

What is the latest cdr db entry?

You can check it using the below commands.

Connect to the DB: mysql -A asterisk
Query the last row in the table: select * from cdr order by cdr_id desc limit 1;

on 2024-03-28 01:16:02

Time on the server
image

The issue was resolved by updating the file path in. nano /etc/odbcinst.ini
image

New CDR records missing after restore from version 3
I am also seeing this same issue on a Vitalpbx v 4.0.7-3 after restoring a version 3 backup
This issue does not seem to be present on a fresh install only after restoring a backup
I have also tried updating the path in the odbcinst.ini file but with success on my server
Anyone have an idea
Thanks

With or without success?

Does asterisk have a connection to the cdr database? You can check that by executing asterisk -x"odbc show asterisk". If it doesn’t try reloading the module and check for errors.

asterisk -r
module reload res_odbc.so

If it does have a connection to the database, confirm that the date/time in mysql is good mysql -e"SELECT NOW()".

If that also checks out, check the database for the last cdr record, and confirm that it’s actually not logging new cdr mysql -D asterisk -e"SELECT * FROM cdr ORDER BY cdr_id DESC LIMIT 1"

2 Likes

Here are the results, but still no New call records in the CDR report
New call records are in the database

asterisk -x"odbc show asterisk"

ODBC DSN Settings

Name: asterisk
DSN: MySQL-asterisk
Number of active connections: 1 (out of 1)
Logging: Disabled

module reload res_odbc.so
Module ‘res_odbc.so’ reloaded successfully.
– Reloading module ‘res_odbc.so’ (ODBC resource)
[2024-04-05 14:07:34] NOTICE[31302]: res_odbc.c:697 load_odbc_config: Registered ODBC class ‘asterisk’ dsn->[MySQL-asterisk]
[2024-04-05 14:07:34] NOTICE[31302]: res_odbc.c:697 load_odbc_config: Registered ODBC class ‘vitalpbx’ dsn->[MySQL-vitalpbx]

mysql -e"SELECT NOW()"
±--------------------+
| NOW() |
±--------------------+
| 2024-04-05 14:05:00 |
±--------------------+

OK I found a little more info
The NEW call records don’t have a “vitalpbx” in the tenant field
If I modify a single call record with the tenant set to vitalpbx the call record shows in the CDR report
Not quite sure how to make all the NEW call records from now on have the tenant field vitalpbx

As a temporary fix I have changed the CDR database structure for the Tenant field settings default to be vitalpbx and now it is working on any new calls. I’m sure this is the wrong answer long term if anyone knows how to fix this correctly I would like to know.
Thanks

It’s possible that the tenant name isn’t set in the asterisk database, you can check/fix that using the below.

Get the tenant path from the sql database mysql -D ombutel -e"select path from ombu_tenants where name = 'vitalpbx'"
Check if the asterisk database has a name set for this tenant asterisk -x"database showkey {tenant_path}/name", if it doesn’t exist, add it using the following asterisk -x"database put {tenant_path} name vitalpbx" (replacing {tenant_path} with the path retrieved from the database)

Note: That tenant path should also match the tenant path in /etc/asterisk/vitalpbx/extensions__50-1-dialplan.conf, as well as a directory name in /var/lib/vitalpbx/static/ (and probably some other places as well)

Thank you for your help
In the mysql db the path does exist
±-----------------+
| path |
±-----------------+
| 77848887eb9290b0 |
±-----------------+

I checked if the name was set for the tenant and it was not
So I added it and then verified that it existed

asterisk -x"database showkey {77848887eb9290b0}/name"
/{77848887eb9290b0}/name : vitalpbx
1 results found.

The path also existed here (many times is the conf file)
/etc/asterisk/vitalpbx/extensions__50-1-dialplan.conf , as well as a directory name in /var/lib/vitalpbx/static/

At this point I removed the tenant :vitalpbx" from the CDR table structure and restarted asterisk and tested. New CDR records still do not show in the CDR Report
So I have put the name vitalpbx as default tenant in the CDR table structure for now

Remove the curly braces from the tenant path in the asterisk database, I put it there as a place holder.
Your command should be asterisk -x"database put 77848887eb9290b0 name vitalpbx".

That solved the issue for me
Thank you EINM so much for your great knowledge and help!