Writing CDRs

Call detailed records (CDRs) are logs containing detailed information related to phone calls, such as: the time they were initiated, their origin and the destination addresses, the call duration etc.

To write the call detailed records (CDRs) you can use one of Yate's predefined options: write to a file or to a database.

Writing the CDRs to a file
To enable writing the CDRs to a file edit cdrfile.conf and set:
 * file - name of the file where to write the CDRs to
 * format - specifies the format for writing, the parameters to write and their order. You have two formats:
 * comma separated values (.csv)
 * tabs separated values (.tsv)
 * you can choose to use the combined format to write a single entry for each call instead of one for each call leg(the default)

Example
The file where CRDs are written is /var/log/yate-cdr.csv. If you want to change the .csv predefined format, you can uncomment it in cdrfile.conf.

[general] ; file: string: Name of the file to write the CDR to ; You should check that this file is log rotated - see /etc/logrotate.d/yate ; Example: file=/var/log/yate-cdr.tsv file=/var/log/yate-cdr.csv ; comma-separated (.csv), combined=false format=${time},"${billid}","${chan}","${address}","${caller}","${called}",${billtime},${ringtime},${duration},"${direction}","${status}","${reason}"

Example output
In /var/log/yate-cdr.csv you'll see something similar to the log below:

1393240867.185,"1392970078-5","sip/3","192.168.1.1:5060","+8564567","333",0.000,0.000,0.075,"outgoing","outgoing","Offline" 1393240867.183,"1392970078-5","ybts/5","001900000000001","+8564567","333",0.000,0.000,0.079,"incoming","accepted","noroute" 1393241254.844,"1392970078-7","ybts/7","001900000000001","+8564567","100",13.993,0.000,14.042,"incoming","answered","normal-clearing" 1393241254.846,"1392970078-7","sip/5","192.168.1.1:5060","+8564567","100",13.994,0.000,14.041,"outgoing","answered","normal-clearing"

Note: In the messages above we see the call logs for 2 calls (we have only 2 billids: 1392970078-5 and 1392970078-7)
 * first call: from +8564567 to 333. +8564567 is the GSM phone with IMSI 001900000000001. The call was routed outside the network using a SIP account (server 192.168.1.1). YateBTS routed the call to 192.168.1.1 which answered that 333 is Offline.
 * second call: from +8564567 to 100. Call was answered and billtime is 13.994 seconds.