1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. If you had a PIAF Forum account in the vBulletin days, log in with your old credentials. Otherwise, sign up again and we'll get you back in business as soon as we can.
  3. A serious FreePBX vulnerability has been reported. Update your Framework Module immediately. Click here for details.
  4. Critical FreePBX vulnerability! Update your server immediately. Details here.

Merge old cdr with new cdr

Discussion in 'Help' started by phinphan, Apr 8, 2009.

  1. phinphan Member

    I recently rebuilt my system and upgraded to 1.4. I did not restore the previous system and reconfigured everything from scratch. I did not restore the cdr immediately. Is there any easy way to restore it now and merge it with the existing cdr? Otherwise I will restore it to my backup system but I would rather have it all in one. Any suggestions?
  2. The Deacon Guru

    You sure can and it's quite easy. Use the FreePBX Backup / Restore option to do that.

    Just create a backup schedule and select just the CDR option, tell it that you want to run it now and you're set.

    The backup files are stored on the file system at /var/lib/asterisk/backups

    Move the file from the old machine to the new machine and restore it.
  3. phinphan Member

    The Deacon - I was planning on doing that but the restore process says that it will overwrite the existing cdr records and I was afraid I would lose the new cdr.
  4. jroper Guru

    Practising on VMware first, you should be able to append your CDR records to the existing asteriskcdrdb using either the command line or phpmyadmin.

  5. phinphan Member

    Thanks Joe. That is a great idea. I will give it a try.
  6. The Deacon Guru

    I'm sorry, I mis-read your question. You're right. It will!

    Here is a command line approach to do it:

    On the old box, let's export the data (but since we just need the data, not to create a database or a table, use the -n and -t options respectively):

    mysqldump -u root -p asteriskcdrdb -n -t > old_cdr.sql

    Copy this file over to your new box via scp.

    On the new box, let's get a quick backup of the data before we monkey with anything:

    mysqldump -u root -p asteriskcdrdb > new_cdr.sql

    Now, let's import the old data into the cdr database:

    mysql -u root -p asteriskcdrdb < old_cdr.sql

    That should do the trick!


Share This Page