Archive for the ‘Screencasts’ Category

Telephony Black Magic with Tropo, Node.js and Redis

Tuesday, June 28th, 2011

In a previous post and screencast on this blog, I demonstrated an example application that highlights some of the more unique features of Tropo to support realtime applications.

Tropo’s unique ability to write to, and read from persistent socket connections during the execution of a call sets it apart from other platforms, and creates opportunities to do things that other platforms can only dream of.

In this screencast, I build upon and extend my earlier example using Redis, Node.js and jQuery to allow a user to inject text into a running Tropo session and have it read out over the phone using Text-to-Speech.

Here is an overview of the technical components of this example application (opens in new window).

What I get really excited about in this demo application – the code for which can be found on GitHub – is the ability to send TTS output to multiple subscribers. Redis’ PubSub functionality will send a message published on a channel to all subscribers, so if you have multiple people called in to your app, every one of them will get the message sent from a single publisher.

How cool is that?!?

if you’re building a realtime application that requires voice, SMS or IM functionality, look no further than the Tropo platform.

With Tropo and powerful tools like Redis and Node.js, you can make telephony black magic.

Have fun!

Realtime Conferencing Dashboard with Tropo and Chloe

Wednesday, June 22nd, 2011

In yet another installment on this blog demonstrating how to build realtime applications with Tropo, I walk you through the process of creating a conferencing dashboard with Tropo and the Chloe realtime web server from Mashion.

Chloe is a great open source project that works extremely well with the Tropo platform. With Chloe and some modest Tropo and jQuery code, you can build a sophisticated and powerful conferencing dashboard.

You can get executables for Chloe by visting the Chloe GitHub repo, and you may also download the source and build on your local machine as well.

The sample code that I demonstrate in this screencast is also available on GitHub.

This example demonstrates yet again how ideal Tropo is for building powerful realtime communication applications. Chloe is easy to work with, powerful and open source, making it an excellent compliment to the apps you can build with the Tropo platform.

Check out the Chloe project and stay tuned to this blog for more posts in the future about building realtime apps with Tropo.

Routing GoogleVoice to Tropo and OpenVoice

Wednesday, April 27th, 2011

Do you have a GoogleVoice phone number?  Would you like to route it to your Tropo application?  

You can permanently port your GoogleVoice phone number to your Tropo application by submitting a ticket to our Provisioning team via the GetHelp link in the Tropo portal but I would like to show you how to temporarily route your GoogleVoice number to Tropo.

In this screencast, I use a few unnecessary (but fun) geeky apps like Skype (to place PSTN calls) and Blink (for receiving SIP calls).  I also route my GoogleVoice number to @Zlu’s OpenVoice application.  OpenVoice is an open source GoogleVoice clone that runs on Tropo and also integrates with our Phono webphone!  It’s built using Ruby on Rails and its source code is available on Github at http://github.com/openvoice.  (OpenVoice also has an Android app available so check it out!)

Deploying Tropo Apps with Orchestra.io

Friday, April 22nd, 2011

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.

Voice powered applications with Grails (Screencast)

Wednesday, April 20th, 2011

Grails Logo Hi. In a previous post we announced our new and shiny Grails Webapi library that allows all Grails developers to create voice and SMS powered applications very easily from their Grails applications.

If you go to the plugin’s web page at Grails.org you will find that there is already quite a few documentation out there. But I thought it would be quite useful to publish a screencast showing step by step how to create applications. This can be very interesting specially for developers that are not used to the Grails platform.

So here it is. It is a very short 15 minutes video in which I’ll show you how quick and easy you can create voice applications in Grails. I really hope you like it.

Tropo-Powered Hamradio Callsign Lookup App

Wednesday, April 6th, 2011

Ham radio or amateur radio communications has been around since the early 1900s.  Ham radio technology has kept pace with traditional communications and may even be the only technology that allows people to communicate in natural disasters.  Ham radio operators can communicate over very far distances using HF (high frequencies) as well as through satellites via AMSAT and even using VoIP over the Internet using EchoLink, IRLP, or D-STAR!

