Archive for the ‘PHP’ Category

Info Balloon: Multi-language Location-based Tropo Mashup

Monday, October 10th, 2011

In this post I’d like to tell you about the latest project I’ve been working on, which is built using the Tropo API. It’s an elaboration of the “Moveable” series of apps, which I have written about previously here. It’s also supercharged with some ideas lifted directly from Telephony Black Magic, originally presented by  Mark Headd.

My app is called Info Balloon, and you can check it out at www.infoballoon.org. You move a hot air balloon avatar around on a Google map, and get access to a number of location-based services. The app also features a text input field I call the “WormHole”, which allows you to jump directly to another location on the U.S. map. It uses an html5 text input element, so it accepts either typed or spoken text. And for added fun, courtesy of Google, it knows how to deal with colloquial names for places, like “This Big Apple” and “The Windy City”.

This app is all about retrieving location-based data. It calls out to a REST-like API I created, on the backend, so it should be readily extensible to more services. Right now, I’ve got it hooked up to:

  • The National Registry of Historic Places (via NRHP database)
  • Tides (via NOAA data)
  • Google Places (via Google Places API)
  • Weather (via Google Weather API)

For services like the tide and the weather, you get the local information applying to the zip code where your Info Balloon is located. For other services, like the National Registry of Historic Places, and Google places, each time you click the “Next” button you get the next entry, in an ever-expanding perimeter.

Another feature, which I’ll have more to say about later, is that you can get the information delivered to you in any one of 10 languages, from French to Chinese.  Thanks to JQuery, whenever you change a parameter, the app immediately responds by displaying in the appropriate language, with the appropriate data from the appropriate service.

But wait, there’s one more thing, and I’ve been saving the best for last.  You dial a special Tropo access number on your phone, and get all the info window data read to you, by a language -appropriate speaker, over the phone, in real time.

This real time spoken output on your personal voice channel is what make this app fun. You can rapidly switch between services, languages, and locations, and the speech output keeps chugging away. It’s all because of the magic of Node.js, Socket.io, Redis, and of course, Tropo.

Here’s the code, in PHP,  that orchestrates the output of this voice data:

say("OK");

$redis->subscribe($cellnumber);
do {
	$response = $redis->getResponse();
	$json = $response[2];
	if($json == "1") {
	   say("Press the Next button to hear the next entry.");
	}
	else {

           $obj = json_decode($json);
           $lang = $obj->{'lang'};
           $message = $obj->{'message'};
	    $array  = array(1 => "english",
	                    2 => "spanish",
			    3 => "french",
			    4 => "german",
			    5 => "polish",
			    6 => "italian",
			    7 => "dutch",
			    8 => "french",
			    9 => "russian",
			    10 => "chinese",
			    11 => "russian",
			    12 => "portuguese");

            if ($lang == "english")
               $speaker = "allison";
            elseif ($lang == "spanish")
               $speaker = "carlos";
            elseif ($lang == "french")
               $speaker = "bernard";
            elseif ($lang == "german")
               $speaker = "stefan";
            elseif ($lang == "polish")
               $speaker = "zosia";
            elseif ($lang == "italian")
               $speaker = "luca";
            elseif ($lang == "dutch")
               $speaker = "willem";
            elseif ($lang == "russian")
               $speaker = "olga";
            elseif ($lang == "chinese")
               $speaker = "linlin";
            elseif ($lang == "portuguese")
               $speaker = "amalia";

             say($message, array("voice" => $speaker));
	}

} while ($message != 'goodbye');

$redis->disconnect();
say("Thanks for listening.");
hangup();

I’m excited about the notion of a personal voice channel, a number you dial up to to listen to your personalized fire hose of data. Here, it’s data about locations you are visiting on a map, but really, it could be anything. It could be a real time translation of an SMS message, or a feed of your favorite news clipping service. There’s lots of potential here which I hope to explore in future posts.

Jailbreaking OpenVBX

Wednesday, September 21st, 2011

Remember when the iPhone was only available on AT&T?   That was true until October 11, 2009 when a young coder named geohot (and friends) released the first iPhone/iPod jailbreak.  Suddenly iPhones weren’t tied to to just AT&T…now you could give AT&T the boot and choose Verizon or T-Mobile as your service provider.  Score!

