Formatted and colourized code: http://pastebin.freeswitch.org/15172