There are nearly 750,000 FCC licensed ham radio operators in the United States and over 3M licensed operators worldwide.  Each operator has federally issued callsign that is used to uniquely identify the station operating on the band.

Using Tropo and Callook (Josh Dick’s W1JDD Callsign API), Chris Matthieu (N7ICE) was able quickly develop a speech recognition and text-to-speech based telephony app that is accessible by any of the following channels:

Voice and SMS: 1-480-374-3234

Skype: +990009369991489376

VoIP / SIP: sip:9991489376@sip.tropo.com

Phono: app:9991489376

Upon calling the application, you are asked to spell a callsign using military phonetics:

A – Alfa, B – Bravo, C – Charlie, D – Delta, E – Echo, F – Foxtrot, G – Golf, H – Hotel, I – India, J – Juliet, K – Kilo, L – Lima, M – Mike,  N – November, O – Oscar, P – Papa, Q – Quebec, R – Romeo, S – Sierra, T – Tango, U – Uniform, V – Victor, W – Whiskey, X – X-Ray, Y – Yankee, Z – Zulu

In addition to these commands, you can say restart to start over or stop if your callsign is entered correctly.  Upon saying stop, the Tropo application does a REST-based call to Callook to get a JSON response of the data related to the callsign inquired.  In addition to the communication channels listed above, Chris Matthieu was able to use his handheld hamradio (like the one featured above) to communicate using VHF (very high frequencies) to connect to a repeater nearly 50 miles away on a mountaintop and connect to Tropo via an auto-patch phone line to perform a callsign lookup.  Here is a screencast and source code for the application!

Here is the source code running on Tropo’s Scripting API:

require 'rest_client'
require 'json'

answer
sleep 2
say "welcome to the tropo ham radio call sign lookup application"

callsign = ""
callsigntext = ""

loop do

  result = ask "spell the callsign phonetically. say stop when done or restart to start over", {
      :choices => "alpha, bravo, charlie, delta, echo, foxtrot, golf, hotel, india, juliette, kilo, lima, mike, november, oscar, papa, quebec, romeo, sierra, tango, uniform, victor, whiskey, xray, yankee, zulu, one, two, three, four, five, six, seven, eight, nine, zero, stop, restart"}

  if result.value == "stop"
    break
  elsif result.value == "restart"
    callsign = ""
    callsigntext = ""
  else
    callsigntext = callsigntext + " " + result.value
    say "so far you entered #{callsigntext}"

    letter = case result.value
     when "alpha" then "a"
     when "bravo" then "b"
     when "charlie" then "c"
     when "delta" then "d"
     when "echo" then "e"
     when "foxtrot" then "f"
     when "golf" then "g"
     when "hotel" then "h"
     when "india" then "i"
     when "juliette" then "j"
     when "kilo" then "k"
     when "lima" then "l"
     when "mike" then "m"
     when "november" then "n"
     when "oscar" then "o"
     when "papa" then "p"
     when "quebec" then "q"
     when "romeo" then "r"
     when "sierra" then "s"
     when "tango" then "t"
     when "uniform" then "u"
     when "victor" then "v"
     when "whiskey" then "w"
     when "xray" then "x"
     when "yankee" then "y"
     when "zulu" then "z"
     when "one" then "1"
     when "two" then "2"
     when "three" then "3"
     when "four" then "4"
     when "five" then "5"
     when "six" then "6"
     when "seven" then "7"
     when "eight" then "8"
     when "nine" then "9"
     when "zero" then "0"
    end

    if letter
      callsign = callsign + letter
    end

  end

end

response = RestClient.get 'http://callook.info/' + callsign + '/json'
data = JSON.parse(response)

say callsigntext + "belongs to "
say data["name"]
say "in " + data["address"]["line2"]
say "and holds a " + data["current"]["operClass"] + " license"

Building Publish / Subscribe Apps with Tropo and Redis

Monday, April 4th, 2011

In a number of previous posts on this site, we’ve talked about the unique nature of Tropo to support persistent sockets for real time applications.

