Home » Technology » Allison’s Text-to-Speech Trifecta: Cepstral, Asterisk 1.4 or 1.6, and FreePBX 2.4

The Most Versatile VoIP Provider: FREE PORTING

Allison’s Text-to-Speech Trifecta: Cepstral, Asterisk 1.4 or 1.6, and FreePBX 2.4

If you've longed for a text-to-speech Asterisk® toolkit that sounds just like the default Allison prompts that ship with Asterisk 1.4, then today is your lucky day. We're going to walk you through installing Cepstral with Asterisk 1.4 or 1.6 and FreePBX 2.4. The icing on the cake is a new Cepstral voice that sounds just like the twin sister of Asterisk's Allison. And guess what? Just like the two Darryl's on the Bob Newhart Show, the twin sister's name is Allison, too. What a coincidence! Well, not really. Allison is actually the first TTS voice created using Cepstral's new VoiceForge™ technology. For the complete history of the development of Allison's voice for Cepstral, you can read all about it here.

Update: For the latest news on Cepstral and app_swift, visit the PBX in a Flash Forums.

Next week, in Part 2, we'll build the Nerd Vittles' Stealth AutoAttendant in FreePBX to answer your incoming calls with a separate IVR to process calls when you're not around. For those new to Nerd Vittles, the Stealth AutoAttendant answers incoming calls with a message like this: "Hi. You've reached Total Telephony Solutions. Please hold a moment while we connect your call to the next available representative." Or, for home users, the message might go something like this: "Hi. You've reached the Mundy's residence. Someone will be right with you." While the greeting message is playing, you can press keys on your phone to transfer to an extension, activate DISA, or retrieve your voicemail messages. Because the options aren't advertised in the greeting, other callers won't know they're available. We'll protect the IVR options with passwords, of course. The NoAnswer or Unavailable IVR will also include options to leave a message, transfer to your cell phone, or drop into an applications AutoAttendant. The difference in the 2008 version of these AutoAttendants is that, this time around, you can customize all of the IVR announcements and options to meet your specific needs in less than a minute. And we'll design, develop, and deploy the entire solution using FreePBX's web interface and no custom code. All of this becomes possible thanks to FreePBX and Cepstral's Allison, who will be on your payroll once we get finished up with this project.

Prerequisites. To get this working won't cost you a dime. But, once you've played with it and like it (and we know you will), you'll need to spring for the $30 to license the Cepstral Allison voice for your Asterisk system. Our advice is simple. Try it first. Then you can buy it. You'll also need a robust Asterisk 1.4 platform with Linux, Apache, SendMail, PHP, and MySQL preconfigured to support text-to-speech applications. Not that we're biased or anything, but may we recommend you give PBX in a Flash a try. You'll find complete installation instructions and the free download here.

And, during the FreePBX Training Seminar in Charleston, we'll walk you through revising the Nerd Vittles weather, news, and email text-to-speech applications to take advantage of the tremendous power that Cepstral and Cepstral's Allision now bring to your Asterisk platform. See what you're missing by not attending the FreePBX Training Seminar. Don't worry!! We'll share all of the code with you anyway, but the seminar participants will get to play with it first.

Installing Cepstral. For today, we're going to walk you through installing Cepstral with the Cepstral Allison voice. But there are numerous other voices. You can check all of them out on the Cepstral demo site. Just be sure to select only the 8kHz voices which are specifically designed to support telephony applications. Once you find the voice you like, you can decipher the download link here. Be sure you choose the correct i386-Linux version for your system. You can't use the 32-bit version on a 64-bit CentOS system, e.g. the new 64-bit ISO of PBX in a Flash 1.2. But the same license key works for both the 32-bit and 64-bit versions of the same voice. Upgrades to the 5.0 Cepstral voices are available here.

CentOS 5.x 32-bit Install. For the 32-bit version of PBX in a Flash 1.1 or 1.2, log into your system as root and enter the following commands:1

cd /root
wget http://downloads.cepstral.com/cepstral/i386-linux/↩
Cepstral_Allison-8kHz_i386-linux_5.1.0.tar.gz
tar -zxvf Cepstral*
cd Cepstral_Allison-8kHz_i386-linux_5.1.0
./install.sh

CentOS 5.1 64-bit Install. For the 64-bit version of PBX in a Flash 1.2, log into your system as root and enter the following commands:

cd /root
wget http://downloads.cepstral.com/cepstral/x86-64-linux/↩
Cepstral_Allison-8kHz_x86-64-linux_5.1.0.tar.gz
tar -zxvf Cepstral*
cd Cepstral_Allison-8kHz_x86-64-linux_5.1.0
./install.sh

After you've read the license, type yes to install the voice on your system, not -yes- as the instructions imply. Don't ask how I know. Accept the default locations for the installation. When the installation completes, issue the following command:

