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.