Tropo is part of CiscoLearn More

Deploying Tropo Apps with Orchestra.io

Posted on April 22, 2011 by Adam Kalsey

On a visit to Nashville, Tennessee, for the PHP Community Conference (Tropo is one of the sponsors) I got to hear a talk from Helgi Þorbjörnsson on front-end caching techniques.

During his talk Helgi mentioned a new Git-based deployment service for PHP applications – Orchestra.

Orchestra is very similar to other Git-based deployment service for different langages – Heroku for Ruby, and Nodester for Node.js – but it’s meant to support deployment of PHP-based applications.

If you’re like me, and you missed the chance to take part in the Codeita beta, you’re anxious to give a Git-based deployment service for PHP a try. When I checked out Orchestra, it looked incredibly easy to use, and a snap to get started with.

It’s also an excellent match for Tropo applications written with our PHP class library for WebAPI.

How easy is it to use Orchestra to deploy a PHP-based Tropo app?

I was able to write, deploy and test an app before Helgi had finished his presentation at the PHP Community Conference (about 20 minutes total with conference-grade wifi). I was even able to hear the end of Helgi’s talk.

Here is how I did it.

Building a Tropo WebAPI App

I built a very simply Tropo application using the PHP class library WebAPI.

My sample application is meant to answer an incoming call, ask the caller what their favorite programming language is (along with some choices), and then say something snarky based on their response.

Building a speech recognition app like this with Tropo is very easy. I also made use of the awesome Limonade PHP framework for my app.

All of the code for this app is made available on GitHub, which is also part of the process for deploying apps to Orchestra.

Setting up and Deploying to Orchestra

Orchestra settings

Go to the Orchestra site and create a new account. Take a spin through the knowledge base if you want more specifics on how everything works – you have two deployment options, a free deployment or an elastic deployment.

For the purposes of this post, I’ll use a free deployment.

You deploy your application to Orchestra by connecting a repo on GitHub with your Orchestra account – Simply set up a GitHub repo for your app, just as you would for a normal project. You’ll then use information about this repo to set things up in Orchestra.

When you tell Orchestra where your GitHub repo is, it will deploy your app and give you a public URL that you can use to access it.

Setting up a Tropo Application

Now that our application is deployed to Orchestra, we need to set up a phone number to use it in Tropo. Like all of the steps described above, this one is simple.

Log into your Tropo account and create a new application – when prompted select WebAPI. The URL that powers your application is the public URL provided by Orchestra when you deploy your application.

Since we’re using Limonade, we need to add a query string parameter for our starting route.

In our application, our starting route looks like this:

dispatch_post('start', 'tropoStart');
function tropoStart() {
...
}

So to access this route from Tropo, we would set up our app URL like this.

http://my-app-name.orchestra.io/index.php?uri=start

When you do this, you’ll be able to call the application and hear it work. Here is a quick screencast demonstrating how the app works.

One of the things I really like about Orchestra is that it uses a standard GitHub repo for deployment. Similar services for other languages often require you to set up a special stand alone repo for deployment, and for me this just always feels like an extra step I have to go through to deploy my app.

I love that I can push changes to GitHub and they are deployed by Orchestra. Quick and easy!

Orchestra has a number of add ons planned (i.e., for CouchDB and MongoDB) so it’s only going to get more awesome.

So if you want a fast, easy way to build powerful multi-channel communication apps in PHP, Tropo and Orchestra make a powerful combination.

Leave a Reply