Chapter 13. Managing Your Asterisk System

It won’t be covered in the book. The source code has to be useful for something, after all.

Larry Wall

While there is a cornucopia of creative things that you are going to want to do with your spanking-new Asterisk system, there are also some basic, unglamorous, dare we say, boring things that need to be discussed.

Call Detail Recording

Without even being told, Asterisk assumes that you want to store CDR information.[139]

By default, Asterisk will create a CSV file and place it in the folder /var/log/asterisk/cdr-csv/.[140] 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:

accountcode

Assigned if configured for the channel in the channel configuration file (i.e., sip.conf). The account code is assigned on a per-channel basis. You can also change this value from the dialplan by setting CDR(accountcode).

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.



[139] If you are wondering why such an obviously simple thing seems to be such an achievement, the reason is simply that many traditional PBXes do not have this capability built in. With those systems, you have to purchase some sort of third-party appliance even just to capture the raw call data. Asterisk simply stores it. No drama. No cost. No kidding.

[140] 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.

Get Asterisk: The Future of Telephony, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.