This is a big week for the Adhearsion community. We’re announcing a total of three new releases: Adhearsion 2.4.0, Punchblock 2.0.0 (our abstraction layer) and Matrioska 0.1.0 (our in-call apps wrapper). Those are very round numbers, but what do they mean, and why is this exciting?
So, what will I get from Adhearsion 2.4?
Also, Adhearsion 2.4 fully supports the current draft Rayo specification to give you better platform portability. Read on for the full details.
A little background
When we released Adhearsion 2.0 we promised three major things:
- Cross VoIP-platform support
- More and better standard ways for building things, including consistent method calls across all VoIP platforms
- Support for alternative Ruby interpreters
We addressed those points by including the following things in the initial Adhearsion 2.0 release:
- Support for both Asterisk and Voxeo PRISM (with rayo-server)
- Experimental JRuby support
- A feature rich new version of Adhearsion with a bunch of extra abstractions for asynchronous event handling and allowing for growth into text-to-speech and speech recognition areas.
Ahn 2.0 was a significant refactoring project that allowed for a baseline platform for continued growth of features and improvements. So here we are. Now, what’s new?
Adhearsion <3 FreeSWITCH
With early versions of Adhearsion 2 we therefore delivered a substantial baseline to the promise of the 2.x series, but the work didn’t end there. In Adhearsion 2.1, we shipped the first official support Adhearsion has had for FreeSWITCH, one of the longest-standing feature requests for the framework from way back in the days of 0.8.
At this point we had support for three VoIP platforms and the original promise began to really take shape. This also came with a downside, however; we now had essentially three codebases to maintain, and a lot of effort has been expended trying to maintain consistency across the platforms.
But even before 2.0 was released, we announced a long-term solution to this problem: the Rayo protocol. Rayo is designed to be a platform-independent third-party call control protocol taking into account the lessons learned from previous protocol designs and application platforms built on top of them. We intended for Adhearsion to eventually support only one protocol in the core framework, and thankfully earlier this year we found a partner willing to assist us in beginning to realise this vision.
Grasshopper and specifically Chris Rienzo built mod_rayo for FreeSWITCH, allowing us to treat FreeSWITCH and Voxeo PRISM identically. The development of this second full Rayo server implementation coincided with the publishing of the Rayo specification by the XSF, and both it and the new releases of Adhearsion and Punchblock comply with v0.2 of the published specification.
We hope that one day Asterisk will follow suit and add support for the Rayo protocol, for the benefit of the whole open source telephony community to be able to choose the appropriate platform for their deployment needs without having to rewrite applications or frameworks like Adhearsion in order to move between them. For now, we will be maintaining our Asterisk support, and our original FreeSWITCH support remains in Punchblock 2.0, but the core team’s future effort will be toward bettering mod_rayo, and our original FreeSWITCH support may be removed in a future version of Adhearsion/Punchblock. We suggest that everyone using FreeSWITCH today with Adhearsion transition to mod_rayo for this reason and all of the other benefits afforded by Rayo including clustering and multi-tenancy support.
Adhearsion <3 JRuby
We’ve always almost supported JRuby; we were so close to production stability it was tantalising, but several of our dependencies and some of our own code had issues that just halted the party. Now we’re proud to say that, with these latest releases, we have applications in production under load running on JRuby and ticking along nicely. In fact, a large amount of refactoring had to go on to achieve this, particularly simplification of our use of Nokogiri and XML, but that work is now done and the codebase is better for it.
Adhearsion and all of its major dependencies now have passing test suites on JRuby and we are committing to keep it this way; some dependencies are also passing on Rubinius, though this support remains unofficial for now. We hope that at some point soon Rubinius support will become official too, but there is still work to be done to achieve this.
Adhearsion <3 Speed
We weren’t happy with performance equivalent to Adhearsion 1, so earlier this year we got to work to improve this situation. We also had a client who was interested in pushing Adhearsion to these new heights, and had the kind of traffic that could really benefit from the scale: Ifbyphone. Thanks to Ifbyphone’s commitment to the Adhearsion project, we were able to spend the time necessary to push performance of Adhearsion 2 to solid multiples of what had been established previously.
The first big win was polishing up our JRuby support. Moving to the JVM gave us its raw speed owing to things like the JIT compiler and much more efficient garbage collection. We also gained true parallelism for our threads, allowing Adhearsion to utilise all cores of a system’s CPU for the first time.
But our performance improvement efforts didn’t stop at using the JVM; we made several large changes, particularly to Asterisk support, to improve performance, including rewriting our Asterisk AMI parser to gain a 22x improvement in event parsing rate. We also removed an intermediate XML representation for call control messages when communicating with Asterisk (over AMI) or FreeSWITCH (over EventSocket) to reduce the number of allocations and serialisation operations, which has also shown drastic reduction in CPU utilisation and message latency per call.
Overall, this is the best Adhearsion release yet, and we hope you enjoy using it as much as we sweated to build it. You can upgrade by doing a simple
bundle update in your Adhearsion project, or do
gem install adhearsion && ahn create myproject to get started on a new project today. For more details on the changes that have been made, check out the Adhearsion and Punchblock changelogs, and API documentation. Also look out for tutorial posts coming up over the next few weeks highlighting some of the new features.