echo /opt/swift/lib > /etc/ld.so.conf.d/cepstral.conf
ldconfig

Now plug some speakers into your PBX in a Flash system, and type: swift "Hello World." If you want to get fancy, try this one:

swift "Hello <break time='200ms' /> World"

You can read up on Cepstral's Speech Synthesis Markup Language (SSML) here. Before we continue, you need to write down the name of the installed voice. You'll need this to register the voice later and to get Asterisk set up properly to use Cepstral. Here's the command to retrieve the voice name(s) that you've installed:

ls /opt/swift/voices

Installing app-swift. There's another important piece in getting Cepstral to play nicely with Asterisk 1.4 or 1.6, apt-swift. In the words of the author, it does four things and does them well:

* Doesn't keep the caller waiting in silence while the app generates the entire TTS output to a temp file
* Doesn't unceremoniously kill off the swift engine when done, upsetting the Cepstral license server and eating a concurrency license
* Has configurable in-memory buffering of the swift output to balance memory usage vs Swift process concurrency
* Responds to user DTMF during the speech by setting a channel variable and optionally doing a goto of the extension entered

Asterisk 1.4 Install. To install apt-swift on your PBX in a Flash/Asterisk 1.4 system:

cd /usr/src
wget http://pbxinaflash.net/source/app_swift/app_swift-1.4.2.tar.gz
tar -zxvf app_swift*
rm *.gz
cd app_swift-1.4.2
make
make install

Asterisk 1.6 Install. If you're using the newer versions of PBX in a Flash with Asterisk 1.6, you will need Darren Session's 1.6-compatible version of app-swift:

cd /usr/src
wget http://pbxinaflash.net/source/app_swift/app_swift-1.6.2.tar.gz
tar -zxvf app_swift-1.6*
rm *.gz
cd app_swift-1.6.2
make
make install
cp swift.conf.sample /etc/asterisk/swift.conf
chown asterisk:asterisk /etc/asterisk/swift.conf

Finally, you need to add a link in your search path for Cepstral and modify /etc/asterisk/swift.conf to tell it which voice you want to use with Asterisk and then restart Asterisk. Assuming you installed Allison-8kHz, here are the commands.

ln -s /opt/swift/bin/swift /usr/bin/swift
sed -i 's|David-8kHz|Allison-8kHz|' /etc/asterisk/swift.conf
amportal restart

Testing Cepstral in Your Dialplan. To be sure that everything is installed and working with Asterisk, issue this command:

asterisk -rx "core show application swift"

You should receive the following response:

-= Info about application 'Swift' =-

[Synopsis]
Speak text through Swift text-to-speech engine.

[Description]
Swift(text) Speaks the given text through the Swift TTS engine.
Returns -1 on hangup or 0 otherwise. User can exit by pressing any key.

If everything is working swimmingly, let's modify your dialplan a bit to give Cepstral a test run. Edit /etc/asterisk/extensions_custom.conf (nano -w filename) and search (Ctrl-W) for 1234. You should then see a string of code that looks something like this:

exten => 1234,1,Playback(demo-congrats)
exten => 1234,2,Hangup()
exten => h,1,Hangup()

Let's modify it so that it looks like this:

;exten => 1234,1,Playback(demo-congrats)
exten => 1234,1,Swift(Congratulations! You have installed Cepstral.)
exten => 1234,2,NoOp(Key pressed: ${SWIFT_DTMF})
exten => 1234,3,Swift(You pressed ${SWIFT_DTMF}. Goodbye.)
exten => 1234,4,Hangup()
exten => h,1,Hangup()

Save your changes (Ctrl-X, then Y, then Enter). And restart Asterisk: amportal restart. Now dial 1-2-3-4 from an extension on your PBX in a Flash system. Presto! Welcome to the World of Cepstral on your Asterisk 1.4 PBX. Should you have problems with the install, kindly post a message on the PBX in a Flash Forum. Enjoy!

Licensing Cepstral Voices. If you've made it this far with no hiccups, it's probably time to cough up your 30 bucks and make the nag messages disappear. (HINT: Read all of the comments, and you might save some money.) Keep in mind that it's $30 per simultaneous connection using Cepstral! If you're an application designer, you probably need to keep this in mind. It doesn't tie up your Cepstral voice very long to read a sentence. But reading a 7-day weather forecast is another matter. For the latter type application, it makes more sense to conserve your voice licenses by quickly generating a .wav file with Cepstral and then releasing the Cepstral engine. The same applies with IVR applications. Using Cepstral is the same PHP syntax as flite except you substitute the swift command, e.g. system("swift -f $inputfile -o $outputfile"). You then can play back the .wav file using other tools within Asterisk. Now go to this link to pay the piper. Be sure you select U.S. English language, Allison-8kHz voice, and Linux platform before you check out, or it's money down the drain. Write down the name, company (optional), and key that is issued once you fill in the blanks. Then it's back to your PBX in a Flash system as root and enter the following command. Note: it's two hyphens before the word reg-voice.

