Back in March of 2008, Yahoo held a programming competition here at GA Tech, with the idea being that you take some web services (preferably Yahoo services) and mash them up to make something cool. Dubbed “HackU", the idea was to hack something together in a week; it didn’t have to be pretty, but it should do something different, novel, or useful.

I had at this point been working with the open-source VoIP PBX Asterisk with my roommate, so I figured I’d do something relating to VoIP. The question is what could I make that was both cool and impressive, but also was useful on a phone?

As a frequenter of SlickDeals, I’m always looking for a good deal. I had heard at one point of a system that would let you take a picture of a UPC code and send it to a web service, which would then process the image, pull the product pricing, and text message it back to you. While it seems like a cool concept, I had never seen a working version, plus the overhead of having to have a MMS and SMS plan and a decent camera-phone would seem to me to alienate a lot of potential users. What if you could simply call a phone number, enter in the UPC code as a series of numbers, and then hear the results? Seemed like a good idea, both useful and packing a fair amount of “wow factor”.

Step 1: Getting the Pricing Data

I wanted to use a Yahoo service to pull the pricing data, seeing as it was a Yahoo competition, however the Yahoo Shopping web services are not very comprehensive, and wouldn’t let me look up a product by UPC code, so I had to scrap that idea. I also looked into Shopping.com, PriceGrabber, and others, but none offered a developer API, and scraping proved to be rather difficult, as the pages often had different formats based on the number of products matching a query.

It turns out that Google Product Search pulls its data from Google Base, which does have a powerful developer API. In fact, I found I could look up a product by UPC and get back quite a lot of results. I could then filter the results by the UPC field to make sure that they actually were the right product, and then clear out results from eBay and any used condition results.

I implemented a quick-and-dirty service in C# using Linq-to-XML, which takes a UPC string and returns a list of results. I then calculated the minimum, maximum, and average prices. I also wanted to return some information about the product itself for the user, so I compared all the returned product names, categories,a nd manufacturers, and took the most common of each set (because different stores describe the same product differently). I also get product ratings from the Amazon Associates web service.

Step 2: Handling the Phone Calls

I had at this point some experience with the Asterisk VoIP PBX system, but I quickly found that it was pretty much impossible to make an interactive phone service using the built in dialplan system. Luckily I found Adhearsion, a Ruby interface to Asterisk’s AGI interface, allowing me to program Asterisk using the Ruby programming language. Using Ruby, I queried the ASP.NET web service I had created to get the product data.

In the end, the servers were a little complicated, but that’s all in the spirit of hacking something together, right? ;)

Winning

In the end, it turned out really well, and I won first place at the competition. Take a look for yourself at DialPrice.com.