Export call log

Discussion in '3CX Phone System - General' started by ovi, Jan 24, 2018.

Thread Status:
Not open for further replies.
  1. ovi

    ovi

    Joined:
    Jan 24, 2018
    Messages:
    5
    Likes Received:
    0
    Hi everyone,

    I want to export during the day the call log for us dashboard.
    How is the best solution ? cdr export ? export db ? any other solutions ?

    thanks !

    Vince
     
  2. voiptoys

    voiptoys Member

    Joined:
    Feb 13, 2013
    Messages:
    493
    Likes Received:
    81
    First, be aware that 3CX doesn't always write records to the database right away. There may be a delay while 3CX caches writes to the database. You can extract data from the CDR files, but they don't typically get written until the call is complete (at least I believe that to be the case) so that can also add delays. The only way to get real-time information is to monitor the 3CX events using the Call Control API. It's a bit complicated to sift through all the events, but it is possible to do. Otherwise, take a look at our 3CX Exporter -- this application can synchronize the data in 3CX with a SQL Server database, in close to real time.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. mariosM_3CX

    mariosM_3CX Support Team
    Staff Member 3CX Support

    Joined:
    Nov 1, 2017
    Messages:
    401
    Likes Received:
    36
    Hello @ovi @voiptoys

    Just to confirm the below. Yes that is correct, cdr will be written(file/socket) once a call is completed.
     
  4. ovi

    ovi

    Joined:
    Jan 24, 2018
    Messages:
    5
    Likes Received:
    0
    Ok but is not a problem, i want to export the call every 15 min. You think cdr is the better way ? or directly a export from the database ?
     
  5. mariosM_3CX

    mariosM_3CX Support Team
    Staff Member 3CX Support

    Joined:
    Nov 1, 2017
    Messages:
    401
    Likes Received:
    36
    I would go with CDR as accessing the Database is not advised.
    Just note that using sockets to get the cdr, the PBX will generate a CDR at the time that the call completes. You cannot query the PBX for calls every 15 minutes using sockets.
    So either you will connect using sockets and store this info as needed, or alternatively you will output CDR to a file(s)(single/multiple) and read the files at any time interval you want.
     
  6. ovi

    ovi

    Joined:
    Jan 24, 2018
    Messages:
    5
    Likes Received:
    0
    Ok thanks !
    Did you hav some examples to read the cdr ? with anything ? or extract the data ?
     
  7. mariosM_3CX

    mariosM_3CX Support Team
    Staff Member 3CX Support

    Joined:
    Nov 1, 2017
    Messages:
    401
    Likes Received:
    36
    If you are going to feed the CDR automatically to another software(dashboard?) then some kind of implementation is required. Either reading the files either with socket programming.

    If you are going to output to files, these are located on the following locations:
    Windows: C:\ProgramData\3CX\Instance1\Data\Logs\CDRLogs
    Linux: /var/lib/3cxpbx/Instance1/Data/Logs/CDRLogs
    You can use a batch to copy them where needed.
    You can also use putty to test the socket passive mode

    What are you trying to accomplish exactly?
     
    #7 mariosM_3CX, Jan 26, 2018
    Last edited: Jan 26, 2018
  8. voiptoys

    voiptoys Member

    Joined:
    Feb 13, 2013
    Messages:
    493
    Likes Received:
    81
    The concern with using sockets is if the socket connection goes down, for any reason, you lose the data. Relying on the CDR files is far safer since you can always catch up if your CDR processing application goes down temporarily. IMO
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. ovi

    ovi

    Joined:
    Jan 24, 2018
    Messages:
    5
    Likes Received:
    0
    Hello,
    Thanks for all the info, so I need to copy on my mgt server (windows) and extract the info with ps.
     
  10. ovi

    ovi

    Joined:
    Jan 24, 2018
    Messages:
    5
    Likes Received:
    0
    Here my solution:
    cat /var/lib/3cxpbx/Instance1/Data/Logs/CDRLogs/cdr.log | grep -o 'Call' | wc -l > /home/script/nbcall.txt

    thanks !
     
  11. mariosM_3CX

    mariosM_3CX Support Team
    Staff Member 3CX Support

    Joined:
    Nov 1, 2017
    Messages:
    401
    Likes Received:
    36
    Thanks for sharing @ovi as others may find it useful.
     
Thread Status:
Not open for further replies.