July 26, 2010 – 6:24 pm | 33 Comments

ShareV9 of the popular Windows Phone system adds video support, android client and enterprise capabilities
London, 26 July 2010 – 3CX has released version 9 of its popular phone system for Windows. Version 9 is a …

Read the full story »
Releases

3CX Product Releases

VoIP How To

Technical tips to run your VoIP PBX more efficiently

VoIP Nuggets

Technical training videos about VoIP, SIP and 3CX

Events

3CX Trainings and Webinars around the world

Docs & FAQ

3CX Documentation how to and FAQ

Home » Docs & FAQ

Customizing CDR (Call Data Records) output

Submitted by Nick Galea on March 15, 2010 – 9:52 pm9 Comments

3CX Phone System can output call data records per call. These call data records can be configured to a format of your choice and thus its relatively easy to integrate with external billing software.

Adjusting Billing costs

3CX Phone System calculates call costs based on destination number and call duration. You will need to enter the cost for each country, for national calls and for mobile calls. The default billing rate is 1.0 (meaning <currency>1.00 per minute) for all countries. To change these rates

  1. In 3CX Management Console, go to menu option “View -> Billing Information”
  2. Edit the rates as appropriate and click “Apply”.
  3. When calls are made to external numbers, they are checked against this prefix table. If a match is found then the cost is calculated as follows:
TotalCost = Talking time * rate

CDR Output

The CDR feature provides three output types.

  1. One file containing all calls
  2. Each call in a separate file
  3. Socket output

Each channel can be enabled separately. To enable any of the CDR output channels, from the management console go to the “Settings -> Advanced” page, and select the “CDR Output” tab. Finally, once you have done this, restart the Call History Service from the “Services Status” page.

Where are the CDR Template files?

The template files are located in:

  • Windows XP / 2003 : C:\Documents and Settings\All Users\Application Data\3CX\Data\CDRTemplates

OR

  • Windows Vista / 2008 / 7 : C:\ProgramData\3CX\Data\CDRTemplates

All output is text based and can be formatted by modifying the template for each output type.

Changing CDR output location

The default output location can be changed by editing each template file. This table shows where to find the three CDR template files, and the default location where CDR data is generated by default:

Output Type Template File Default Output Location
One File …\CDRTemplates\CDRTemplate-Single.xml …\Logs\CDRSingle\calls.txt
Per Call …\CDRTemplates\CDRTemplate-PerCall.xml …\Logs\CDRMulti\calls.txt
Socket …\CDRTemplates\CDRTemplate-Socket.xml TCP::127.0.0.1:33555

Example 1: Changing CDR Output Location for the “Socket” output type

If you wanted to change the IP Address and Port for Socket delivery of CDR data:

  1. Open the “CDRTemplate-Socket.xml” file
  2. Identify the “CallTemplate” tag (typically on the second line of the template file)
  3. Change the value of the “Host” parameter to the IP Address of the target CDR Listener Service
  4. Change the value of the “Port” parameter to the Port Number of the target CDR Listener Service

So if in this example there was a CDR Listener Service on IP Address “192.168.1.22″ listining on port “40000″, this would change the “CallTemplate” tag from:

<CallTemplate Host=”127.0.0.1″ Port=”33555″ OutboundOnly=”false”>

to

<CallTemplate Host=”192.168.1.22″ Port=”40000″ OutboundOnly=”false”>

Example 2: Changing CDR Output Location for the “One File” output type

If you wanted to change the location where to save the file containing CDR Data:

  1. Open the “CDRTemplate-Single.xml” file
  2. Identify the “CallTemplate” tag (typically on the second line of the template file)
  3. Change the value of the “Folder” parameter to the target folder
  4. Change the value of the “FileName” parameter to the target filename (inside the target folder specified above)

So if in this example you wanted to save CDR Data into the “C:\Documents and Settings\All Users\Application Data\3CX\Data\Logs\CustomLogs\MyCalls.txt” file, this would change the “CallTemplate” tag from:

<CallTemplate Folder=”3CX\Data\Logs\CDRSingle\” FileName=”calls.txt” OutboundOnly=”false”>

to

<CallTemplate Folder=”3CX\Data\Logs\CustomLogs\” FileName=”MyCalls.txt” OutboundOnly=”false”>

Please note that the “Folder” parameter must be relative to the base folder, which is:

  • Windows XP / 2003: “C:\Documents and Settings\All Users\Application Data\”

OR

  • Windows Vista / 2008 / 7: “C:\ProgramData\”

So if you wanted to save CR Data into the “C:\CustomLogs\MyCalls.txt” file, this would change the “Folder” parameter to:

  • Windows XP / 2003: “..\..\..\CustomLogs\”

OR

  • Windows Vista / 2008 / 7: “..\CustomLogs\”

Editing a CDR Template

Each of the 3 Template files contains XML tags that describe which database fields should be included in the CDR, in which order, and how each field should be formatted. Keep in mind that each call has one main “Callhistory3″ record and 1 or more “CallDetails” entries.

The formatting is achieved using C# formatting strings.

Example 1: Formatting the “TotalCost” field

<TotalCost fmt=”CallCost = {0}”/>

Example 2: Adding “NewLine” characters in XML:

<NumDetails fmt=”Call details = {0}&#xD;&#xA;” />

Modifications to the CDR/SDMR script file

Due to the wide variety of 3rd party applications available out there for integration with 3CX, it is not possible to develop a script that accommodates everyone. The script requires C# development knowledge and .NET formatting to be manipulated.

3CX can develop this script and adjust it (or add functionality) based on your demands. Download the form from here, fill it up answering all sections in full detail and send this to sales@3cx.com. You will receive an answer shortly.

9 Comments »