swift --reg-voice

Fill in the blanks with the information you wrote down, and you're all set. Dial 1-2-3-4 from a phone on your system again, and the nag message should be gone.

Your Name: John Q. Public
Company (if applicable): Acme Widgets
Voice: Allison-8kHz
License Key: xx-xxxxxx-xxxxxx-xxxxxx-xxxxxx-xxxxxx


Some Recent Nerd Vittles Articles of Interest...

  1. Join the following line and the original line with no intervening space when you encounter the ↩ character. []

27 Comments

  1. I think "swift –voices" would be a better way to check for the installed voices rather than peeking in the directory 🙂

    [WM: Good point! Saves keystrokes, too.]

  2. When I follow your instructions for installing apt-swift, I get compile errors during the initial make command. Do you know what other dependencies I need for Swift? I have Trixbox 2.4 installed (sorry, I’m just more familiar with it that with PBX in a Flash) and I am beginning to think there’s something which isn’t being installed during installation of the system.

    [WM: You got it right. TrixBox 2.4 is missing all sorts of source code. Take a look at this link for some install suggestions.]

  3. For early adopters today, you may have had some problems if you cut-and-pasted a couple of the commands because of a WordPress quirk that substitutes fancy quotes and fancy apostrophes for normal ones. We also left out one command. Ooops! So just execute the following commands after logging into your server as root and be sure to replace the fancy quotes and apostrophes if you cut-and-paste:

    ldconfig
    sed -i 's|David-8kHz|Allison-8kHz|' /etc/asterisk/swift.conf
    amportal restart
    asterisk -rx "core show application swift"

  4. I tried posting the help section, but I don’t have priviliges yet. The Cepstral voices are enough to make me switch from Trixbox. I did a fresh install, but can’t get VM to record. Can you point me in the right direction?

  5. I initially installed trixbox 1.2.3 ISO image and would like to install FreePBX. I really want a true "Open-Source" platform but
    having a hard time finding an ISO Image of FreePBX that will load
    completely ! With an up an running trixbox platform can I replace or(update) Kernal source code for FreePBX or is this opening a Pandora’s
    box. I would like to add Cepstral’s ‘Allison’ functionality and try out the new Managment features.
    Thanks,
    -Ed

    [WM: There are tutorials to add Asterisk source to trixbox and upgrade it. But, once you do that, it’s my understanding that you’ve broken future upgrades through their repository. I’ve heard there’s another distribution that’s a bit more open with a lot more source available. You might want to give it a try.]

  6. @Ed Sweazy,
    Trixbox installations already include an installed FreePBX. That is a big part of Trixbox and other gui-centric PBXs. Updating Freepbx may be an issue with certain versions, however 1.2.3 is a pretty old version, more than 1 year+. I would go with WM’s suggestion since it seems there will always be an easier upgrade path compared to Trixbox. Remember to backup your info regardless of what PBX installation you have.

  7. Hi, when you say:
    "Now plug some speakers into your PBX in a Flash system, and type: swift "Hello World."

    you really mean that the PBX will speak trough the sound card to the speakers?

    because i get no sound…

    [WM: If you plug speakers into a soundcard on your Linux system running PBX in a Flash and issue the swift command at the command prompt, the text-to-speech sounds will play through the attached speakers. Be sure you have the speakers plugged into the green jack on your sound card. Some sound cards also require self-powered speakers which might also explain the lack of sound. Our reference system is the $199 WalMart special manufactured by Everex. It works on those systems out of the box.]

  8. Don’t you also need an "Audio Distribution License" to play Cepstral-generated TTS over the phone? These used to be sold online for $199.95 per voice, but were recently removed from the Cepstral online store.

    [WM: This should not be construed as legal advice!! Section 2 of the current EULA is reprinted below for your information. Consult an attorney if you still have questions.]

    2. RESTRICTIONS ON USE AND TRANSFER. The Product may not be copied.
    You may not resell, sublicense, assign, transfer, distribute or
    disclose the Product or any rights to use it, either in whole or part,
    to any third party. You may not modify the Product in any manner.
    The license granted above is an object code license only and no rights
    are granted to you in regards to the source code of the Product.
    Except as provided in this Agreement, you shall not resell,
    sublicense, assign, transfer or distribute the Audio without written
    permission from Cepstral. You may distribute the Audio on a
    noncommercial basis to third parties for their own internal purposes.
    Additionally, you may distribute the Audio on a commercial basis
    solely where the Audio is directly output from inputs to the Product
    by a third party receiving such Audio for such third party's own
    internal purposes.
    You may not decompile, disassemble, reverse
    engineer or otherwise manipulate the Product so as to derive its
    source code.

  9. If you wish to install this on Trixbox 2.4 you need to install all of the asterisk development dependencies first:

    yum install asterisk-devel

    that worked for me.

    [WM: Correct. Here’s a thread that will walk you through the process with trixbox 2.4.x systems.]

  10. I have an Aastra 53i I am trying to set up. Can I use the 57i instructions for it?

    [WM: Try it. Most keys will work. Only difference is screen size, I think.]

  11. I have this running locally on my OSX development laptop just fine (Asterisks/Adhearsion/Rails/Swift). All is good…

    However, I’m running CentOS on my production server. In the Asterisks remote client I’m getting:

    ERROR[17500]: app_swift.c:240 swift_exec: Failed to set voice

    This command works:

    asterisk -rx "core show application swift"

    The voice is set in the swift.conf and running swift from the command line seems to be working fine (although I’m not positive I’m getting sound out of the box, its remote, but swift "foo" -t reads back the lines). Anyone have any ideas?

  12. I fixed the first problem below
    load app_swift.so
    [May 24 12:47:52] WARNING[20866]: loader.c:363 load_dynamic_module: Error loading module ‘app_swift.so’: libswift.so.5: cannot open shared object file: No such file or directory

    by editing the ls.so.conf and added the line /opt/swift/lib asterisk then finds the library libswift.so.5

    I then got the set voice error fixed this be setting looking up what voice i had by.

    /opt/swift/bin/swift –voices

    this shows that I downloaded Lawrence-8kHz then edit the /etc/astersik/swift.conf

    to show.

    voice=Lawrence-8kHz

    then modify the extensions.conf to call and use the swift appliaction then buy the licence and your done.

    James

  13. Hi Darren,

    I have noticed a bug in app_swift v1.4.2. I have installed asterisk on Ubuntu Server 8.04 and I installed app_swift v1.4.2.

    I have noticed the following anomalies
    1) When i set the application to accept a single DTMF input and the text is still being played and I press a digit on the phone, the speech stops, and I receive a string with lots of digits with the first digit being the one I pressed. eg: Swift(Press 5 numbers|5000|5). I pressed ‘1′ and I read the following in SWIFT_DTMF “1390876″, where ‘1′ is valid and the rest i think is a memory problem.

    2) If i set the Swift application to receive more than 1 DTMF input and i start to enter digits while the speech is still not completed, the the first digit of the input get replaced by the last one. eg:
    Swift(Press 5 numbers|5000|5). I press 12345 and i SWIFT_DTMF contains 52345. I think this is because of memory/pointer address problem.

    I do not know who to report this bug to. So i thought i would leave this here.

  14. The coupon code posted above (REALLUSIONTTS) does not work. I have tried it. If anyone else gets it working, I would like to know.

    [WM: You’re a little late to the party. Coupon codes don’t last forever.]

  15. Just wondering, this says that Allison is around 30 bucks, but don’t we need to have a Port License as well? That makes it more like 80 bucks.

    [WM: Haven’t looked at the license in a while, but my recollection is that port licenses only were required for commercial use.]

  16. I do not hear anything when I try calling 1234.

    [WM: The ISN is 1234*1061. If you don’t hear anything, then try the SIP URI: 1234@sip.pbxinaflash.com. If neither works, then your system is not configured for SIP call routing. If the latter works but not the ISN, then your system is not properly configured for ISN call routing.]

  17. I’ve been trying to use ssml to make words louder, even tried the example on the cepstral forum to no avail. Anyone using the ssml markup in their dial plan? I posted on the forums too.

  18. gcc -I/opt/swift/include -g -Wall -D_REENTRANT -D_GNU_SOURCE -fPIC -c -o app_swift.o app_swift.c
    app_swift.c: In function âload_moduleâ:
    app_swift.c:540: error: too many arguments to function âast_config_loadâ
    make: *** [app_swift.o] Error 1

  19. Sorry for duplicated comment.I have problem app_swift with error as followig.So i have solve it.I have update the gcc.
    gcc -I/opt/swift/include -g -Wall -D_REENTRANT -D_GNU_SOURCE -fPIC -c -o app_swift.o app_swift.c
    app_swift.c: In function âload_moduleâ:
    app_swift.c:540: error: too many arguments to function âast_config_loadâ
    make: *** [app_swift.o] Error 1

  20. screenscrapper*CLI> cepstral show licenses
    Cepstral Licensing Information
    ==============================
    Allison Voice Enabled: no
    Total licensed ports: 1

    How to activate my allison voice?

    [WM: swift –reg-voice ]

Comments are closed.