Call logs

Asterisk keeps track of call data records (cdr) in the /var/log/asterisk/cdr-csv/ directory. Inside the folder there will be a comma seperated file (csv) file named Master.csv. This file contains a lot of useful details of calls.

Within the Master.csv file, each log of the call will record various fields. The fields are listed in the table below:

accountcode: What account number to use: Asterisk billing account, (string, 20 characters)
src: Caller*ID number (string, 80 characters)
dst: Destination extension (string, 80 characters)
dcontext: Destination context (string, 80 characters)
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)
billsec: Total time call is up, in seconds (integer)
disposition: What happened to the call: ANSWERED, NO ANSWER, BUSY, FAILED
amaflags: What flags to use: see amaflags::DOCUMENTATION, BILL, IGNORE etc, specified on a per channel basis like accountcode.
uniqueid: Defines a unique identifier. This is an optional field turned on in the Ubuntu installation, in the file /etc/asterisk/cdr.conf
userfield: Defines the value of the user field. This is an optional field turned on in the Ubuntu installation, in the file /etc/asterisk/cdr.conf

Below is a line taken from the /var/log/asterisk/cdr-csv/Master.csv file. To view the file use the less, cat, head, or tail command. For example, to view the contents use sudo cat /var/log/asterisk/cdr-csv/Master.csv.  The line below is comma separated between fields.
"","matthew","101","phones",""""" <matthew>","SIP/matthew-00000004","SIP/eva-00000005","Dial","SIP/eva","2017-06-10 15:19:31","2017-06-10 15:19:36","2017-06-10 15:19:53",21,17,"ANSWERED","DOCUMENTATION","1497107971.6",""

The comma seperated list can be difficult to read. Matching the fields with the record makes it a little easier to read the data. Some of the fields do not include data, but rather “”, which means no data available. Looking at the details from the record, you can see that it was a 21 second total call from matthew to eva at extension 101. Removing the phone ringing time, 17 seconds is the duration that could be billable for call time.

accountcode: “”
src: “matthew”
dst: “101”
dcontext: “phones”
clid: “”””” <matthew>”
channel: “SIP/matthew-00000004”
dstchannel: “SIP/eva-00000005”
lastapp: “Dial”
lastdata: “SIP/eva”
start: “2017-06-10 15:19:31”
answer: “2017-06-10 15:19:36”
end: “2017-06-10 15:19:53”
duration: “21”
billsec: “17”
disposition: “ANSWERED”
amaflags: “DOCUMENTATION”
uniqueid: “1497107971.6”
userfield: “”