With this in mind, I decided to have a play with Redis – one of the more interesting entries in the wide and varied world of NoSQL databases. How exactly Redis fits into this paradigm of using persistent socket connections for real time apps might not be immediately obvious, but when you learn about some of the more interesting properties of Redis, it becomes very clear.

Redis.io has lot of information about Redis, and instructions on how to download and install the software to run it on your local machine.

Redis stores data as key/value pairs, where the value can be a simple string, or one of several more advanced data types.

There are lots of benefits to using Redis for your application, but one of the more interesting features of this NoSQL DB caught my attention immediately – Redis’ ability to act as a publish/subscribe messaging platform.

The following screencast walks through an example that uses Tropo, Redis, Node.js and HTML/jQuery to let a user on a telephone control a web browser.

Here is an overview of the technical components of this example application (opens in new window).

All of the source code for this example can be found on GitHub.

There are a lot more interesting features in Redis, and with services like Redis to Go it’s super easy to get started.

We’ll be doing more experimenting with Redis in the weeks ahead – stay tuned for more cool stuff!

JavaScript Remote Call Center Solution: Part 3

Monday, March 28th, 2011

As promised in a previous post, this entry will conclude a series we started over on the Phono blog discussing an effort to build a remote call center solution in JavaScript.

In the latest post of that series, we used Asterisk (the open source telephony platform) to make a call to a remote agent with a Phono instance open in their browser. Our call was routed to the remote Phono instance courtesy of Node.js and CouchDB.

In the screncast below, I’ll talk about how you can run an Asterisk AGI application with the Tropo platform.

In the JavaScript remote call center solution we’ve been talking about in this series, our Asterisk FastAGI script is written in Node.js.

Regardless of the language or framework used, you can run your AGI solution through Tropo using AGItate.

For detailed instruction on how to set up and use AGItate to run your Asterisk AGI application on the Tropo platform, check out this earlier post.

So, if you are looking to start a remote call center business, or if you want to work on getting a solution in place for your company, there has never been an easier way to get started.

Tropo and Phono coupled with powerful tools like CouchDB, Node,js and Asterisk can form the basis for a sophisticated call center application.

Any one of the components discussed in this series can be run either in your own data center, or hosted remotely in the cloud. The choice of how to deploy and operate a solution of this type is completely up to you.

Make sure you visit the GitHub repository for this solution – fork it, modify it, make it your own.

Drop us a line if we can help, or just send a pull request.

We’re excited to see what developers can do with this powerful combination of technologies!

No More Coworking Lockouts with Tropo and CouchDB

Monday, February 28th, 2011

Has this ever happened to you?

You’re feeling a bit randy so you decide to head over to your local coworking facility or hacker dojo to get some work done. Although it’s a bit of an odd hour, the caffeine is pumping in your veins and you’re raring to code up the next big thing. CloudKnock in action Unfortunately, when you get to your coworking site your realize that the door is locked, and you don’t know who is inside to call or send a message to so they may come and let you in. Bummer!

I’ve create a simple Tropo Scripting application that uses CouchDB that can prevent this from ever happening to you or your coworkers. It’s called CloudKnock. You can get the source code for this application over on GitHub.

The screencast below demonstrates how you can use CloudKnock to get into your coworking site quickly and easily.

Some of the really nice features of CloudKnock:

  • There is no special hardware required to unlock the door at your facility.
  • You don’t need to advertise that you are at your local hacker dojo (and not at home) on a social networking site.
  • Coworking members get notified on the channel they choose to utilize, which makes them more likely to get your message and come let you in. ;-)

I’d love to hear feedback on this application from anyone who ha a chance to test it out.

Happy coworking!

Send a Fax with your Voice!

Monday, February 21st, 2011

Tropo just recently partnered with PamFax to deliver faxing capabilities via an API.  Jason Goecke wrapped their API with a very simple Ruby gem called pamfaxr available at GitHub and installable using a “gem install pamfaxr” from your command line.  Using the PamFaxr Ruby gem, I will demonstrate how to send a simple fax as well as how to build a Tropo Voice to Fax transcription application using our Scripting API!

Getting Started

Before you can start sending faxes, you need to head over to the PamFax site and sign up for a PamFax account. After you fill out and submit the form, you’ll get an email with your login credentials and how to get started.

