Python Script to Extract Call Record from Cisco CDR

Python Script to Extract Call Record from Cisco CDR

uccollabing.com

There is a python script written by Steve Campbell which extracts Call Detailed Record (CDR) for an extension using Python Script.  Extraction of the record is quite simple and faster. The only drawback i see at this time is it can run the script against one extension only at a time which means you can search only one extension number in the whole CDR Report.
 

 

The script will pull out Data/Time, Duration, Calling Number and Called Number from raw CDR Report.

Procedure:

  • To start using the Python Script, you need to have Python installed in your PC. You can download python from official website (“https://www.python.org/downloads/“).
  • Once the software is downloaded, you need to install the application in your PC.
  • Download Python Script from https://github.com/sdcampbell/PyCDR site and copy the files from the folder PyCDR-master to  Python Directory.
    To Find Python Directory, follow either of the below steps:
    OPTION 1
    “C:\Users\USERNAME\AppData\Local\Programs\Python\Python36-32\”(Replace USERNAME with your actual Username of Windows Machine)
    OPTION 2
    Click on Start Menu
    Type Python in the Search Program and File box
    uccollabing.com
    Right Click on Python 3.6 (32 bit) or (64 bit) and click on Open file location
    A window will open; click on the address bar and copy the location from the address bar
  • Also download CDR Raw Data from Cisco Unified Communications Manager and copy it in the python directory as shown in the above step
  • Now open Command Prompt and execute the command

    C:\>    CD C:\Users\USERNAME\AppData\Local\Programs\Python\Python36-32\
    OR
    C:\> CD(Paste the location from the address bar as shown in the option 2)
    uccollabing.com
    ——————————————————–
    C:\….\Python36-32>   python.exe PyCDR.py “CDR Raw Report.txt” “Output.csv” 10000             >>> Execute this command
    uccollabing.com

    Once the command is executed, you will see a file “Output.csv” in the same folder that would have the CDR Records inside the fil

uccollabing.com

Sample Output

Hope this helps!

5 thoughts on “Python Script to Extract Call Record from Cisco CDR”

  1. Hello,
    What’s the version of python in this example?
    I downloaded python-3.6.1-amd64.exe but failed like this:

    C:\>C:\Users\Kyle\AppData\Local\Programs\Python\Python36\python.exe PyCDR.py “CDR Raw Report.txt” “Output.csv” 1005
    C:\Users\Kyle\AppData\Local\Programs\Python\Python36\python.exe: can’t open file ‘PyCDR.py’: [Errno 2] No such file or directory

    Hope to hear you soon.

    1. Hello Kyle,
      I am using Python version 3.6.0 in the example. To make your python work, i would request you to follow the below steps:
      Click on Start Button
      Type Python in the box “Search Program and Files”
      You would see something “Python 3.6 (32 bit)” or “Python 3.6 (64 bit)”. Right click and click on “Open file Location”. You would see a window opened where python executive file is stored and that is your python location.
      I have modified the post for more ease and convenient. Please check and let me know if this works.

  2. Pingback: Voip Detective - An Excellent CDR analys Tool

  3. Hi Steve,

    This script helped me a lot. I have 2 queries:
    1) The date that is pulled is that GMT?
    2) The script shows the epoch time after 300th row approx.

    Thanks,
    Anish

  4. Hello, thanks for the script. I have an particular error in the output.csv file, when the calls are external the information is in that format:

    12/31/69 19:00:00,0:00:00,5006,976506355
    12/31/69 19:00:00,0:00:00,5006,041477928
    12/31/69 19:00:00,0:00:00,962745841,5006
    12/31/69 19:00:00,0:00:00,962745841,5006
    12/31/69 19:00:00,0:00:00,13303000,5006
    12/31/69 19:00:00,0:00:00,5006,041471746
    12/31/69 19:00:00,0:00:00,5006,041471746
    12/31/69 19:00:00,0:00:00,5006,*8
    12/31/69 19:00:00,0:00:00,5006,#7
    12/31/69 19:00:00,0:00:00,5006,930477746
    12/31/69 19:00:00,0:00:00,5006,#7
    12/31/69 19:00:00,0:00:00,5006,*8
    12/31/69 19:00:00,0:00:00,5006,*8
    12/31/69 19:00:00,0:00:00,5006,50
    12/31/69 19:00:00,0:00:00,5006,930443135
    12/31/69 19:00:00,0:00:00,5006,535013

    How can I fixed this?

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top