Archive for May, 2011

Hello, Python World (Django Edition)

Sunday, May 29th, 2011

I’ve been doing my Python Tropo development on top of Google App Engine, for the past couple of years. Out of the box, App Engine uses the webapp framework. But for my current “Hello, World” project, I decided to leave my App Engine comfort zone, and gain a different perspective. I took up the task of writing a “Hello, World”, Tropo Web API app, using the Django framework for Python.

(more…)

Controlling your Browser with your Phone and Grails

Monday, May 23rd, 2011

I’ve called this blog post ‘Controlling your Browser with your Phone and Grails’ but I perfectly could have named it ‘Building Publish / Subscribe Apps with Tropo and Redis Revisited’ as what I’m going to show you here is basically a remake of Mark Headd’s super-awesome blog post from April 4th that showed how you could create voice-powered publish-subscribe applications using Redis and Tropo.

In Mark’s example you learnt how to create an application that was able to react to your orders from your telephone switching the color of your browser. I thought it was super-cool, and I also thought that it would be very cool to recreate the same example but using WebApi and Grails instead of Tropo Scripting.

The architecture of this project is very similar to Mark’s architecture. You can check it out here. The main differences are basically that my application is based in the WebApi model and that it uses Cometd to communicate from the server to the browser. I’ve uploaded a screencast to YouTube that explains the source code and that shows the application in action:

The source code for this sample project is available at Github. I hope you like it!

ASR-as-a-Service

Saturday, May 21st, 2011

Automated Speech Recognition (ASR) as-a-Service can be powered via Tropo and SIP using this simple open source code provided below.  This service is perfect for adding speech recognition to your existing Asterisk, FreeSwitch, YATE, or enterprise app from the stone ages.

Here’s how it works!

You can transfer a phone call via SIP from a platform that doesn’t support ASR to Tropo along with the following SIP headers: prompt, choices, and returnaddress (SIP address). Tropo automatically answers the call and prompts the user the the text-to-speech (TTS) prompt passed. It automatically loads the ASR grammar with the choices passed. Upon successfully processing the speech recognition, Tropo transfers the call and the recognized result back to the return SIP adrress along with an x-voxeo-result SIP header containing your keyword spoken by the user.

Here’s the Tropo code using our hosted Scripting API:

This code is written in Ruby using our Tropo Scripting API.  You can use $currentCall.getHeader to get the SIP headers passed to your Tropo application and you can send headers to other SIP applications using the Tropo transfer method.  The speech recognition magic happens in the Ask method.

recoresult = ask $currentCall.getHeader("x-sbc-prompt"), {
   :choices => $currentCall.getHeader("x-sbc-choices")}

transfer $currentCall.getHeader("x-sbc-returnaddress"), {
    :headers => {'x-voxeo-result' => recoresult.value}
    }

Here’s how we tested it.

We used Phono, our browser-based webphone, to call Tropo and pass the prompt, choices, and returnaddress parameters.

