Calculations of Call events

Does anyone have a script for calculating the Call events in the cdr file or in the csv file?I wanted to compute for the number of successful calls,number of failed call due to busy, number of failed calls due to unaswered and so on. Does any one have a tool for this or scripts that I could apply on my server. Please help on this.

Thank you very much.

Best Regards,