Talking With 007

Your organization has a neat new application but it needs to work with customers who don't have access to mobile clients. Why not voice-enable the application? You could create complex IVR processes using simple Python scripts within Cisco's Tropo cloud API platform. Or maybe you need a way to communicate with on-call staff to handle IT emergencies. You could use Tropo to make and provide basic information in the initial calls. In some situations, text messaging might be a better choice, and Tropo supports SMS, too.

Where does 007, James Bond, come into it? Hang on, we'll get there.

What Is Tropo?
Tropo is a voice and text-message programming framework that supports development in five languages -- Python, JavaScript, PHP, Ruby, and Groovy -- as well as via a Java API. I had the opportunity to work with Tropo while at Cisco Live in July, along with about 100 other participants. One of the things we learned was how to integrate voice functionality within a simple Python application. We created a simple application that accepted a call and allowed us to interact with it.

To help get developers started, Tropo has simple introductions called Quickstarts. Creating the app required very little programming. After a simple registration process to assign a free phone number, we wrote a short script to accept a phone call, say something, then play an MP3 recording. We did do all this in a one-line script:

The How it works page has a similar example.

Source: Flickr

Talking With 007
After returning from Cisco Live, I decided to take a closer look at Tropo and work with some of the scripting features. I wanted to learn more about what was possible, and explore the idea that it would be ideal for handling alerts from network management applications.

I started at the Tropo website, and quickly found the page that documents the different languages and voices. Seeing a U.K. voice as one of the choices, I immediately thought of Sean Connery as James Bond.

A simple process for registering the phone number allowed me to make and receive local calls (there are a number of restrictions, for obvious reasons). It was easy to get 007 to answer the phone. The process for answering the phone and playing a message is built into a single command:

After a few hours learning additional commands and some conversations with the Tropo support team, I had an interactive script that could receive a call and provide a greeting, or that could call out, ask a question, listen for an answer, and play back the answer within a sentence. You'll need to replace the called number and the callerID with valid numbers in the call() function:

if currentCall:

    say("Hello, Mr. Bond is out of the office. Thank you for calling.", {"voice":"Kate"}) sys.exit()

else:

    call("+15555551212;postd=pp", {"voice":"Daniel", "callerID":'15555551212'})
    say("Hello. My name is Bond, James Bond.")
    log("Introduction done")
    result = ask("What is your favorite drink, Martini, Wine, or Vodka?", \ {"choices":"martini, wine, vodka"})
    say("Sam, please get us a " + result.value)
    log("Drink " + result.value) say("Thank you.")
    sys.exit()

I finally had a networking application that amused my wife, a remarkable achievement in the world of boring networking topics.

Beyond Bond
While making a short app to simulate talking to James Bond was fun, I wanted to look into some more serious applications of Tropo, too.

My first thought was a network management application interface that would place calls or send text messages to on-call staff when a major network event occurs. Information about the event easily could be placed in the call to identify the impacted device, interface, or application. The input capability could be used to perform additional actions, such as contacting others, launching an interactive chat room (Cisco likes to demonstrate Spark in combination with Tropo), or starting additional diagnostic processes.

I also can see using it to keep me updated on long-running system jobs for processes like database replication. I could create a script to send a notification when the replication isn't finished in its typical runtime. A Tropo app could report that a job is delayed, and show how much progress it has made, its current rate of progress, and how long it is expected to continue to run. That's much better than having the system send an alert without the basic information to make decisions.

Tropo also supports conference calling, which is why Cisco demonstrates it in conjunction with Spark. When a problem requires a group to troubleshoot, an app could create a Spark room and initiate a conference call with all the required team members. The response time to understanding the problem is much shorter than with other notification methods.

Tropo offers a more complex and powerful Web API as well as the scripting interface shown above, but I didn't experiment with it. I was really interested in how simple the scripting interface was and how it hides a lot of the complexity of getting started with Tropo. I didn't have to find, download, and then import a variety of Python modules from GitHub. That made it easy to produce immediate results.

I did find some limitations in Tropo. I wanted to have 007 first ask me my name, then have him say it back to me. This isn't easily done in Tropo because it involves unconstrained voice-to-text conversion, which isn't currently supported. The choice selection mechanism seems to work well, but may create problems when a large set of choices is required.

I was told that one phone number can support up to 200 incoming concurrent calls while handling outgoing calls. That's what makes the above script work, using the "currentCall" variable to switch between incoming and outgoing processing.

Troubleshooting could be streamlined more. The log file is very detailed, and it is best to download the resulting log file and use a text editor to browse through it. I found that the level of detail sometimes made it difficult to find the error messages.

Tropo is an interesting tool that I'm looking forward to incorporating into some of our business practices.