Page 261 - Asterisk™: The Future of Telephony
P. 261

• Pattern matching
                 • Usage consistency
                 • Source code organization
               Many people addressed these matters by writing the advanced logic in external pro-
               grams such as Perl and PHP, and connecting to Asterisk via AMI and AGI. Unfortu-
               nately, while the desired power was now available, these interactions did not always
               simplify things for the developer. To the contrary, they often made development more
               complex. Using existing technologies in Asterisk, but aiming to deliver power and sim-
               plicity, Adhearsion has a new approach.


               Asterisk Development with Adhearsion
               Adhearsion is an open source (LGPL) framework that is designed to improve Asterisk
               solution development. It rests above an Asterisk system, handling parts or all of the
               dialplan and, in a few unique ways, manages access to Asterisk with several improved
               interfaces. Because it runs as a separate daemon process and integrates through the
               already-present Gateway (AGI) and Manager (AMI) interfaces, configuring a context
               to use Adhearsion is as simple as adding a few lines to your dialplan or adding a user
               to manager.conf.
               Adhearsion primarily uses the highly dynamic, object-oriented Ruby programming
               language, but has optional support for other languages such as C or Java. In the VoIP
               world, many things exist as conceptual objects, which means that object-oriented pro-
               gramming can make a lot of sense. Those familiar with Python, Perl, or other scripting
               languages should have no trouble picking up Ruby, and for those who don’t, Ruby is
               an excellent choice for your first scripting language.

               Installing Adhearsion

               Ruby software is generally installed through Ruby’s package manager (similar to Linux
               package managers, but for the Ruby platform exclusively). Adhearsion exists as a gem
               in the standard RubyGems trove so, with Ruby and RubyGems installed, Adhearsion
               is only one install command away.

               Installing Ruby/RubyGems on AsteriskNOW

               AsteriskNOW comes standard with Ruby but not RubyGems (for support reasons).
               Thankfully, RubyGems can be easily installed from the Ruby rPath trove with the fol-
               lowing command:

                   conary update rubygems=ruby.rpath.org@rpl:devel
                   source /etc/profile






                                                           Asterisk Development with Adhearsion | 233
   256   257   258   259   260   261   262   263   264   265   266