Home » Incredible PBX » Amazon’s Polly TTS Returns for Incredible PBX 2021

The Most Versatile VoIP Provider: FREE PORTING

Amazon’s Polly TTS Returns for Incredible PBX 2021

In a word, WOW! If you’ve previously used text-to-speech (TTS) applications with Incredible PBX™ or any other PBX, you fully appreciate the challenges of getting excellent voice quality from a synthesized voice. In addition to operating system quirks, you also had to scramble to find TTS software that had acceptable voice quality without breaking the bank. Well, it’s a new day with Incredible PBX 2021. Shortly after Amazon’s introduction of Polly TTS, we integrated it into the Wazo platform with Incredible PBX. However, because of Debian dependencies, we were unable to migrate it to CentOS. With RedHat’s recent decision regarding CentOS, we introduced Incredible PBX 2021 for Debian. And now is a perfect time to bring back Polly TTS as well. Polly TTS provides not only incredible voice quality but it comes at an unbelievable price point. Your first year is free for the first 5 million characters each month. After that and in subsequent years, it’s $4 for every million characters of TTS translation, and you only pay for the characters used. But, don’t take our word for it. Listen to this sample. The clip’s introduction uses the free Pico TTS voice. The Yahoo News headlines were generated with Polly. Can you say Night and Day?

[soundcloud url="https://api.soundcloud.com/tracks/319736570″ params="auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&visual=true" width="80%" height="414″ iframe="true" /]

The beauty of Nerd Vittles projects is it’s all about the freedom to choose rather than making do with choices selected by others. Today’s addition of the Polly TTS engine brings the number of TTS options supported with Incredible PBX 2021 to four. In addition to the free options of Festival and PICO, you now have two dirt cheap commercial alternatives that rival the voice quality of any available TTS application on the market. There’s IBM’s Watson which we are using for voicemail transcription. And now you have Amazon’s Polly TTS as well.

Stewart Nelson was kind enough to share his audio clip comparing the Top Four commercial TTS applications. You can judge them for yourself. The clips are played in the following order: Amazon Polly TTS, Google Translate, IBM Watson TTS, and Microsoft.

[soundcloud url="https://api.soundcloud.com/tracks/320177552″ params="auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&visual=true" width="100%" height="450″ iframe="true" /]

How New TTS Apps Will Work in Incredible PBX 2021. That’s only half of our story today. We also are introducing our proven TTS methodology that makes it easy to roll your own TTS applications and take advantage of the voice platforms already installed on your Incredible PBX 2021 server. In our new TTS design, there are three components. First, there’s a chunk of dialplan code that answers calls, prompts for input (if required), and then passes the call off for processing and generation of the TTS results using the desired TTS platform.

The processing and TTS components consist of two PHP/AGI scripts on Asterisk® servers. The results processing script actually obtains the data to feed to the TTS processing engine. For example, this could be news headlines or a local weather forecast. This script generates plain text suitable for processing by any TTS engine. Finally, a TTS script stores your user credentials (if required) and handles translation of the text results into an audio file using the TTS platform of your choice. It also plays the audio "results" to the caller. As you add new applications, all that is necessary is a short dialplan snippet and a results processing script to obtain the necessary text to feed the TTS processing script.

Here’s a sample Asterisk dialplan snippet for our Yahoo News Headlines application. Note that you need only change the pollytts line of code to switch TTS engines. Simple design!

;# // BEGIN nv-news-yahoo
exten => 951,1,Answer
exten => 951,n,Wait(1)
exten => 951,n,Set(TIMEOUT(digit)=7)
exten => 951,n,Set(TIMEOUT(response)=10)
exten => 951,n,AGI(picotts.agi,"Please hold while we get the headlines.",en-US)
exten => 951,n,AGI(nv-news-yahoo.php,10) ;  obtain latest 10 Yahoo NEWS Headlines
exten => 951,n,NoOp(News: ${NEWS}) ;  display NEWS in text format on Asterisk CLI
exten => 951,n,AGI(pollytts.php,"${NEWS}") ; pass NEWS to TTS engine for playback
exten => 951,n,Hangup
;# // END nv-news-yahoo

The picotts line (above) shows the syntax to use the Pico TTS engine instead of pollytts. The new line would look like the following. Doesn’t get much easier than this:

exten => 951,n,AGI(picotts.agi,"${NEWS}",en-US)

Getting Started. Here are the steps to get everything working with your existing Incredible PBX 2021 platform. First, you’ll need credentials from Amazon Polly after you create or sign in to your an Amazon AWS account. Enter "Polly" in the AWS dialog to add the service. Make note of your Amazon region while here. Then open your Security Credentials by clicking on your name and choosing My Security Credentials. Create a new Access Key ID and Secret. You’ll need these credentials as well as your Amazon region in a minute. Next, you’ll need to put the pieces in place on your Incredible PBX 2021 server to support Polly TTS. We’ve made this easy by bundling everything into a single tarball. Just log into your server as root, download the tarball, untar it, add MP3 support for SOX, run the included script to install the dialplan code, and edit the pollytts.php script to install your Amazon credentials. Install time: under a minute.

cd /var/lib/asterisk/agi-bin
cp -p nv-news-yahoo.php nv-news-yahoo-orig.php
cp -p nv-weather-zip.php nv-weather-zip-orig.php
wget http://incrediblepbx.com/nv-polly-install.tar.gz
tar zxvf nv-polly-install.tar.gz
rm -f nv-polly-install.tar.gz
apt-get -y install libsox-fmt-mp3
nano -w pollytts.php

Once the pieces are in place and the editor opens, insert your Amazon key, secret, and region code. Then save the file: Ctrl-X, Y, then ENTER.

Now you can test things out by picking up a phone connected to your PBX and dialing 951 for News or 947 for Weather by ZIP Code. Enjoy!

NEWS FLASH: This new installer works great on the Incredible PBX 2020 Raspberry Pi platform as well.


Originally published: Monday, January 22, 2021

Need help with Asterisk? Visit the VoIP-info Forum.


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.


  1. Any reason not to use Incredible PBX 2021 for Debian on RPi4+? Being a Debian OS, I’d assume there’s no problem.

    [WM: Raspbian is Debian simply customized for the Raspberry Pi’s ARM platform and components. Really nothing to be gained by switching to Debian, and you’d lose a good bit of functionality that is RasPi-specific.]

Comments are closed.