Text-to-Speech Bonanza with Cepstral and Asterisk 1.4

There's almost too much to celebrate today. It's Valentine's Day, of course. You didn't forget, did you? And PBX in a Flash turns 3 months old with well over 1,000 downloads a week under our belt. Wow! Who woulda thunk? Thanks, Joe! Thanks, Tom! Get the latest scoop on our forums.

We're pleased to introduce our first hosting service provider, Aretta Communications, for those that would prefer to run PBX in a Flash in a secure, hosted environment with regular backups. Your hosted service in Atlanta will be one millisecond away from the Internet backbone. You can't do any better! And, we're excited to welcome VoipQ as our new European gateway host and contributor for PBX in a Flash. You now can access and download all of our resources through their 100 megabit connection in The Netherlands: pbxinaflash.nl. And there are two new European domains that link back to our main pbxinaflash.com site as well: pbxinaflash.eu and pbxinaflash.be. Our special thanks to Dillard and VoipQ for their support! We're also delighted to announce VoxZone as our new MidWest host for PBX in a Flash downloads. Thanks, Dinesh! And finally, we want to welcome Ad Hoc Electronics as our third West Coast host for PBX in a Flash downloads. Thanks, Jeremy! We hope you'll keep all of these open source supporters in mind when you're shopping for VoIP services and hardware.

To celebrate today's events, we thought it'd be a perfect time to introduce five newly customized Nerd Vittles applications for PBX in a Flash to take advantage of the Cepstral text-to-speech engine with Allison that we introduced last month. So today we bring you Weather by Airport Code, Weather by Zip Code, Worldwide Weather, NewsClips, and MailCall. The weather apps are self-explanatory. NewsClips reads Yahoo news feeds on any of 10 different news topics, and MailCall reads you your email by phone for one or many POP3 or IMAP email accounts. Now these new applications support both Flite and Cepstral. Once you hear Allison reading the news and your email, you'll never go back to Egor. And we're pleased to announce that we'll have a web interface to Telephone Reminders in a few short weeks. With the new Cepstral technology, you'll be able to generate single or recurring text-to-speech reminders from your web browser with delivery at the dates and times you specify... to any phone in the world. Whoa!! As a birthday bonus for Nerd Vittles readers, you can email Cepstral for a whopping, once-in-a-lifetime 15% discount code to use on your next Cepstral download and purchase.