In the spirit of geohot’s jailbreaking efforts, the rapscallions at Disruptive Technologies took on the the task of “jailbreaking” OpenVBX.

OpenVBX is a web-based open source phone system. It’s essentially a virtual PHP/MySQL PBX  and it’s available for download from GitHub.   Users of OpenVBX can make phone calls, send text messages…all very cool.

The catch is…you’re locked into one service provider: Twilio.  There’s no way to choose to use another cloud telephony provider…until now.

Today we’re pleased to announce a new fork of OpenVBX that adds support for Tropo.  For the first time, users of OpenVBX will have a choice of multiple platforms on which to run it, making it REALLY OpenVBX.

The coders at Disruptive Technologies added full support for the the Tropo API and Phono SIP-based VoIP web phone to the communications layer of the OpenVBX project. Of course, when selecting the Tropo API, users will now get access to all of the more advanced features of the Tropo network: speech recognition and text-to-speech in 24 languages, phone numbers in over 40 countries, international SMS, in/outbound SIP VoIP support, inbound Skype support, multiple phone numbers per callflow script, improved conferencing.

Disruptive Technologies also extended OpenVBX with the VoiceVault API to support Voice Biometrics in password resets. After adding VoiceVault credentials on the API Accounts Tab, the password reset dialog will provide an option to request a phone call to reset your OpenVBX account password.

The OpenVBX fork with Tropo can be found on GitHub.  We have sent the maintainer of the OpenVBX project a pull request to merge these updates into the project. The following features and bugfixes have been added to the OpenVBX package:

  • Fixed a redirect bug. OpenVBX no longer incorrectly redirects users to 404 pages.
  • Fixed bug in Twilio client. 60 seconds after the user has been “inactive”, the client is no longer able to be called for that user. This prevents calling the client if the user has closed their browser. (This also works for the Phono Client)
  • Added support for the Tropo API. You can now add a “Tropo API account” on the system settings page, and from the installer. Either a Tropo or Twilio account is required. Included in the new Tropo API additions are:
    1. Support for Tropo domestic and international phone numbers, on the “numbers” page.
    2. All applets in the “flows” page now support Tropo JSON as well as TwiML. Any number can be assigned any flow – so a tropo number and a twilio number can both be assigned the same flow.
    3. Support for existing Tropo numbers & applications. If the user prefers to set up their numbers initially in Tropo.com, the application will see these numbers and they can be assigned a flow within the application.
    4. Recordings, and Voicemail, as well as outbound dialing with Tropo.
  • Several theme changes. The OpenVBX logo has been modified to include both the Tropo and Twilio logo. If only one of the accounts is active, only that logo will show in the VBX logo – so if a user only has a Twilio account, only the Twilio logo will show, and vice versa. Other minor theme changes:
    1. Several pages in the System Settings tabs have been reworked.  Notibly the API accounts page, which now has each API accounts logos.
    2. Step 3 of the installation has been reworked.
    3. Several Twilio-specific content has been changed to be more ambiguous.
  • Added support for “Phono” browser phone, in addition to the Twilio Client. Any non-Twilio based numbers will use the new Phono browser phone.

This project has since been renamed to TropoVBX. Please refer to the updated blog post and new source code repository on GitHub.

My Voice is My Password. Verify Me.

Tuesday, August 23rd, 2011

I remember watching the movie Sneakers (probably 20 times) and would always rewind the part where they could unlock doors with their voice.

The technology, known as voice print identification or voice bio authorization, was demonstrated by the geek Werner Brandes when he utters the words, “My voice is my password. Verify me”, to gain entry to his high-tech office.

This has always sounded uber, geeky, cool to me and it’s been on my list of hacks to try out on Tropo but it looks like someone beat me to it!

The guys over at Disruptive Technologies recently wrote a blog post about Voice Biometrics with VoiceVault and Tropo!  To simplify using the VoiceVault API, Disruptive Technologies created a PHP library that can be used with Tropo for both the enrollment and the verification of voices prints. The library is available on Github as part of their sample WordPress Plugin.

