Select Page

I use Tropo for their wonderful GRXML support and speech recognition capabilities. However, one thing that I would like to see improved is their reporting capabilities, especially in respect to their Call Detail Reports (CDR) data, which is lodged deeply within text based log files that get tarballed and stored in their FTP/website for you to view manually.

This leaves a lot to be desired from a billing and usage reporting perspective, especially as you compare offerings from similar companies like Twilio and Plivo, both of which offer rich reporting capabilities via their REST APIs.

One option to work around this is to track each call yourself as it’s being taken, using the On event to pull the session details when a call is completed (similar to how you would handle the StatusCallback of a Twilio call.)

Another option is to actually pull the raw logs from Tropo and parse them into usable segments, then save them to a database (or some other storage.) In this manor, you can front-end your own basic web API for billing purposes, or connect directly to the database for the CDR data.

The current documentation available from Tropo is an example in Ruby, and while helpful, didn’t do a lot for me. For one, I found that my log files are always tarballed when the next hourly log begins, meaning I can’t just FTP and pull the raw text file like in their example. (I also had variable results with untarring the files due to size and PHP limits.) Additionally, I found that breaking the lines on “Saving CDR” gave me the most accurate results of CDR phone call data, because hitting CDR lines before this didn’t give completed Duration results (-1.)

So as a result, I’ve created a basic PHP class that will parse a log file for you into a PHP array (i.e., the equivalent of json_decode( $json, true)) and then you can use or save the CDR’s anywhere you choose.

You can view the code at Github here. Hope this helps someone out there!

How do you handle your Tropo logs and CDR data? Suggestions for improvement are always welcome!

Share This