Home » Incredible PBX » Siriously: It’s Wolfram Alpha for XiVO and Wazo

The Most Versatile VoIP Provider: FREE PORTING

Siriously: It’s Wolfram Alpha for XiVO and Wazo

Ever wished your Asterisk® server could harness the power of a 10,000 CPU Supercomputer to answer virtually any question you can dream up about the world we live in? Well, so long as it’s for non-commercial use, today’s your lucky day. Apple demonstrated with Siri™ just how amazing this technology could be by coupling Wolfram Alpha® to a speech-to-text engine on the iPhone about 5 years ago. And, thanks to Google’s new speech transcription engine and Wolfram Alpha’s API, you can do much the same thing with any Asterisk server. Today, we’ll walk you through the 5-minute setup with XiVO or Wazo.

Five years ago, we had such a good name for this project, Iris, which is Siri spelled backwards. You know the backwards sister and all of that. At last count, there now are about two dozen Iris apps for Android phones so we give up. Instead we give you 4747. You can figure it out from there.

When people ask what exactly Wolfram Alpha is, our favorite answer was provided by Ed Borasky: "It’s an almanac driven by a supercomputer."

That’s an understatement. It’s a bit like calling Google Search a topic index. Unlike Google which provides links to web sites that can provide answers to queries, Wolfram Alpha provides specific and detailed answers to almost any question. Here are a few examples (with descriptions of the functionality) to help you wrap your head around the breadth of information. For a complete list of what’s available, visit Wolfram Alpha’s Examples by Topic. Type a sample query here or use the examples below with your phone once you complete the install today.

Weather in Charleston South Carolina
Weather forecast for Washington D.C.
Next solar eclipse
Otis Redding
Define politician
Who won the 1969 Superbowl? (Broadway Joe)
What planes are now flying overhead? (flying over your server’s location)
Ham and cheese sandwich (nutritional information)
Holidays 2017 (summary of all holidays for 2012 with dates and DOW)
Medical University of South Carolina (history of MUSC)
Star Trek (show history, air dates, number of episodes, and more)
Apollo 11 (everything you ever wanted to know)
Cheapest Toaster (brand and price)
Battle of Gettysburg (sad day 🙂 )
Daylight Savings Time 2017 (date ranges and how to set your clocks)
Tablets by Motorola (pricing, models, and specs from Best Buy)
Doughnut (you don’t wanna know)
Snickers bar (ditto)
Weather (local weather at your server’s location)

Best Question of the Day Award: "How much wood could a woodchuck chuck if a woodchuck could chuck wood?" And the answer: "A woodchuck would chuck all the wood he could chuck if a woodchuck could chuck wood. According to the tongue twister, although the paper ‘The Ability of Woodchucks to Chuck Cellulose Fibers’ by P.A. Paskevich and T.B. Shea in Annals of Improbable Research vol. 1, no. 4, pp. 4-9, July/August 1995, concluded that a woodchuck can chuck 361.9237001 cubic centimeters of wood per day."

Implementation Overview. Today what we’re going to demonstrate is how to configure your Asterisk® server so that you can pick up any phone on your system, dial 4-7-4-7 and ask a question. Then we’ll send your question to Google to convert the spoken words into text. Next, we’ll pass Google’s text translation along to Wolfram Alpha which will provide a plain text answer to your question. Finally, we’ll take that plain text response and use the Flite TTS engine to deliver the results to you over the phone.

Prerequisites. For openers, you’ll need two things: a speech recognition key from Google and a free Wolfram Alpha account. We’ll be using Incredible PBX™ for XiVO and Wazo to demonstrate the setup because almost all the pieces are in place to make this easy. It’s certainly possible to do what we’re demonstrating on other Asterisk server platforms once you get all of the dependencies resolved. But we’ll leave that for the do-it-yourselvers.

Legal Disclaimer. What we’re demonstrating today is how to use two publicly accessible web resources to harness the power of a supercomputer to respond to your queries using a phone connected to an Asterisk server. We’re assuming that both Google and Wolfram Alpha have their legal bases covered and have a right to provide the public services they are offering. We are not vouching for them or the services they are offering in any way. By using our scripts, YOU AGREE TO ASSUME ALL RISKS, LEGAL AND OTHERWISE, ASSOCIATED WITH USE OF THESE FREELY ACCESSIBLE WEB TOOLS. NO WARRANTY EXPRESS OR IMPLIED IS BEING PROVIDED BY US INCLUDING ANY IMPLIED WARRANTY OF FITNESS FOR USE OR MERCHANTABILITY. You, of course, have an absolute right not to use our code if you have reservations of any kind or are unwilling to assume all risks associated with such use. Sorry for the legalese, but it’s the time in which we live I’m afraid. Plain English: "Don’t Shoot the Messenger!"

