Section 10.2. Call Detail Recording

10.2. Call Detail Recording

Without even being told, Asterisk assumes that you want to store CDR information. Quite a smart machine, yes?

By default, Asterisk will create a CSV [*] file and place it in the folder /var/log/asterisk/cdr-csv/ . To the naked eye, this file looks like a bit of a mess. If, however, you separate each line according to the commas, you will find that each line contains information about a particular call, and that the commas separate the following values:

[*] A Comma Separated Values (CSV) file is a common method of formatting database-type information in a text file. You can open CSV files with a text editor, but most spreadsheet and database programs will also read them and properly parse them into rows and columns .



accountcode

Assigned if the application SetAccount( ) is used, or if configured for the channel in the channel configuration file (i.e., sip.conf ). The account code is assigned on a per-channel basis.



src

Received Caller*ID (string, 80 characters ).



dst

Destination extension.



dcontext

Destination context.



clid

Caller*ID with text (80 characters).



channel

Channel used (80 characters).



dstchannel

Destination channel, if appropriate (80 characters).



lastapp

Last application, if appropriate (80 characters).



lastdata

Last application data (arguments, 80 characters).



start

Start of call (date/time).



answer

Answer of call (date/time).



end

End of call (date/time).



duration

Total time in system, in seconds (integer), from dial to hangup.



billsec

Total time call is up, in seconds (integer), from answer to hangup.



disposition

What happened to the call ( ANSWERED , NO ANSWER , BUSY ).



amaflags

What flags to use ( DOCUMENTATION , BILL , IGNORE , etc.), specified on a per-channel basis, like accountcode . AMA flags stand for Automated Message Accounting flags, which are somewhat standard (supposedly) in the industry.



userfield

A user -defined field, maximum 255 characters.

Storing CDRs in a Database

CDRs can also be stored in a database. Asterisk currently supports SQLite, PostGreSQL, MySQL, and unixODBC. The configuration details for these databases will not be covered in this book, but they are outlined in the Asterisk source code, under the doc/ subdirectory. (For licensing reasons, cdr_mysql is in asterisk-addons .) Many people prefer to store their CDRs in a database because this makes it easier to query them for specific information, such as billing or toll fraud. We can use the CDR applications to manipulate the current CDR from the dialplan (adding information to the custom field, for example).


10.2.1. CDR Challenges

While Asterisk will happily store information about any calls that pass through it, it cannot store information it is not given. For example, if you have SIP devices that are allowed to reinvite, once Asterisk has finished setting up the calls, the devices will no longer need its assistance. Whether or not those devices subsequently report call detail information back to it is something Asterisk is unable to control. If CDRs are important, make sure your IP devices are not allowed to reinvite. [*]

[*] Reinvites can be turned off in sip.conf with canreinvite=no . Similar functionality is controlled in iax.conf with notransfer=yes .



Asterisk. The Future of Telephony
Asterisk: The Future of Telephony: The Future of Telephony
ISBN: B0026OR3OO
EAN: N/A
Year: 2001
Pages: 380

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net