Importing CDR data from trixbox

Discussion in 'General' started by jcardinal, Sep 17, 2009.

  1. jcardinal

    Joined:
    Jul 13, 2009
    Messages:
    35
    Likes Received:
    0
    I'm trying to import CDR data from a previous trixbox installation into my current elastix system. After a bit of searching, here's what I've come up with. I would appreciate if someone could confirm whether this should work.

    1. To get all CDR entries from trixbox, I'll do the following:
    Code:
    mysqldump -u root -p --opt --no-create-info asteriskcdrdb cdr >> cdrBackup.sql
    2. Copy cdrBackup.sql to my elastix system

    3. On the elastix system:
    Code:
    mysql -u root -p asteriskcdrdb < cdrBackup.sql
    Does this sound like it should work? Any potential problems with this approach?

    -Justin
     
  2. dicko

    Joined:
    Oct 24, 2008
    Messages:
    4,099
    Likes Received:
    0
    They forked FreePBX up royally, but it's hard to see how they could similarly fork Asterisk up too.

    try from trickybox:

    mysql -u root -p<trixboxrootpassword> -D asteriskcdrdb -e 'desc cdr'

    and from Elastix:

    mysql -u root -peLaStIx.2oo7 -D asteriskcdrdb -e 'desc cdr'

    If the table structures agree then all should be fine.

    Dicko
     
  3. jcardinal

    Joined:
    Jul 13, 2009
    Messages:
    35
    Likes Received:
    0
    I should have mentioned that in my original post, but I did do a similar check to make sure the cdr tables had the same structures. I went into the mysql CLI on each box and did
    Code:
    use asteriskcdrdb;
    describe cdr;
    and the output was the same on both with one minor difference: on elastix, many of the "Default" values are blank whereas on trixbox, those values are marked "NULL". I know that's essentially the same...but is it enough to cause a problem?
     
  4. dicko

    Joined:
    Oct 24, 2008
    Messages:
    4,099
    Likes Received:
    0
    There should be no problems. I would point out however that there is a big difference between NULL and an empty string in mysql NULL evaluates logically to false, an empty string to true, but apart from that the import should work as the defaults are used for inserts to replace NULL values and the Elastix table is semantically more permissive, blah blah . . . .

    p.s. I note your calls to mysqldump and mysql have an undefined password (-p option), and in the case of mysql a missing -D before the asteriskcdrdb
     
  5. jcardinal

    Joined:
    Jul 13, 2009
    Messages:
    35
    Likes Received:
    0
    Thanks for your extremely helpful replies. I appreciate how complete your answers are. I see you helping people in every thread I view! +1 karma for you :)

    Interesting / good to know that mysql evaluates NULL as false and an empty string as true. In this case with the CDR database, am I right in assuming it's a moot point since every CDR entry should have data for every field and the defaults aren't actually used?

    I like to leave the password out of the command and wait to be prompted so the password isn't readily available in history. I suppose it's pointless since the password is available in plain text in config files, but it makes me feel better anyway :p

    As far as the -D option...in my search for how to import the dumped file, I got the same result here and here, neither of which used -D, so I assumed it wasn't required.
     
  6. dicko

    Joined:
    Oct 24, 2008
    Messages:
    4,099
    Likes Received:
    0
    Thank you, (karma is good if it runs over dogma).

    Moot indeed, asteriskcdrdb is basically a simple data repository (also more easily available as .csv files(s) if you have a security concern), just be careful if you expand your use of it.

    By default the root account is only available to localhost (127.0.0.1) , so unless you are more deeply compromised, then you are safe, I would not mess with the root account either password or access control, as there are many hardcoded instances in Elastix and it's value added contributions. Just create other account(s) restricted as tightly as possible if you need data available "outside the box".

    As far as the calling syntax, whatever works for you, syntaces change with time your refs are a little dated, strict usage is always encouraged of course. mysql in Elastix is 5.0.nn I believe, it is a little stricter.

    regards
    dicko
     

Share This Page