/tiny_cdr

A small application for turning FreeSWITCH xml_cdr log files into postgres and couchdb records

Primary LanguageJavaScript

# Copyright (c) 2010 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#

TinyCDR is a simple app for pushing FreeSWITCH xml_cdr records into both a 
PostgreSQL (or other Sequel-supported db) and CouchDB data store.  The Sequel record is just 
the basics and the couch record is the exact xml as POSTed by FreeSWITCH's mod_xml_cdr.  
This is fresh stuff, very few docs.  The web side is a ramaze app, start with

ruby start.rb

and point FreeSWITCH's mod_xml_curl at the url it tells you it's listening on.

To import a single record, use

ruby -r ./app -r 'Call.create_from_xml(File.read("/path/to/the/xml/file.xml"))'


PREREQUISITES

* couchdb
* ruby
  * ramaze
  * nokogiri
  * makura
  * sequel
  * pg (for postgres, mysql or other adapters may work)

INSTALL

  * Check out the source.
  * run rake setup, this should get the ruby dependencies
  * Get some coffee and a newspaper or your favorite news feed ready
  * run rake build_couch
  * This is going to take a long time, builds erlang and couch, read your news
  * Done with your news?  Read the couch intro: http://couchdb.apache.org/docs/intro.html
  * Mastered the Intro? Read the couch view api: http://wiki.apache.org/couchdb/HTTP_view_API
  * rake build_couch should be done, if couchdb starts you can check it in your browser
    at http://localhost:5984/_utils
  * Create the tiny_cdr directory in the futon admin interface, do not add any users 
    or an admin user to couch yet (It's only bound to localhost unless you told it otherwise)
  * Create the Sequel database (for postgres, this is createdb tiny_cdr)
  * Modify model/init.rb to point to your databases you created
  * Test it, with irb -r ./app in the top-level of the source tree
  * Let us know if it doesn't work.
  * If it does work, you can use
    Call.create_from_xml(File.read("/path/to/the/xml/file.xml")) as from above. To import a bunch, use
    Dir["/path/to/files/*.xml"].each { |file| Call.create_from_xml(File.read(file)) }
  * Now you can start the webserver (thin -R config.ru) and hit http://localhost:7000 to see a report

TODO
  * Test Harness
  * Reports (Lots of reports!)
  * Documentation


SUPPORT
  #rubyists on Freenode irc (http://freenode.net)