Call Detail Records

Each call will generate one or more Call Detail Record (CDR). CDRs are written after the call ends, and contains all information needed for accounting and billing that call. As an example, an outbound call (outbound is most critical for accounting and billing) the CDR would contain information such as date/time, caller account, caller device, destination, and duration. As an added bonus it can contain all kinds of details about the call itself, such as codec used, outbound route or gateway, and/or the status of the system.

So, in CDRs you can store and gather any kind of info you deem useful on a per-call basis. A complete call is often composed of an A leg (caller) bridged to a B leg (callee). In the FS console, the show calls command shows that each call is composed of two channels (A leg and B leg). You can choose to write a CDR for A leg, B leg, or both.

There are two main kinds of CDRs FreeSWITCH is able to generate: Comma Separated Value (CSV) files, and XML files. CSV files are easier for humans to read, and can be parsed quite simply with regular expressions and spreadsheets. XML CDRs are able to better describe complex information, and can be processed by advanced XML and XSLT libraries.

From their respective configuration files (cdr_csv.conf.xml and xml_cdr.conf.xml) you can define which call legs you want to write CDRs about. By default, like in normal practice, only A legs generate CDRs.

CDRs are built following a template that can be constructed to contain any kind of variable available in the channel, and in any format you may deem useful. For example, there is a template that mimics the Asterisk CDR format, that you can use for compatibility with legacy accounting and billing software, and another template that would generates files with SQL insert rows, that can then be used to directly populate a database.

CDRs will then be kept as traffic documentation, and/or further processed: inserted in a database, for example, where each call will be given a cost, and that cost added to the caller account bill.

XML or CSV — the best practice in any case is to have files written to the disc, that can be used to reconcile accounting and billing in case of database or network malfunction. Also, at the end of each individual call, all of the variables that were associated with the leg (many more variables than you suspect!) can be automatically dumped in the file, so allowing for later debug and troubleshooting.

An advanced technique that can be useful in special or corner cases: CDRs can be generated real-time by a custom application that listens to FS events and do whatever is needed to record, rate, and/or bill each single call while it happens, interfacing whatever systems your operation and business model requires (AAA, Radius, Diameter, Databases, The Spanish Inquisition, and more).

Tip

In a high volume environment, it is considered best practice to do the further massaging of CDRs on a different machine to the FreeSWITCH server. This is so you don't have the CPU and Disk load degrade the performance and the audio quality delivered to customers.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.96.37