phono.phone.dial("sip:9996106030@sip.tropo.com", {
  	headers: [
	{
		name:"returnaddress",
		value: "sip:9996106032@sip.tropo.com" // you could use returnaddress var to send the results back to Phono's SIP address
	},
	{
		name:"prompt",
		value: "What is your favorite color?"
	},
	{
		name:"choices",
		value: "blue,green,red,yellow"
	}
	],

Just to prove that yet another SIP application could receive the speech recognition results, we created another Tropo application in Ruby using the Scripting API to simple say the results.

say "You said " + $currentCall.getHeader("x-voxeo-result")

This second test application would typically be omitted for a real application since the returnaddress would most likely be the originating SIP address of your switch to return to your original callflow.  It’s cool that you could transfer to yet another application for additional processing!

What’s Next?

You can clone or fork this open source project on Github and use it today for as little as $.03 per minute for the Tropo call.  Let us know if you would prefer for us to build this service out for commercial use.

 

Open Gov West Apps Contest Winners – From Tsunami Evacuation to the Library of Congress

Tuesday, May 17th, 2011

Over the weekend about two dozen developers gathered at the Jupiter Hotel in Portland OR for the Open Government West Apps Contest.  The Cross-Gov Apps Contest represented one of the first efforts to get government data providers from Canada and the US to share data and expertise through one apps competition event. The goal is to see apps developed that utilize two or more government’s data, or scale across at least two governments.

Tropo was proud to sponsor this event with our friends at Socrata.

Max Ogden, Brian Rice and Randall Leeds teamed up to take the Grand Prize with a 211 social services application that enables any city/government or organization to make information about city services more accessible.  Other winners included a Washington State Ballot Box finder (powered by Tropo), Tsnuami Evacuation Route finder (powered by Socrata) and an app that makes it easier to search for contextually relevant legislation using data from Library of Congress.   Congrats to all of our winning teams…you guys truly rock!

Big thanks to Sarah Schacht, of Knowledge as Power, the driving powerhouse behind Open Gov West, Chris Metcalf and our data API allies at Socrata who helped sponsor the event, Dugan Petty (State of Oregon CIO), Pascal Schubach of Crisis Commons, and the rest of our judges for helping make this event a grand success!

There was much discussion during Open Gov West 2011 about the value of apps contests and hackathons.  Much of the discussion was driven by Willow Brugh, director of Geeks without Bounds and Amber Case, co-founder of Geoloqi whose keynote focused on unlocking the value of these types of competitions and how to make them more sustainable and valuable.   More about that later :-)

You can check out my Picasa Gallery of photos from Open Gov West

Extending GoogeVoice with Tropo

Friday, May 13th, 2011

We are always excited to see developers using Tropo to extend GoogleVoice functionality and features by adding things like SIP and Call Forwarding and Call-In enhancements.  Terry Swanson (@FunnyBoy243) is one of these cool developers who wrote 2 of these extensions and opensourced them for others to share and contribute:

His Call Forwarding Extender Tropo Script includes the following features that extend/add to the current Google Voice feature-set:

  1. Easy forwarding to SIP Numbers (especially compared to IPKall)
  2. Outbound call recoding
  3. Allows forwarding to numbers that cannot be verified through Google Voice (such as numbers with extensions).  You can append “postd=DIGITSp” and/or “pause=WAITTIMEms” in the CALL_DEST variable to allow the script to forward to your extension. For example, “+14155551212;postd=ppppp1234pp56″ would dial (415) 555-1212 wait 5 seconds (1 second for each p) dial 1 2 3 4, wait 2 seconds then dial 5 6. Look enter the Parameters section of the Tropo API for more information.

You can have this script call multiple SIP/Telephone numbers at the same time by using an array for the CALL_DEST variable. All numbers will ring and the first to answer the call will take the call.

Example: $CALL_DEST = array(“sip:2233486745@sip2sip.info”, “sip:2233486712@sip2sip.info”);

For step by step instructions, check out Terry’s original post here.

His Google Voice Call In Extender Tropo Script includes the following features that extend/add to the current Google Voice feature-set:

  1. SIP Address for your Google Voice number.
  2. Skype number for your Google Voice number.
  3. Phone Number Aliases for your Google Voice number – You can have multiple phone numbers from different areas forward to the same Google Voice number so they wont have to pay long distance fees to call your Google Voice number.

Here are some additional tips and tricks with this extension:

  1. You can have this script call multiple Google Voice numbers at the same time by using an array for the GV_NUM variable. All numbers will ring and the first to answer the call will take the call. Example: $GV_NUM = array(“5103364032″, “5103364002″);
  2. You can add International Phone numbers to allow people from other countries to call your Google Voice number without paying International rates.
  3. You can use the Skype number to make free telephone calls using Google Voice.

For step by step instructions, check out Terry’s original post here.

Hats off to you, Terry!  Keep up the good work!

Hack and win with Tropo at php|tek

Friday, May 13th, 2011

It’s ironic that most developer conferences are nothing but speakers. It’s like developers spend all year avoiding meetings so they can come to one event and do nothing but sit in meetings for a few days.

I don’t know about you, but I like my developer conferences to include a little developing.

At php|tek in Chicago May 24-27, Tropo is hosting a developer contest and a hackathon on Thursday night. We want to help you take all the ideas you’re learning at the conference and put them into practice building something useful. We’re starting the hackathon right after all the sessions are over, so you won’t even need to miss your favorite speaker.

In addition to Tropo, a large number of other projects will be at the hackathon to help you get started with their stuff. CouchDB, Frapi, Gowalla, JoindIn, Node.js, Phergie, PEAR, PHP Core QA, Spaz, web2project, Windows Azure, and Zend Framework will all be represented, in many cases by the project creators and leads. You don’t need to hack on one of these projects, of course, but we’ll all be there to help and answer questions if you want to.

“But I was going to go grab dinner and a drink!” you might say. Well, hey, we’ll have food and drink there, too. “I was going to hang out with my friends!” They’re all going to be there. “I need to go shoe shopping.” Uhhh, you’re on your own there. See you when you get back.

In addition to the Thursday hack event, Tropo’s putting on a contest. Build an application using Tropo and PHP, and win fabulous prizes. You can work on it at the hackathon or on your own time.

The developer contest runs all through the conference. Heck, start today if you want. Tropo’s communications APIs are free for development use and have native PHP support, so there’s no reason not to enter. Entries are due Friday at 9am and a panel of your brilliant peers will be judging you, or at least your application, to pick a winner to announce at the closing keynote.

The Official Rules for this contest can be found on the Tropo site. The highlights are…

  • Contest open to residents of the 50 United States and DC 13 or older
  • Eligible entries must use Tropo and PHP
  • Contest runs from May 12, 2011 12:00am Central time to May 27, 2011 9am Central time
  • Prizes are an Apple iPad for first place, second place gets a Parrot.AR Drone quadricopter, and third place wins an Amazon Kindle.
  • Entries will be judged according to the Extent of Tropo Features Utilized, End User Experience, and Perceived Commercial Viability
  • To enter, complete the entry form at http://bit.ly/TropoTek11

In case that’s not enough Tropo-powered goodness for you, I’ll be giving two different talks at php|tek. Wednesday at 3pm, I’ll be showing how you can use Drupal as an Application Development Platform. The next day, Thursday at 4pm, come hear why you should be adding Voice, IM, and SMS to your web applications and how to do it with Tropo, Phono, and a variety of open source tools and open standards.

We look forward to seeing you at tek! Bring your questions, your code, and your laptop. We’ll take care of everything else.

Building Cross Gov Solutions at OGW 2011

Thursday, May 12th, 2011

“The west is the best…” – Jim Morrison

Tropo is proud to be a sponsor of OpenGov West 2011, an event that brings together open gov supporters and practitioners from the U.S and Canada to explore innovative ways of addressing the challenges facing governments.

At this years’ event, we’re sponsoring a one day codeathon to build “cross government” applications. Cross government applications are solutions that use data from multiple government data sources, or that can be reused by multiple governments facing similar challenges.

Governments face many challenges in addressing their public service responsibilities, and are increasingly being asked to do more with less. Technology can help governments provide better service, and open government leaders see collaboration as an important ingredient to technical innovation.

That’s the idea behind the cross government codeathon that will take place at OGW 2011 – governments across the country and around the world face many of the same challenges, and by working together new solutions to old problems can be identified.

If you are a developer and want to participate in this event, there are free tickets available – get them while they are still available!

Prizes and winners of the event will be announced at the end of the day. We look forward to seeing you there.

Announcing New lower SMS pricing

Wednesday, May 11th, 2011

Ever since Tropo became the first phone API to SMS enable existing voice phone numbers, we’ve been signing up SMS developers at a breakneck pace. When asked what you love about Tropo, you said the ease of use, unbelievable support, and our low pricing are the biggest reasons you use Tropo’s text messaging API to build applications.

Now you’ll love Tropo even more. Starting immediately, we’re cutting the price of US SMS services in half. When using a Tropo US number or shortcode and sending to a US number, you’ll only pay one cent per message. Incoming messages to your US Tropo numbers or shortcodes are also 1 cent each. Text messages sent to outside the US are 2 cents per message, regardless of the destination. No minimums, no commitments…and as always, development usage is completely free.

Because of you, we’re sending a huge volume of SMS each month. With volume comes cost savings, and we’re passing those savings on to you. This new pricing is effective immediately – there’s nothing you need to do to take advantage of it.

Using Tropo for SMS

Haven’t used Tropo’s SMS API before? It couldn’t be easier. The same API that you’re using for voice applications works with SMS, too.

Sending a message can be just like making a phone call:

<?php
call('+14155551212', array('network' => 'SMS'));
say('d00d, Penny SMS? ');
?>

You can also use the message function as a shortcut. This is especially useful if you want to send a message while you’re on a phone call. An example in Ruby:

message "txting is ez!" {:to => "+14155551212", :network => "SMS"}

Our documentation has examples in a number of languages for sending SMS and receiving incoming messages for your coding pleasure.

Shortcodes

Are you sending a large volume of text messages? Have needs that fall outside the acceptable use of SMS from a regular phone number? Tropo offers dedicated shortcodes for US or Canada – they’re available today and have the same low pricing as our phone numbers.

To get a shortcode, contact Tropo support.

Getting started

Getting started with SMS is easy. Just add a US phone number to your application, and start sending and receiving text messages. Don’t have a Tropo account? Our APIs are open to anyone to try for free.

Need help? Support is available 24×7.

Sending outbound SMS with Java

Friday, May 6th, 2011

Tropo’s Java API allows you to send SMS messages from your Java applications with little or no effort. In this blog post I’ll go through a very simple application that sends an SMS message with very few lines of code.

To make it a little bit more exciting I will use Quartz‘s latest version. If you are not familiar with it, Quartz is a task scheduler library that you can use in Java to schedule and execute tasks. It is a very powerful library that has tons of different configuration options and integrates quite well with different application servers. Java veterans know it very well as it has been there almost from the very beginning. As Quartz was releasing a major upgrade this March, I decided to test how it works. I also thought that delivering scheduled messages would be a great real-life example of how Tropo can be useful for you. Imagine for example you can use to do SMS broadcasting, send advertisements, send alerts on health monitoring applications and many more exciting use cases.

So let’s start. The first step is to create your application. If you are familiar with Tropo’s WebApi model and in particular with the Java library ( if not, you can have a look to this introductory screencast ) you may expect that we would create a WebApi based application. But this is not the case. We are going to take advantage of Tropo’s Java API REST implementation to make it super-easy to send SMS messages. What we are going to do is to create a script in Tropo that will send the SMS message, get a session token, and invoke that tropo script from our Java application using the session token. So, let’s go. The first step is to create a Scripting based application:

Next, give it a name, like for example QuartzTest and click on the “use a Hosted File” link and next click on the “Create a new hosted file for this application” option, like is shown in the screenshot below:

Ok, we are almost there. Now you need to enter the script contents. This script will send the actual SMS outbound message. I will use the message function and pass the message text and the phone number as parameters. At the docs section you will find plenty of information about all the functions and cool actions you can execute from Tropo scripts. As you can see in the screenshot below, our script is super simple:

Ok, so once you have created your application the last step you need to do is to get your Session API token. We will use that token from Java to run the script that we just have created. So, to get access to your token you only need to go to your application screen and click on the Voice link (message token is also valid) at the bottom of your application. A new window will pop up showing your token information:

And that is it. Let’s go now to the Java world. I’ve created a very simple Java project that uses Quartz and invokes our new and shiny tropo script. I’ve uploaded this project to Github. You can find the source code on this link. Feel free to browse the project sources. As you will see, we are using Tropo’s Java Webapi binary libraries that you can find here. And there is just only two classes. One is the scheduler that creates a quartz job and sends it (I wont go into this code, as it is just some Quartz specific stuff). And the second class is the actual job that sends the SMS message using Tropo. Lets have a look to that class:

public class LongJob implements Job {

	@Override
	public void execute(JobExecutionContext arg0) throws JobExecutionException {

		try {
			// This coude launches your Tropo application. You can configure your tropo application to 
			// do things like sending an SMS, calliing a phone, etc. 
			String token = "f46f1f14bdd7684d9195ad83e1bbce021d0f024ad5e56e8c99cbd10e9cf3b2b026cb68749b41cb487dd09a5d";
			Tropo tropo = new Tropo();
			Map<String, String> params = new HashMap<String, String>();
			params.put("message","This is an SMS message");
			params.put("numberToDial", "+34637710708");
			tropo.launchSession(token, params);		

		} catch (InterruptedException e) {
			e.printStackTrace();
		}		
	}
}

That is all the code you need to send an SMS message from Java. Isn’t it cool? Lets go through the different parts of that snipped:

  1. First we create a new Tropo instance. The Tropo class drives all the interactions with the Tropo cloud.
  2. Next, we build a set of parameters. If you remember our script, we need to pass the message and the number that we are sending the message to. All the keys that you put on that params map will be accessible from your script.
  3. And finally we launch the session using the launchSession method. That method will use our token to launch remotely the Tropo script that we created previously. The script will fetch the parameters from the map and will send the SMS message.

Feel free to download and run the example. One word of caution though. Tropo supports international SMS delivery which is very cool. But it could happen that your country could have not been enabled yet. So, if you find that the SMS messages aren’t getting into your phone then let us know about it because we would have to enable SMS delivery to that country through one of our multiple carrier agreements.

And that is it. Hope you have fun with Tropo and Java!

Tropo joins Google, Microsoft, Yahoo!, NASA & The World Bank for Random Hacks of Kindness

Friday, May 6th, 2011

Tropo is joining Google, Microsoft, Yahoo!, The World Bank and NASA at the Random Hacks of Kindness Hackathon (RHoK #3) on June 3-5 in Seattle and Philadelphia!   Seattle is going to be the ONLY main stage RHoK event in the United States, and we’re proud to be sponsoring the event and reception with our friends at Geeks without Bounds.

What is RHoK #3?

RHok #3 is global gathering of coders, hackers & geeks in many locations around the world, coming together in real time for a marathon weekend of coding around problems relating to disaster/crisis response and climate change.  The RHok #3 event will be happening worldwide on June 4th and 5th, 2011.

What is Random Hacks of Kindness?

Random Hacks of Kindness is the brainchild of a dedicated team from Google, Microsoft, Yahoo!, NASA and The World Bank.  The very first Crisis Camp bar camp was held in Washington, D.C. in June 2009. During one of the opening sessions of the camp an industry panel spoke, and clearly stated that some issues of global importance take precedence over competitive business concerns. That panel included representatives from Google, Yahoo! and Microsoft who agreed to work together to mobilize their developer communities to hack for humanity: to develop code that responds to global challenges and has a real impact in the field. NASA and The World Bank joined forces with Google, Yahoo! and Microsoft to make it happen.

Get Involved

Tropo has joined Geeks without Bounds to organize the RHoK #3 Hackathon in Seattle  June 3-5.  Registration is already open for these and other locations around the world.  There will be free food, WiFi, ideas, prizes and fun.  It’s a great opportunity to use your coding skills to help solve some of the world’s most challenging problems so sign up and join us!

Who Should Attend? Leaders and members of existing groups of coders, makers, hackers, filmmakers, designers, digital medians, engineers, entrepreneurs…anyone with a passion for doing things and wants to work with other like-minded people.