Asterisk CDR is the file which contain the information about all incoming/outgoing call records. You can store these information in database or csv file but the default storage is csv. CDR file location is “/var/log/asterisk/cdr-csv/”.
To view current call detail records issue:
1 2 3 | cat /var/log/asterisk/cdr-csv/* |
The other option is:
1 2 3 | grep -P '\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}' /var/log/asterisk/cdr-csv/*.csv | cut -d, -f2,3,10,15 | awk -F"," {'print "From:\t"$1"\nTo:\t"$2"\nDate:\t"$3"\nStatus:\t"$4"\n----------------\n"'} |
The file that controls Asterisk settings for CDR is “/etc/asterisk/cdr_custom.conf”.
1 2 3 4 5 6 7 8 9 10 11 12 | ; ; Mappings for custom config file ; ; to get your csv output in a format tailored to your liking, uncomment the following ; and look for the output in the cdr-custom/Master.csv file (usually in /var/log/asterisk). ; ; ;[mappings] ;Master.csv => ${CSV_QUOTE(${CDR(clid)})},${CSV_QUOTE(${CDR(src)})},${CSV_QUOTE(${CDR(dst)})},${CSV_QUOTE(${CDR(dcontext)})},${CSV_QUOTE(${CDR(channel)})},${CSV_QUOTE(${CDR(dstchannel)})},${CSV_QUOTE(${CDR(lastapp)})},${CSV_QUOTE(${CDR(lastdata)})},${CSV_QUOTE(${CDR(start)})},${CSV_QUOTE(${CDR(answer)})},${CSV_QUOTE(${CDR(end)})},${CSV_QUOTE(${CDR(duration)})},${CSV_QUOTE(${CDR(billsec)})},${CSV_QUOTE(${CDR(disposition)})},${CSV_QUOTE(${CDR(amaflags)})},${CSV_QUOTE(${CDR(accountcode)})},${CSV_QUOTE(${CDR(uniqueid)})},${CSV_QUOTE(${CDR(userfield)})} ;Simple.csv => ${CSV_QUOTE(${EPOCH})},${CSV_QUOTE(${CDR(src)})},${CSV_QUOTE(${CDR(dst)})} |
You can adjust this file and set your custom CDR records.