For those using PBX in a Flash (and why wouldn't you!), all of these new applications are a 15-second install away using the downloadable scripts from the Nerd Vittles script repository. And, of course, there are dozens of additional scripts available from our PBX in a Flash Script Site which is run by Tom King.

First Install Procedure. If you've never installed an application that's on the menu today, make certain that you have first installed Cepstral. Our tutorial is here, and it only takes a few minutes. Then the process is painless with PBX in a Flash. Just log into your server as root and type the following commands... depending upon the application you wish to install. Do NOT use this procedure if you have previously installed the application on your PBX in a Flash server. We'll get to that in a minute. As mentioned, each install takes about 15 seconds. Then take a look at the instructions by clicking on the application link on the Best of Nerd Vittles site.

Weather by Airport Code. After logging into your server as root, type the following commands. Documentation is here.

cd /root
wget http://bestof.nerdvittles.com/applications/weather-airport/weather.pbx
chmod +x weather.pbx
./weather.pbx

Weather by Zip Code. After logging into your server as root, type the following commands. Documentation is here.

cd /root
wget http://bestof.nerdvittles.com/applications/weather-zip/weatherzip.pbx
chmod +x weatherzip.pbx
./weatherzip.pbx

Worldwide Weather. After logging into your server as root, type the following commands. Documentation is here.

cd /root
wget http://bestof.nerdvittles.com/applications/weather-world/weatherworld.pbx
chmod +x weatherworld.pbx
./weatherworld.pbx

NewsClips from Yahoo. After logging into your server as root, type the following commands. Documentation is here.

cd /root
wget http://bestof.nerdvittles.com/applications/newsclips/newsclips.pbx
chmod +x newsclips.pbx
./newsclips.pbx

MailCall for Asterisk®. After logging into your server as root, type the following commands. Documentation is here.

cd /root
wget http://bestof.nerdvittles.com/applications/mailcall/mailcall.pbx
chmod +x mailcall.pbx
./mailcall.pbx

Choosing Flite or Cepstral. As installed, the five applications all rely upon Flite as the default text-to-speech (TTS) engine. If you'd like to change it, here's how. There are two places in which text-to-speech is used for these applications. The first is a little code that is inserted in your dialplan in the /etc/asterisk/extensions_custom.conf file. The second is in the PHP code that does the heavy lifting for each application. You can choose Cepstral as the TTS engine in either or both places for each application. We'll walk you through modifying the Weather by Airport Code application to support Cepstral, but the process is identical for the other applications. The two things you'll need to know to make the changes, are the number to dial for the application, e.g. 611 for Weather by Airport Code, and the name of the PHP file, e.g. nv-weather.php. Here's the info for all five apps just so you don't have to do any hunting:

  • Weather by Airport Code... 611, nv-weather.php
  • Weather by Zip Code... 947, nv-weather-zip.php
  • Worldwide Weather... 612, nv-weather-world.php
  • NewsClips from Yahoo... 511*, nv-news.php (No editing of dialplan 511 code is required)
  • MailCall for Asterisk... 555, nv-mailcall.php

Changing DialPlan Code to Cepstral. Log into your server as root and edit the extensions_custom.conf file in /etc/asterisk: nano -w extensions_custom.conf. Now search for the number to dial from the table above. For example, for Weather by Airport Code, you'd press Ctrl-W, then type 611, then press Enter. You'll be positioned on code that looks like the following:1

exten => 611,1,Answer
exten => 611,2,Wait(1)
exten => 611,3,Set(TIMEOUT(digit)=7)
exten => 611,4,Set(TIMEOUT(response)=10)
exten => 611,5,Flite("At the beep enter the three character ↩
airport code for the weather report you wish to retrieve.")
;exten => 611,5,Swift("At the beep enter the three character ↩
airport code for the weather report you wish to retrieve.")
exten => 611,6,Read(APCODE,beep,3)
exten => 611,7,Flite("Please hold a moment while ↩
we contact the National Weather Service for your report.")
;exten => 611,7,Swift("Please hold a moment while ↩
we contact the National Weather Service for your report.")
exten => 611,8,AGI(nv-weather.php|${APCODE})
exten => 611,9,NoOp(Wave file: ${TMPWAVE})
exten => 611,10,Playback(${TMPWAVE})
exten => 611,11,Hangup

Notice the semicolons at the beginning of the two lines of code. Those indicate comments in the PHP world, and those lines are not executed. You'll note that both of the commented lines include the word Swift which, as you learned from the installation tutorial, activates the Cepstral TTS engine. Immediately under each of those lines is an identical line to activate Flite. So, to swap TTS engines, simply comment out the two Flite lines and uncomment the two Swift lines. When you're finished, your code should look like this:

exten => 611,1,Answer
exten => 611,2,Wait(1)
exten => 611,3,Set(TIMEOUT(digit)=7)
exten => 611,4,Set(TIMEOUT(response)=10)
;exten => 611,5,Flite("At the beep enter the three character ↩
airport code for the weather report you wish to retrieve.")
exten => 611,5,Swift("At the beep enter the three character ↩
airport code for the weather report you wish to retrieve.")
exten => 611,6,Read(APCODE,beep,3)
;exten => 611,7,Flite("Please hold a moment while we ↩
contact the National Weather Service for your report.")
exten => 611,7,Swift("Please hold a moment while we ↩
contact the National Weather Service for your report.")
exten => 611,8,AGI(nv-weather.php|${APCODE})
exten => 611,9,NoOp(Wave file: ${TMPWAVE})
exten => 611,10,Playback(${TMPWAVE})
exten => 611,11,Hangup

Don't change anything else. When your code looks like ours, save your changes by pressing Ctrl-X, then Y, then the Enter key. Reload your Asterisk dialplan to make the changes take effect:

asterisk -rx "dialplan reload"

Changing PHP Application Code to Cepstral. Log into your server as root and issue the following commands using the name of the PHP file for the application you want to change:

cd /var/lib/asterisk/agi-bin
nano -w nv-weather.php

At the top of the file, you'll notice several lines with variables that can be changed.

//-------- DON'T CHANGE ANYTHING ABOVE THIS LINE ----------------

$debug = 1;
$newlogeachdebug = 1;
$emaildebuglog = 0;
$email = "yourname@yourdomain" ;
$ttspick = 0 ;

//-------- DON'T CHANGE ANYTHING BELOW THIS LINE ----------------

To activate the Cepstral TTS engine, just change the value for $ttspick from 0 to 1. Then save your changes: Ctrl-X, Y, then Enter. Now try out your fancy new weather application using Cepstral by dialing 611 from any phone on your PBX in a Flash system.

Upgrading from Previous Installs. If you have already installed one or more of these five Nerd Vittles applications, here's a quick tutorial on how to update your code to the latest and greatest with full Cepstral support. We've already preconfigured the code below to use Cepstral. If you want to use Flite for some of the apps, make the changes following the instructions above. Log into your server as root and issue the following commands:

cd /root
mkdir cepstral
cd cepstral
wget http://nerdvittles.com/wp-content/cepstral.zip
unzip cepstral.zip

For each application that you've already installed, copy the PHP file from /root/cepstral to /var/lib/asterisk/agi-bin and then set the proper ownership of the new files:

cd /root/cepstral
cp nv-mailcall.php /var/lib/asterisk/agi-bin/nv-mailcall.php
cp nv-news.php /var/lib/asterisk/agi-bin/nv-news.php
cp nv-weather.php /var/lib/asterisk/agi-bin/nv-weather.php
cp nv-weather-zip.php /var/lib/asterisk/agi-bin/nv-weather-zip.php
cp nv-weather-world.php /var/lib/asterisk/agi-bin/nv-weather-world.php
cd /var/lib/asterisk/agi-bin
chown asterisk:asterisk nv*.php
chmod 775 nv*.php

Now we need to edit /etc/asterisk/extensions_custom.conf and clean out the old dialplan code for these applications and then replace it with the new dialplan code. First, make a duplicate of the file in case something goes wrong:

cp /etc/asterisk/extensions_custom.conf /etc/asterisk/extensions_custom.conf.bak

Then edit the file: nano -w /etc/asterisk extensions_custom.conf and search (Ctrl-W) for the beginning of each chunk of dialplan code using the phone numbers for the various applications that are shown above in the Choosing Flite or Cepstral section, e.g. 611, 947, 612, 511, and 555. Using Ctrl-K, delete each subsequent line of dialplan code that contains the phone number for that application until you've removed the entire section of code for each application. Then search for the next phone number and repeat the process. Once you've deleted all of the existing code for these five applications, cut-and-paste the following code just below [from-internal-custom] at the top of the file. NOTE: Do NOT paste in a section of the code below if you haven't previously installed that particular application!

; -- Begin New Nerd Vittles Code to Support Cepstral TTS

; Worldwide Weather Forecasts
exten => 612,1,Answer
exten => 612,2,Wait(1)
exten => 612,3,Set(TIMEOUT(digit)=7)
exten => 612,4,Set(TIMEOUT(response)=10)
;exten => 612,5,Flite("At the beep enter the code for the weather report you wish to retrieve.")
exten => 612,5,Swift("At the beep enter the code for the weather report you wish to retrieve.")
exten => 612,6,Read(APCODE,beep,1)
;exten => 612,7,Flite("Please hold a moment while we retrieve your report.")
exten => 612,7,Swift("Please hold a moment while we retrieve your report.")
exten => 612,8,AGI(nv-weather-world.php|${APCODE})
exten => 612,9,NoOp(Wave file: ${TMPWAVE})
exten => 612,10,Playback(${TMPWAVE})
exten => 612,11,Hangup

; Weather by Zip Code
exten => 947,1,Answer
exten => 947,2,Wait(1)
exten => 947,3,Set(TIMEOUT(digit)=7)
exten => 947,4,Set(TIMEOUT(response)=10)
;exten => 947,5,Flite("At the beep enter the five digit code for the weather report you wish to retrieve.")
exten => 947,5,Swift("At the beep enter the five digit code for the weather report you wish to retrieve.")
exten => 947,6,Read(ZIPCODE,beep,5)
;exten => 947,7,Flite("Please hold a moment while we contact the National Weather Service for your report.")
exten => 947,7,Swift("Please hold a moment while we contact the National Weather Service for your report.")
exten => 947,8,AGI(nv-weather-zip.php|${ZIPCODE})
exten => 947,9,NoOp(Wave file: ${TMPWAVE})
exten => 947,10,Playback(${TMPWAVE})
exten => 947,11,Hangup

; Weather by Airport Code
exten => 611,1,Answer
exten => 611,2,Wait(1)
exten => 611,3,Set(TIMEOUT(digit)=7)
exten => 611,4,Set(TIMEOUT(response)=10)
;exten => 611,5,Flite("At the beep enter the three character airport code for the weather report you wish to retrieve.")
exten => 611,5,Swift("At the beep enter the three character airport code for the weather report you wish to retrieve.")
exten => 611,6,Read(APCODE,beep,3)
;exten => 611,7,Flite("Please hold a moment while we contact the National Weather Service for your report.")
exten => 611,7,Swift("Please hold a moment while we contact the National Weather Service for your report.")
exten => 611,8,AGI(nv-weather.php|${APCODE})
exten => 611,9,NoOp(Wave file: ${TMPWAVE})
exten => 611,10,Playback(${TMPWAVE})
exten => 611,11,Hangup

; NewsClips from Yahoo
exten => 511,1,Answer
exten => 511,2,Wait(1)
exten => 511,3,Set(TIMEOUT(digit)=7)
exten => 511,4,Set(TIMEOUT(response)=10)
exten => 511,5,AGI(nv-news.php|topstories)
exten => 511,6,NoOp(Wave file: ${TMPWAVE})
exten => 511,7,Playback(${TMPWAVE})
exten => 511,8,Wait(1)
exten => 511,9,Hangup

; MailCall for Asterisk 1.4
exten => 555,1,Answer
exten => 555,2,Wait(1)
exten => 555,3,Set(TIMEOUT(digit)=7)
exten => 555,4,Set(TIMEOUT(response)=10)
;exten => 555,5,Flite("At the beep enter your e-mail password.")
exten => 555,5,Swift("At the beep enter your e-mail password.")
exten => 555,6,Read(PWCODE,beep,4)
;exten => 555,7,Flite("Please hold a moment.")
exten => 555,7,Swift("Please hold a moment.")
exten => 555,8,AGI(nv-mailcall.php|${PWCODE})
;exten => 555,9,Flite("Thank you for calling. Good bye.")
exten => 555,9,Swift("Thank you for calling. Good bye.")
exten => 555,10,Hangup

; -- End New Nerd Vittles Code to Support Cepstral TTS

Once you get all of the code pasted into extensions_custom.conf, save your changes: Ctrl-X, Y, then Enter. Then reload your dialplan and add a symbolic link to Cepstral:

asterisk -rx "dialplan reload"
ln -s /opt/swift/bin/swift /usr/bin/swift

FreePBX Patch. Something about our applications gives FreePBX fits when you attempt to do a subsequent dialplan reload. So here's the patch to fix that. While still logged in as root, issue the following commands:

cd /root
wget http://pbxinaflash.net/scripts/fixconf.zip
unzip fixconf.zip
chmod +x fixconf.sh
./fixconf.sh
chmod 1777 /tmp

Aretta Communications for Hosted PBX in a Flash Service. We've saved the best for last today. Many of you have been asking for recommendations on hosted PBX service. And today we finally have one for you. Aretta Communications is the premier provider of hosted Asterisk solutions worldwide. Based in telecom-savvy Atlanta and pioneering the business VoIP triple play, Aretta is the first provider to combine hosted Asterisk-based servers with an integrated, high voice quality SIP Trunking offering, and pre-configured VoIP handsets that arrive at your door ready to plug in and start making calls. No longer do you have to try and cobble together components from different places for your PBX in a Flash server. It's finally all available from one company that understands Asterisk and has the flexibility and in-house expertise to work with any kind of custom configuration or application. Every hosted PBX in a Flash server sits in secure telco hotels with UPS power and on-net connectivity to the major Tier 1 providers.

Using software virtualization, Aretta is able to dramatically reduce the cost of a hosted PBX in a Flash server. The hosted offerings scale in a virtual environment to up to 32 simultaneous calls per virtual server. Beyond 32 calls, dedicated dual processor PBX in a Flash servers are available that can handle 48 to 96 simultaneous calls. These can be stacked to provide high density systems. For those large hosted TDM deployments, Aretta can handle on-net termination of T1 or T3 voice circuits into dedicated PBX in a Flash servers with TDM cards. Aretta has a standard weekly backup offering for all of its hosted servers and nightly backups can also be accommodated. Backups can even be sent to geographically disperse datacenters for the ultimate in disaster recovery.

Aretta literally is changing the game in the hosted PBX market by pioneering a brand new pricing model. Forget the old per-extension pricing we've all seen where you get nickeled and dimed for every little feature you want to add to your individual lines. Finally, you pay one low monthly price for an entire system with a complete feature set and the ability to add an unlimited number of extensions. Aretta's pricing is customer-friendly, based on the number of active calls going through the system at any given time. This allows you to start small and grow as needed. PBX in a Flash hosted plans start at 2 channels and expansion is easy and automatic to four, eight, sixteen channels and beyond. Every feature within Asterisk is included in the monthly price. The only a-la-carte option is for help configuring your system. This is available as a one-time initial configuration option when you sign up for your hosted PBX in a Flash system or on a per-incident basis once it is installed.

The NetSIP trunking offering from Aretta provides SIP origination and termination in a variety of configurations. You can choose to pay by the minute or reduce your calling rates with bundled packages of minutes. Unlimited flat-rate inbound-only DIDs are available in 46 countries worldwide. DIDs in over 6300 rate centers in the United States are available in either 'Local Inbound' or 'Enhanced Local Service' configurations. Aretta has also developed a streamlined online number porting system to allow for automatic LOA generation making it easy to port numbers from other providers.

Aretta also offers pre-configured Polycom and Linksys handsets through its online store that arrive at your doorstep ready to plug-in and start calling. Priced competitively with the added bonus of coming configured, IP phone configurations are done automatically while the devices are in transit. Through its extensive customer deployments, Aretta has navigated the QoS and NAT related issues that can occur with typical IP-PBX deployments. Aretta builds and sells pre-configured edge routers based on the open source DD-WRT software to provide a low-cost premise edge device to keep local extension calls on the LAN and provide a great solution for voice QoS.

Last, but not least, in addition to hosted PBX in a Flash systems, Aretta has the flexibility and expertise to build and host custom applications using PBX in a Flash as the core underlying technology. Examples include:

  • Hosted VICIDIAL - outbound and predictive dialing based on Asterisk
  • Hosted A2Billing - the leading open source prepaid and calling card platform for Asterisk
  • High Availability Asterisk - two separate geographically disperse Asterisk servers running in a High Availability configuration with failover
  • Custom IVR development
  • IAX Trunking

If you can dream it and run it with PBX in a Flash, Aretta can build and host it for you. So what are you waiting for, visit Aretta Communications today and take advantage of their special offer for new PBX in a Flash customers.

Nerd Vittles Cepstral Showdown with Allison TTS (courtesy of les.net). You now can take today's Nerd Vittles projects for a test drive... by phone! The current demos include all five new applications preconfigured for Cepstral with the Allison TTS voice: (1) MailCall for Asterisk with password 1234 (retrieve POP3 email by phone), (2) NewsClips for Asterisk (latest news headlines in dozens of categories), (3) Weather Forecasts by U.S. Airport Code, (4) Weather Forecasts by U.S. ZIP Code, and (5) Worldwide Weather Forecasts.

Here's where it gets interesting. We decided to let you compare the voice quality of the calls using our Comcast home cable service versus Aretta Communications' Hosted PBX in a Flash service. The same code is running on both systems and both systems are using les.net for origination. The only difference is that our home system is running on a $199 WalMart Green PC. To make things interesting, we're not going to tell you which phone number goes to which location. Clue #1: Neither system is actually in the Nerd Vittles Valley Girl Headquarters in California. Clue #2: One system may or may not be in the same city as its area code. Give us a little credit. We're smart enough to assign DIDs to any PBX we happen to like... especially if it might confuse our readers. So don't just pick a favorite number because you happen to know that Aretta is in Atlanta and so is the 678 area code. We're tempted to actually swap the DIDs around once or twice just to keep everyone on their toes. And, of course, Comcast may have some additional tricks up their sleeve to make this more interesting.

So... let the voting begin. Dial away on the two numbers shown above and report your results in a comment. If you get a message that Allison isn't available or if you just get silence, simply try your call a little later. We weren't smart enough to limit inbound calls to one channel, and FreePBX doesn't seem to be able to do it either. We can't wait to read what our judges have to say. Enjoy!


Some Recent Nerd Vittles Articles of Interest...

Be Sociable, Share!

  1. Join the following line with the original line whenever you encounter the ↩ character. []

9 Responses to “Text-to-Speech Bonanza with Cepstral and Asterisk 1.4”

  1. Kevin says:

    Ward,
    Called both numbers, 310 was OK but got some dropouts, 678 quality was better, but after entering the zip code I wanted the weather for, it says successfully downloaded but then hangs up. You might want to check. Weather report for 310 worked properly.

    Kevin

  2. Kevin says:

    I felt like the 678 number sounded significantly clearer – but I had the same isue with Weather-by-zip that Kevin had. It looks like you’re having the issue that’s been discussed over in the forums, Ward. You’d better go have a look at it!
    Jeff

    [WM: It was the double whammy that got us. There was a permissions problem. And, after fixing the permissions, if you don't restart Asterisk, the reports don't play. All is well... finally.]

  3. Hey Ward, I will be using all of this as soon as I take the time to buy me some Cepestral licenses…
    Just to let you know that as of Feb-14-2008 16:00 and again Feb-15-2008 11:30 the 310-862-XXXX gave me a message that the number I’ve called is not in service, please…. I am calling from Puerto Rico using a standard cell phone.
    The 678-444-XXXX was working beautiful, and convinced me to get a Cepestral license! I am just hoping for Cepestral to work WELL in spanish some day… some day!
    Have a good one, and have fun at the coming FreePBX Training!

  4. Brett says:

    310 definately sounds like Comcast. We experienced the same jitter issues when our PBX was connected to Comcast.

    678 is better but the same issue with the call dropping after punching in the zip code.

    [WM: See response to Comment #2, above.]

  5. JimA says:

    Please disregard my previous comment. I actually just need to symlink to the swift command and all worked great. In fact I have all 5 applications working perfectly now on my system. This is absolutely fantastic stuff. Way to go!!!

  6. Ed Lally says:

    Hey Ward,

    I have to agree with the others. I retrieved weather by zip code on both numbers, and thought the 678 number was clearer with fewer dropouts. The 678 number has to be the hosted solution. I have to say, though, that the 310 number sounded perfectly acceptable for a home-based solution.

  7. eufreka says:

    Okay, they both sounded comparable to me. Both were acceptable, neither was exceptional. I did have to call the 310 number twice before it picked up properly though (first time, just silence).

  8. rick nieves says:

    In my opinion the 310 sounds more clear and definitely noticeable difference.

  9. Zach says:

    I was hoping for some direction / input on where to locate some information for a system we need to setup. The details of the system are as follows:

    1) Caller calls into the system and is asked to enter an ID number.
    2) ID number is recorded and then a lookup is performed against a MS SQL database for the entered ID number.
    3) If the number exists, the caller is then asked to record their name, enter their phone number, record their email address and record any additional details they wish to include.
    4) All the recordings above are then stored in the file system (preferably MS Fielsystem, but can work with linux) with a pointer from the MS SQL database to record each individual piece of information. Details they keyed in, such as their telephone number and ID number are stored in database.

    The system above will be using Cepstral to read back information they have keyed in for confirmation.

    Can someone please point me in the right direction as to where I can locate information on having Piaf connect to a MS SQL database? Also, on where I can locate some information that would explain how the recording could then be played back through a website accessed by customers to hear the information the caller recorded?

    Any assistance you could provide me with on this matter is greatly appreciated.

Ringbinder theme by Themocracy