Asterisk now generates Call Detail Records. See include/asterisk/cdr.h for all the fields which are recorded. By default, records in comma-separated values will be created in /var/log/asterisk/cdr-csv. You can specify account codes and AMA (Automated Machine Accounting) flags on a per-channel (Zaptel et al) or per-user (IAX) basis to help with accounting. Look at the top of cdr/cdr_csv.c to see the format for the records. ONE IMPORTANT NOTE: If you are trying to collect records on IAX to IAX calls you need to be aware that by default, IAX will attempt to transfer calls in this situation (if DTMF is not required). When the transfer is completed the call is dumped from the middle machine and thus the call detail records will report a short call time. If you want detailed records you must turn off IAX transfer, but unless your servers are very close together, you will definitely get a latency hit from doing so.