Need to move the cdr files

Hii I am using free pbx distro and recently my server got crashed , I could only restore config backup from the old server to new one . Now I need to move the CDR files from my old servers harddisk to new server , but I’m not able to find the cdr path Please help me with this .

There are several places that could hold your CDR, including a MySQL or PostGres database.

If you can’t find them in /var/spool/asterisk somewhere, I recommend looking in your local database.

Thank u for the quick reply , When I look into /var/log/asterisk/cdr-csv the master.csv file is empty but im not sure whether it has to be empty.

My full backups are not working if I try to restore so I restored only config now I need to move CDR manually from hard-disk . can u guys tel me the way to move it I tried searching in many places

Assuming you are using CSV CDR files, the master.csv will contain all of the CDR records since you reset it last. You should also have a slough of individual CDR files in there for all of your old calls. If the file is empty (I assume you are looking on the old machine) then you weren’t using the CSV CDR extension.

Look at your old CDR config files - they should tell you which CDR storage method you were using.

I don’t think that CDR files get backed up in the backup module unless you tell it to deliberately, so it is reasonable that you won’t find the files in the backup. Also, if you used a database for the CDR, the tables in the database may or may not be backed up. If this is the case, you should find a database called “asteriskcdrdb” with a single table (“cdr”) in it with all of your cdr data.

Your CDR config files realty will tell you where to look for the Call Data Records. Without those, no one else will be able to give you a definitive answer.

1 Like

On the old machine:-

mysqldump -u user -ppassword asteriskcdrdb cdr > cdr.sql

on the new machine:-

mysql -u username -ppassword -D asteriskcdr < cdr.sql

1 Like

Hi Dave , thanks for your descriptive answer , I specifically selected the CDRs in the back up but for some reason I could not restore the backup! it ended with some error so, I restored the config backup , now my server is running from three weeks if in case I restore the full backup now the latest three weeks data will be lost , so I was desperately trying to figure out a way to manually move CDR files so that I would not loose the data . I would like to move the data using asteriskcdrdb as u suggested but if u don’t mind can u be more specific on how to move the astersikcdr database as I’ve just started to learn asterisk …

Hi diko , I would like to know wether the above commands given by you are to extract the data in the CDR database ? As I can’t try it out in my working server unless I know what it does …

That what it does, it’s pretty well exactly what the backup/restore process does.

Thank u dicko …
it would be of great help if it works ,I’ll try it

Hii dicko , got this error when I typed the command u gave me “mysqldump: Got error: 1045: Access denied for user ‘root’@‘localhost’ (using password: YES) when trying to connect” .

If you don’t have a root password set, don’t try and use one, as always . .

man mysqldump
man mysql

Normally I’ll use root password to login to my asterisk , is there anything else I should set other than default asterisk root password to use the commands.

mysql and it’s related programs have their own password/acl method, it is not the same as your bash user password (linux user not asterisk, asterisk has it’s own user account) and is probably not set to anything.