Click to Call on stage with Sinatra, Rack and Passenger

I have been preparing an Amazon Machine Image (AMI) with Adhearsion, Asterisk and all of the available components installed and pre-configur
Media_httpwwwmodrails_ebioq
ed to be made public soon. For the AMI I decided to get the Sinatra web app included with the Click To Call component up and running as a daemon. I used a combination of Rack and Passenger, since they make the process so easy and production ready. To this end I have updated the README and Click To Call component I covered in my previous blog post to include the how to and Rack configuration file required. To get this up and running do the following:
  • Install the Apache Webserver
  • sudo gem install rack
  • sudo gem install passenger (follow instructions here for compiling the Apache module)
Copy the files and directories in ~ahn-project/components/restful_clicktocall/web directory to the appropriate file system location for your Apache web server. Add these virtual host settings to your Apache configuration (ie - /etc/httpd/conf/httpd.conf): [sourcecode language='php'] ServerName ec2-174-129-89-20.compute-1.amazonaws.com DocumentRoot /var/www/restful_clicktocall_web/public [/sourcecode] Change line three to reflect your configuration. Restart your Apache web server and then connect to the site you configured. For more options I recommend referring to the Passenger documentation found here. Stay tuned for the upcoming Amazon Machine Image!
Posted
 

RESTful Click to Call with Adhearsion

One of the great new features of the latest release of Adhearsion is the RESTful RPC API. With the RESTful API one may now use virtually any modern language to interact with Adhearsion to voice enable their apps, including PHP, Perl, Python, Java and more. Everytime you create a new Adhearsion project the resful_rpc component is installed, just disabled by default. To enable the REST API of your new Adhearsion app, simply do the following from within your project directory: ahn enable component restful_rpc Thats it! Your Adhearsion app now has a REST API. To showcase this capability we have created an example component (restful_clicktocall) that provides a web form to do a 'Click to Call'. The web form is developed using JQuery in order to provide a dynamic interface, using AJAX (but with JSON), that shows call progress. The web form is then served up using the great Sinatra library as the web server that in turn calls Adhearsion methods using the restful_adhearsion client library. Enough of that, lets see how it works: [blip.tv ?posts_id=1743747&dest=-1] Feel free to download the example component here and give it a try yourself.
Posted