This all started when I was trying to export the Call Data Records (CDR) and Call Event Log (CEL) databases from the currently running FreePBX v14 system in the basement, to a new FreePBX v16 virtual machine I’ve been using for testing. I followed the instructions here:
Moving CDR and CEL from old to new
After a couple of MySQL permission issues (could not log without a password) I was able to export the two databases as root on the old system.
I may have run the older commands below instead of the newer ones from the post initially:
mysqldump --skip-add-drop-table --no-create-db --no-create-info --complete-insert asteriskcdrdb cdr > cdr.sql
mysqldump --skip-add-drop-table --no-create-db --no-create-info --complete-insert asteriskcdrdb cel > cel.sql
I should have run this on the currently running/production system (and eventually did):
mysqldump asteriskcdrdb cel > cel.sql
mysqldump asteriskcdrdb cdr > cdr.sql
And then I ran this in the test VM:
mysql asteriskcdrdb < cel.sql
fwconsole ma install cel
mysql asteriskcdrdb < cdr.sql
fwconsole ma install cdr
Afterwards, I cannot see any call data records on either system, but yet I can see call event logs on both systems. Unfortunately this did erase the existing entries I already had in the test VM. I believe the export was successful though, I opened up the cel.sql
in Notepad++ and can see entries dating back to 2018 (when I first built the system), but when I open the cdr.sql
file, I do not see any “INSERT INTO `cdr` VALUES
” entries.
I have a million questions:
-
Aside from trying to do this manually, where did I go wrong?
-
Where did the existing entries go in the CDR database on the new system? Overwritten to null?
-
During this export/import process, is it possible to retain/keep the existing entries on the destination system somehow?
-
Why would the CEL database populate but not the CDR?
-
Is there any way to generate the missing CDR data from the CEL database? Is there any way I can fix both systems?
Lastly, I did notice in my /var/log/asterisk/full
with a grep -i CDR full
I noticed these errors:
[2022-04-04 12:34:01] ERROR[14870] loader.c: cdr_csv declined to load.
[2022-04-04 12:34:01] ERROR[14870] loader.c: cdr_manager declined to load.
[2022-04-04 12:34:01] ERROR[14870] loader.c: cdr_odbc declined to load.
[2022-04-04 12:48:07] ERROR[16983] config_options.c: Unable to load config file 'cdr.conf'
Sure enough, the cdr.conf
file does not exist in /etc/asterisk
in a fresh install of FreePBX v16, but one of my other test v16 VMs seems to work fine without this file. Below is the full output of the grep command:
root@freepbx asterisk]# grep -i CDR full
[2022-04-04 12:32:52] NOTICE[13372] res_odbc.c: Registered ODBC class 'asteriskcdrdb' dsn->[MySQL-asteriskcdrdb]
[2022-04-04 12:32:52] VERBOSE[13372] loader.c: Reloading module 'cdr' (CDR Engine)
[2022-04-04 12:32:52] ERROR[13372] config_options.c: Unable to load config file 'cdr.conf'
[2022-04-04 12:32:52] VERBOSE[13372] loader.c: Reloading module 'cdr_adaptive_odbc.so' (Adaptive ODBC CDR backend)
[2022-04-04 12:32:52] VERBOSE[13372] cdr_adaptive_odbc.c: Found adaptive CDR table cdr@asteriskcdrdb.
[2022-04-04 12:32:52] VERBOSE[13372] cdr_adaptive_odbc.c: Found alias start for column calldate in cdr@asteriskcdrdb
[2022-04-04 12:32:52] VERBOSE[13372] cel_odbc.c: Found CEL table cel@asteriskcdrdb.
[2022-04-04 12:33:42] VERBOSE[13996] loader.c: Unloading app_forkcdr.so
[2022-04-04 12:33:42] VERBOSE[13996] pbx_app.c: Unregistered application 'ForkCDR'
[2022-04-04 12:33:42] VERBOSE[13996] loader.c: Unloading func_cdr.so
[2022-04-04 12:33:42] VERBOSE[13996] pbx_functions.c: Unregistered custom function CDR
[2022-04-04 12:33:42] VERBOSE[13996] pbx_functions.c: Unregistered custom function CDR_PROP
[2022-04-04 12:33:42] VERBOSE[13996] loader.c: Unloading app_cdr.so
[2022-04-04 12:33:42] VERBOSE[13996] pbx_app.c: Unregistered application 'NoCDR'
[2022-04-04 12:33:42] VERBOSE[13996] pbx_app.c: Unregistered application 'ResetCDR'
[2022-04-04 12:33:42] VERBOSE[13996] pbx.c: Remove macro-pinsets/cdr/12, registrar=pbx_config; con=<nil>((nil)); con->root=(nil)
[2022-04-04 12:33:42] VERBOSE[13996] pbx.c: Remove macro-pinsets/cdr/11, registrar=pbx_config; con=<nil>((nil)); con->root=(nil)
[2022-04-04 12:33:42] VERBOSE[13996] pbx.c: Remove macro-pinsets/cdr/10, registrar=pbx_config; con=<nil>((nil)); con->root=(nil)
[2022-04-04 12:33:42] VERBOSE[13996] pbx.c: Remove macro-pinsets/cdr/9, registrar=pbx_config; con=<nil>((nil)); con->root=(nil)
[2022-04-04 12:33:42] VERBOSE[13996] pbx.c: Remove macro-pinsets/cdr/8, registrar=pbx_config; con=<nil>((nil)); con->root=(nil)
[2022-04-04 12:33:42] VERBOSE[13996] pbx.c: Remove macro-pinsets/cdr/7, registrar=pbx_config; con=<nil>((nil)); con->root=(nil)
[2022-04-04 12:33:42] VERBOSE[13996] pbx.c: Remove macro-pinsets/cdr/6, registrar=pbx_config; con=<nil>((nil)); con->root=(nil)
[2022-04-04 12:33:42] VERBOSE[13996] pbx.c: Remove macro-pinsets/cdr/5, registrar=pbx_config; con=<nil>((nil)); con->root=(nil)
[2022-04-04 12:33:42] VERBOSE[13996] pbx.c: Remove macro-pinsets/cdr/4, registrar=pbx_config; con=<nil>((nil)); con->root=(nil)
[2022-04-04 12:33:42] VERBOSE[13996] pbx.c: Remove macro-pinsets/cdr/3, registrar=pbx_config; con=<nil>((nil)); con->root=(nil)
[2022-04-04 12:33:42] VERBOSE[13996] pbx.c: Remove macro-pinsets/cdr/2, registrar=pbx_config; con=<nil>((nil)); con->root=(nil)
[2022-04-04 12:33:42] VERBOSE[13996] pbx.c: Remove macro-pinsets/cdr/1, registrar=pbx_config; con=<nil>((nil)); con->root=(nil)
[2022-04-04 12:33:59] NOTICE[14870] res_odbc.c: Registered ODBC class 'asteriskcdrdb' dsn->[MySQL-asteriskcdrdb]
[2022-04-04 12:33:59] VERBOSE[14870] loader.c: Loading cdr.
[2022-04-04 12:33:59] ERROR[14870] config_options.c: Unable to load config file 'cdr.conf'
[2022-04-04 12:33:59] NOTICE[14870] cdr.c: Failed to process CDR configuration; using defaults
[2022-04-04 12:33:59] NOTICE[14870] cdr.c: CDR simple logging enabled.
[2022-04-04 12:33:59] VERBOSE[14870] loader.c: cdr => (CDR Engine)
[2022-04-04 12:33:59] VERBOSE[14870] loader.c: Loading cdr_adaptive_odbc.so.
[2022-04-04 12:33:59] VERBOSE[14870] cdr_adaptive_odbc.c: Found adaptive CDR table cdr@asteriskcdrdb.
[2022-04-04 12:33:59] VERBOSE[14870] cdr_adaptive_odbc.c: Found alias start for column calldate in cdr@asteriskcdrdb
[2022-04-04 12:33:59] VERBOSE[14870] loader.c: cdr_adaptive_odbc.so => (Adaptive ODBC CDR backend)
[2022-04-04 12:34:00] VERBOSE[14870] loader.c: Loading cdr_csv.so.
[2022-04-04 12:34:00] WARNING[14870] cdr_csv.c: unable to load config: cdr.conf
[2022-04-04 12:34:00] VERBOSE[14870] loader.c: Loading cdr_manager.so.
[2022-04-04 12:34:00] WARNING[14870] cdr_manager.c: Failed to load configuration file. Module not activated.
[2022-04-04 12:34:00] VERBOSE[14870] cdr.c: Unregistered 'cdr_manager' CDR backend
[2022-04-04 12:34:00] VERBOSE[14870] loader.c: Loading cdr_odbc.so.
[2022-04-04 12:34:00] WARNING[14870] cdr_odbc.c: cdr_odbc: Unable to load config for ODBC CDR's: cdr_odbc.conf
[2022-04-04 12:34:00] VERBOSE[14870] cel_odbc.c: Found CEL table cel@asteriskcdrdb.
[2022-04-04 12:34:00] VERBOSE[14870] loader.c: Loading app_cdr.so.
[2022-04-04 12:34:00] VERBOSE[14870] pbx_app.c: Registered application 'NoCDR'
[2022-04-04 12:34:00] VERBOSE[14870] pbx_app.c: Registered application 'ResetCDR'
[2022-04-04 12:34:00] VERBOSE[14870] loader.c: app_cdr.so => (Tell Asterisk to not maintain a CDR for the current call)
[2022-04-04 12:34:00] VERBOSE[14870] loader.c: Loading func_cdr.so.
[2022-04-04 12:34:00] VERBOSE[14870] pbx_functions.c: Registered custom function 'CDR'
[2022-04-04 12:34:00] VERBOSE[14870] pbx_functions.c: Registered custom function 'CDR_PROP'
[2022-04-04 12:34:00] VERBOSE[14870] loader.c: func_cdr.so => (Call Detail Record (CDR) dialplan functions)
[2022-04-04 12:34:00] VERBOSE[14870] loader.c: Loading app_forkcdr.so.
[2022-04-04 12:34:00] VERBOSE[14870] pbx_app.c: Registered application 'ForkCDR'
[2022-04-04 12:34:00] VERBOSE[14870] loader.c: app_forkcdr.so => (Fork The CDR into 2 separate entities)
[2022-04-04 12:34:01] ERROR[14870] loader.c: cdr_csv declined to load.
[2022-04-04 12:34:01] ERROR[14870] loader.c: cdr_manager declined to load.
[2022-04-04 12:34:01] ERROR[14870] loader.c: cdr_odbc declined to load.
[2022-04-04 12:48:07] NOTICE[16983] res_odbc.c: Registered ODBC class 'asteriskcdrdb' dsn->[MySQL-asteriskcdrdb]
[2022-04-04 12:48:07] VERBOSE[16983] loader.c: Reloading module 'cdr' (CDR Engine)
[2022-04-04 12:48:07] ERROR[16983] config_options.c: Unable to load config file 'cdr.conf'
[2022-04-04 12:48:07] VERBOSE[16983] loader.c: Reloading module 'cdr_adaptive_odbc.so' (Adaptive ODBC CDR backend)
[2022-04-04 12:48:07] VERBOSE[16983] cdr_adaptive_odbc.c: Found adaptive CDR table cdr@asteriskcdrdb.
[2022-04-04 12:48:07] VERBOSE[16983] cdr_adaptive_odbc.c: Found alias start for column calldate in cdr@asteriskcdrdb
[2022-04-04 12:48:07] VERBOSE[16983] cel_odbc.c: Found CEL table cel@asteriskcdrdb.
[2022-04-04 13:02:13] NOTICE[18173] res_odbc.c: Registered ODBC class 'asteriskcdrdb' dsn->[MySQL-asteriskcdrdb]
[2022-04-04 13:02:13] VERBOSE[18173] loader.c: Reloading module 'cdr' (CDR Engine)
[2022-04-04 13:02:13] NOTICE[18173] cdr.c: CDR simple logging enabled.
[2022-04-04 13:02:13] VERBOSE[18173] loader.c: Reloading module 'cdr_adaptive_odbc.so' (Adaptive ODBC CDR backend)
[2022-04-04 13:02:13] VERBOSE[18173] cdr_adaptive_odbc.c: Found adaptive CDR table cdr@asteriskcdrdb.
[2022-04-04 13:02:13] VERBOSE[18173] cdr_adaptive_odbc.c: Found alias start for column calldate in cdr@asteriskcdrdb
[2022-04-04 13:02:14] VERBOSE[18173] cel_odbc.c: Found CEL table cel@asteriskcdrdb.
Any help would greatly be appreciated, I’ve been pulling my hair out for two months now testing and trying to migrate from the older FreePBX to a newer FreePBX version running inside a virtual machine.