Their sample WordPress Plugin was developed to show you how voice biometrics can be used in real life. You can add it to any WordPress site to enhance the user Signup and Password Reset functionality with voice biometrics and Tropo!

If you want to checkout how the plugin works, first browse to this Sign Up Page and sign up for an account. You will receive a phone call asking you, a couple of times, to speak a 4 digit code, this is used to enroll your voice. After enrolling your voice you can call+1(818) 533-9824  to receive a new temporary password to login to WordPress. Make sure to call from the phone number you registered when you signed up for the WordPress account!

Image the communications apps that you could build using this technology!  The future is now so what are you waiting for – add voice bio metrics to your apps today using Tropo and VoiceVault thanks to Disruptive Technologies!

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!

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!

Hacking a Better World

Thursday, May 5th, 2011

At Tropo, we like to think that hackers can change the world.

It’s one of the reasons we like to be involved in and support events that let developers improve cities, and make their communities better places to live.

orchestra.io

That’s why we were excited to hear that the good folks over at Orchestra will be holding a “HackForGood” night at their San Francisco offices on Monday May 9th.

We’ll be participating in this event, and are looking forward to helping people build awesome things for their communities.

Orchestra is a PHP deployment platform that provides powerful scaling and management for your PHP applications. Their platform is a great fit for Tropo applications, and we blogged recently about how simple it is to deploy Tropo apps to the Orchestra platform.

If your in San Francisco on May 9th, join us at the Orchestra offices for a fun night of hacking that has the potential to make a real difference.

Hope to see you there.

Empire Avenue Stock Quotes by SMS

Tuesday, April 26th, 2011

Have you heard of EmpireAvenue? According to their website, “Empire Avenue is the Social Media Exchange, where you can buy and sell shares in any social media profile, meet new people, unlock Achievement badges, and earn boatloads of virtual cash by being active and social online! Buy shares in your friends, your followers, people with similar interests, brands you love, celebrities – anyone! All using a virtual currency and all for free!”

Cas Hoefman, a long time telephony geek and friend of Tropo, built an SMS hook into their API!

If you want to see a working sample just send a text message with DISRUPTIVE to (818) 900-2731 to get back our latest stock price or replace DISRUPTIVE with your own Empire Avenue Ticker Symbol to get your own latest stock price!  You can also scan the QR code on the left and we’ll do it for you.

Using Tropo, you can add SMS to virtually API to further extend services to meet your needs.  For more details on Cas’ application including the source code, please visit his blog post!

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.

PHP Hacking in Nashville!

Thursday, April 14th, 2011

Tropo is proud to be a Gold Sponsor of the upcoming PHP Community Conference in Nashville, TN on April 21st and 22nd.

PHP Community Conference

We’re looking forward to meeting some great, inspired PHP developers and helping them build awesome multi-channel communication applications with the Tropo platform. The schedule for the event is packed with great topics and the event promises to be an exciting and rewarding one for people that are passionate about PHP.

As an added bonus, Tropo is partnering with our friends over at the Spaz project to sponsor a PHP Hackathon at the event.

Details of the Hackathon will be announced at the beginning of the conference, and the winners will be announced prior to the closing keynote.

We’ll be awarding some awesome gadgets to the top two projects built during the course of the event that use the Tropo platform.

Here are some specific details about the hackathon that will take place during the conference:

  • The official announcement about the hackathon will be made at the beginning of the conference on April 21st.
  • A “hacking workshop” will be held jointly by members of the Tropo and Spaz teams on the first day of the conference to provide an overview and help generate project ideas.
  • You can build a stand alone application, or integrate Tropo into a larger PHP-based project. For example, build a Tropo module for Drupal or CiviCRM, or a WordPress plugin that uses the Tropo platform.
  • You can build your Tropo app from scratch or use one of the many awesome PHP frameworks for your project.
  • The winners of the hackathon will be announced at the end of the conference, prior to the closing keynote.
  • The top two projects built on or for the Tropo platform will receive a prize.

Mark Headd, Developer Evangelist for Tropo, will be on hand at the conference to assist with the hackathon and to answer developer questions. Be sure to look for him if you have questions or want to participate.

Hope to see you next week in Nashville!

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!