You also need to install the Ruby gem called pamfaxr on to the system where you are going to run the application that will send the fax. The Ruby gem is available at GitHub and should install simply by typing “gem install pamfaxr” from your command line. You will need to edit the code to have your PamFax username and password.

Sending A Fax From The Command Line

Before we involve Tropo, here is the Ruby/Sinatra code for simply sending a fax from the command line using the PamFaxr gem:

require 'rubygems'
require 'pamfaxr'

# Pass user name and password
pamfaxr = PamFaxr.new :username => 'your_username',
                      :password => 'secret'

# Create a new FaxJob
faxjob = pamfaxr.create_fax_job

# Add the cover sheet
covers = pamfaxr.list_available_covers
pamfaxr.set_cover(covers['Covers']['content'][1]['id'], 'Chris was here 2!')

# Add files
# pamfaxr.add_remote_file('https://s3.amazonaws.com/pamfax-test/R-intro.pdf')
# pamfaxr.add_file('examples/R-intro.pdf')

# Add a recipient
pamfaxr.add_recipient('+14802191300')

# Loop until the fax is ready to send
loop do
  fax_state = pamfaxr.get_state
  break if fax_state['FaxContainer']['state'] == 'ready_to_send'
  sleep 5
end

# Send the fax
pamfaxr.send_fax

Just copy that code into a text file, edit it to have your information in it and then run it with ruby from your command line. In a short bit you should have a fax waiting for you.

Sending Faxes From Tropo

Now for the fun Tropo Voice to Fax application code! The first code snippet is written in Ruby runs on the Tropo cloud. It greets the caller, asks for your fax number, records your voice/fax message and sends the transcription via a callback to the Ruby/Sinatra application that sends the actual fax.  Here’s the Tropo code:

say "Welcome to the Tropo fax demo.", :voice => 'dave'

result = ask "What's your fax number? Please include your country code.", {
   :choices => "[11 DIGITS]", :voice => 'dave'}

record "Please say what you would like for me to fax.", {
    :beep => false,
    :voice => 'dave',
    :maxTIme => 60,
    :silenceTimeout  => 2,
    :transcriptionOutURI => "http://web1.tunnlr.com:11053/transcribe?fax=" + result.value
    }

say "Your voice is being converted to a facsimily!  Go check your fax machine!  Goodbye.", :voice => 'dave'

hangup

Here is the complimentary Ruby/Sinatra code that catches the Tropo transcription callback and sends the fax of the transcription to the number specified in the Tropo script using the PamFaxr gem as demonstrated above. This code needs to be run on a publicly-accessible web server to which Tropo can connect and send the data. You have several options including:

  • Running the code on your own publicly-available webserver
  • Running the code on a hosting service like Heroku
  • Running the code on your local machine and use a service like Tunnlr to make the service available

Once you have the Ruby/Sinatra code below running in one of those locations, you’ll just update the Tropo code above with the correct URL (on line 11).

The code is here:

require "rubygems"
require "sinatra"
require 'json'
require 'pamfaxr'

pamfaxr = PamFaxr.new :username => 'your_username',
                      :password => 'secret'

post "/transcribe" do

  transcript_json = JSON.parse(request.body.read)
  identifier = transcript_json['result']['identifier']
  transcript = transcript_json['result']['transcription']

  # Create a new FaxJob
  faxjob = pamfaxr.create_fax_job

  # Add the cover sheet
  covers = pamfaxr.list_available_covers
  pamfaxr.set_cover(covers['Covers']['content'][1]['id'], transcript)

  # Add a recipient
  pamfaxr.add_recipient('+' + params[:fax])

  # Loop until the fax is ready to send
  loop do
    fax_state = pamfaxr.get_state
    break if fax_state['FaxContainer']['state'] == 'ready_to_send'
    sleep 5
  end

  # Send the fax
  pamfaxr.send_fax

end

Wow, that was fun!  I hope that you enjoyed this demonstration and I hope that you find both our PamFaxr gem and our Tropo Scripting API useful and powerful.