Configuring XiVO/Wazo for Voice Recognition. As we noted, all of the pieces already are in place on the Incredible PBX for XiVO/Wazo platform to support voice recognition. All you’ll need to do is obtain a key from Google and plug it into the existing voice recognition script that’s already in place. If you haven’t already done this, start here.

Getting a Wolfram Alpha Account. As you can imagine, there have to be some rules when you’re using someone else’s supercomputer for free. So here’s the deal. It’s free for non-commercial, personal use once you sign up for an account. But you’re limited to 2,000 queries a month which works out to almost 70 queries a day. Every query requires your personal application ID, and that’s how Wolfram Alpha keeps track of your queries. Considering the price, we think you’ll find the query limitation pretty generous compared to other web resources.

Sign up for a free Wolfram Alpha API account here. Just provide your email address and set up a password. It takes less than a minute. Log into your account and click on Get An App ID. Make up a name for your application and write down (and keep secret) your APP-ID code. That’s all there is to getting set up with Wolfram Alpha. If you want to explore costs for commercial use, there are links to let you get more information.

Installing Wolfram Alpha Application. Here are the steps to use the one-click installer. Log into your XiVO or Wazo server as root and issue the following commands. Plug in your Wolfram Alpha APP-ID when prompted.

cd /
wget http://incrediblepbx.com/setup-wolfram-wazo.tar.gz
tar zxvf setup-wolfram-wazo.tar.gz
rm -f setup-wolfram-wazo.tar.gz
cd /root
./setup-wolfram.sh

Taking Wolfram Alpha for a Spin. Some sample commands have been documented above to get you started. Just pick up a phone on your Wazo server and dial 4747. When prompted, say one of the commands and press the pound key. Your command will be sent to Google for translation, and then the text result will be played back using Flite or Cepstral. If it says what you meant to say, press 1 to launch the Wolfram Alpha connection and get the answer to your question. If not, press * and try again.

You also can watch the progress of your calls on the Asterisk CLI. We’ve found the Google speech-to-text transcription to be extremely accurate in quiet rooms. One of the variables returned in the [4747@from-internal:5] entry on the Asterisk CLI includes a transcription accuracy measurement which is shown as a decimal number less than 1. This gives you an idea of how well Google is understanding your accent. If the number consistently falls below .9, you may want to move out of the Deep South and try again after you lose your accent. 😉

Tweaking the Abbreviations List. Translating abbreviations into speech is a tricky business, and Flite does a pretty lousy job on some of them. We’ve started the beginnings of an abbreviation list which you will find in the function section of 4747.php which is stored in /var/lib/asterisk/agi-bin. It’s easy to add additional entries. Just clone one of the entries that’s already there. For example, here’s the line that translates Jr. into Junior. HINT: Be careful to surround most unpunctuated abbreviations with spaces, or you may get unexpected results when a word actually begins or ends with the same letters.

$response = str_replace("Jr.","junior",$response);

Originally published: Tuesday, December 6, 2016



Need help with Asterisk? Visit the PBX in a Flash Forum.


Coming Soon to Nerd Vittles: The Autonomous Car




 

Special Thanks to Our Generous Sponsors


FULL DISCLOSURE: ClearlyIP, Skyetel, Vitelity, DigitalOcean, Vultr, VoIP.ms, 3CX, Sangoma, TelecomsXchange and VitalPBX have provided financial support to Nerd Vittles and our open source projects through advertising, referral revenue, and/or merchandise. As an Amazon Associate and Best Buy Affiliate, we also earn from qualifying purchases. We’ve chosen these providers not the other way around. Our decisions are based upon their corporate reputation and the quality of their offerings and pricing. Our recommendations regarding technology are reached without regard to financial compensation except in situations in which comparable products at comparable pricing are available from multiple sources. In this limited case, we support our sponsors because our sponsors support us.

BOGO Bonaza: Enjoy state-of-the-art VoIP service with a $10 credit and half-price SIP service on up to $500 of Skyetel trunking with free number porting when you fund your Skyetel account. No limits on number of simultaneous calls. Quadruple data center redundancy. $25 monthly minimum spend required. Tutorial and sign up details are here.

The lynchpin of Incredible PBX 2020 and beyond is ClearlyIP components which bring management of FreePBX modules and SIP phone integration to a level never before available with any other Asterisk distribution. And now you can configure and reconfigure your new Incredible PBX phones from the convenience of the Incredible PBX GUI.

VitalPBX is perhaps the fastest-growing PBX offering based upon Asterisk with an installed presence in more than 100 countries worldwide. VitalPBX has generously provided a customized White Label version of Incredible PBX tailored for use with all Incredible PBX and VitalPBX custom applications. Follow this link for a free test drive!
 

Special Thanks to Vitelity. Vitelity is now Voyant Communications and has halted new registrations for the time being. Our special thanks to Vitelity for their unwavering financial support over many years and to the many Nerd Vittles readers who continue to enjoy the benefits of their service offerings. We will keep everyone posted on further developments.
 



Some Recent Nerd Vittles Articles of Interest…