And you thought you needed an Asterisk® PBX for your users to enjoy GPL1 text-to-speech applications such as current News Headlines and Weather reports from the convenience of their telephone. Well, move over Asterisk. PIAF5™ and 3CX® now offer virtually identical functionality with all of the terrific advantages that a commercial-quality PBX provides: reliability, support, updates, security, and an unmatched UC platform that is second to none.
There is no 3CX support for interactive TTS or STT applications (yet). So we’re doing the next best thing. Once or more a day, we will use cron jobs to retrieve the latest News Headlines and Weather reports for your local area. Then anyone on your 3CX PBX can pick up a phone and listen to the News Headlines by dialing 951 or U.S. weather forecasts by dialing 947, or worldwide weather forecasts from ApiXU by dialing 949. We’ll be using IBM’s awesome TTS engine to handle the text-to-speech chores. We think you will agree that IBM’s offering is the best in the business. And you can’t beat the price. After your first free month, you get a million characters of FREE text-to-speech synthesis every month forever! For ApiXU worldwide weather data, your first 2,500 queries from 3CX are also FREE every month.
[soundcloud url="https://api.soundcloud.com/tracks/364353344″ params="auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&visual=true" width="80%" height="350″ iframe="true" /]
Getting Started with IBM Bluemix TTS Service
NOV. 1 UPDATE: IBM has moved the goal posts effective December 1, 2018:
You can start your free, 30-day trial of IBM Bluemix services without providing a credit card. Just sign up here. Once your account is activated, here’s how to obtain credentials for the TTS service to use with PIAF5 and 3CX. Start by logging in to your IBM Bluemix account. Once you’re logged in, click on your account name (1) in the upper right corner of your web page to reveal the pull-down to select your Region, Organization, and Space. Follow the blue links at the bottom of the pull-down menu to create an Organization and Space for your TTS service.
Next, click the Menu icon which is displayed as three horizontal bars on the left side of the web page. Choose Watson. Click Create Watson Service and select Text to Speech from the applications listing. Watson will generate a new TTS service template and display it. Make certain that your Region, Organization, and Space are shown correctly. Then verify that the Standard Pricing Plan is selected. When everything is correct, click the Create button.
When your Text to Speech application displays, click Service Credentials and then click New Credential (+). When the Add New Credential dialog appears, leave the default settings as they are and click Add. Your Credentials Listing then will appear. Click View Credentials beside the new entry you just created. Write down your URL, username, and password. You’ll need these in Step #4 below to configure the IBM Bluemix TTS service. Logout of the IBM Cloud by clicking on the little face in the upper right corner of your browser window and choose Log Out. Confirm that you do, indeed, wish to log out.
Getting Started with ApiXU Weather
Finding free worldwide weather forecasts has been a difficult nut to crack. So we’re pleased to introduce ApiXU. Your first 5,000 API calls every month are free, but our Worldwide Weather application for 3CX actually makes two API calls to retrieve the latest weather conditions AND the weather forecast. What that means is you can make 2,500 free queries a month with the Nerd Vittles application. One or two a day should suffice. While the U.S. weather reports are retrieved by ZIP code, the ApiXU queries are retrieved by city. So long as you don’t choose small towns, the city names should be sufficiently unique to work well with the WorldWide Weather application. HINT: Nicosia in Cyprus (home of 3CX) works great! 😉
Before you can obtain worldwide weather reports, you’ll need to sign up for an account at ApiXU.com. Once you’re registered, log into your account and copy down your API Key. You’ll need it in a minute.
5 Steps to TTS Paradise with 3CX
Once you have your IBM TTS credentials in hand, there are only five simple steps to get everything set up for TTS application support on your 3CX PBX. When we’re finished, anyone on your 3CX PBX can pick up a phone and listen to the News Headlines by dialing 951, a U.S. Weather Forecast by dialing 947, or Worldwide Weather for most international cities by dialing 949.
- Download WAV file placeholders to your Desktop PC
- Set up 3 Digital Receptionists on your 3CX Dashboard
- Install the Linux components to support TTS Applications
- Insert IBM and ApiXU Credentials, Email Address and Locations
- Run the News Headlines and Weather Update Scripts
1. Downloading WAV File Placeholders
On the desktop computer from which you will access the 3CX Dashboard with a browser, download and unzip http://incrediblepbx.com/3cx-tts-desktop.zip. This gets you the three WAV files that we will use as placeholders in 3CX to support current News Headlines and Weather reports.
2. Setting Up Digital Receptionists in 3CX
Before you can implement the Nerd Vittles TTS Apps for News Headlines, Weather by ZIP Code, and Worldwide Weather, we first need to create the proper environment on the 3CX side to support the new applications. We’ll be using the 3CX Digital Receptionist for this purpose, and we’ll make one adjustment to the IVR environment to support scripted updates. First, we need to disable caching of sound prompts since we’ll be updating these every day, and we don’t want to have to reload the 3CX IVR module each time we make changes. Then we need to set up three Digital Receptionist extensions, one for the News Headlines and one for each of the Weather applications.
Login to your 3CX Dashboard with a browser.
First, we need to add a hidden environment variable to the 3CX Parameters Table to disable caching of IVR sound files. Here’s how.
From the 3CX Dashboard, choose Settings, then Parameters, and click Add. Insert the following new entry to the Parameters Table and then click OK:
Name: IVR_CACHE_DISABLE Description: Disable IVR caching of sound files Value: 1
Now let’s add the Digital Receptionists to support the News and Weather applications. From the 3CX Dashboard, choose Digital Receptionist then Add. Fill in the blanks like this:
Name: News Headlines
Extension: 951
Prompt: news.wav (then click Upload and choose news.wav file that you downloaded in step #1 to your Desktop)
skip down toward the bottom of the template and change If no input within seconds: to 1.
Click OK to save the News Headlines Digital Receptionist.
From the 3CX Dashboard, choose Digital Receptionist then Add. Fill in the blanks like this:
Name: Weather by ZIP Code
Extension: 947
Prompt: weather.wav (then click Upload and choose weather.wav file that you downloaded in step #1 to your Desktop)
skip down toward the bottom of the template and change If no input within seconds: to 1.
Click OK to save the Weather by ZIP Code Digital Receptionist.
Name: Worldwide Weather
Extension: 949
Prompt: wwweather.wav (then click Upload and choose wwweather.wav file that you downloaded in step #1 to your Desktop)
skip down toward the bottom of the template and change If no input within seconds: to 1.
Click OK to save the Worldwide Weather Digital Receptionist.
Try things out by dialing 947, 949, and 951 from any 3CX extension. Be sure these work before proceeding!
3. Installing Linux Components for TTS
First, we need to get the missing pieces in place to support TTS applications using IBM Bluemix TTS and the Nerd Vittles scripts. We want to add PHP support from the Linux CLI only so there will be no security issues. And we want to add support for SQLite 3 so we can look up latitude and longitude data for U.S. zip codes. Just issue the following commands to get everything set up:
apt-get update apt-get -y install php-fpm php-curl php-cli php-pear php-db php-gd sqlite3 libsqlite3-dev apt-get -y install sox lame libsox-fmt-mp3 sed -i 's|;cgi.fix_pathinfo=1|cgi.fix_pathinfo=0|' /etc/php/7.0/fpm/php.ini systemctl restart php7.0-fpm
Next, we need to put the Nerd Vittles scripts and ZIP code database for SQLite 3 in place:
cd / wget http://incrediblepbx.com/3cx-tts-linux.tar.gz tar zxvf 3cx-tts-linux.tar.gz rm -f 3cx-tts-linux.tar.gz
Finally, we need to add cron jobs to run the three update scripts at least once a day. You can run them more often depending upon your needs. We have these configured to run at 6:15 am and 6:20 am every day. Adjust to meet your own requirements. To update the cached voice prompts, each of these update scripts stops and restarts the 3CX IVR Service. On a busy PBX, you probably don’t want to run them during the workday.
echo "15 6 * * * root /root/nv-weather-update.sh >/dev/null 2>&1" >> /etc/crontab echo "20 6 * * * root /root/nv-news-update.sh >/dev/null 2>&1" >> /etc/crontab echo "25 6 * * * root /root/nv-wwweather-update.sh >/dev/null 2>&1" >> /etc/crontab
4. Adding TTS Credentials to Your 3CX PBX
Now we need to add your IBM TTS and ApiXU credentials, email address, a local ZIP code for Weather by ZIP code reports, and a city for Worldwide Weather reports. Edit the credentials file and save it with your information:
cd /root nano -w ibm-credentials.php
5. Running the News & Weather Update Scripts
Finally, we need to run the News Headlines and two Weather update scripts once to put current data in place for 3CX callers. After the initial setup, the cron jobs will update the News Headlines and Weather reports every day moving forward. Press ENTER as each of the scripts finishes to get back to a command prompt.
cd /root ./nv-news-update.sh ./nv-weather-update.sh ./nv-wwweather-update.sh
Taking the News & Weather Apps for a Spin
Now you’re ready to try things out. From any phone connected to your 3CX, dial 951 for current News Headlines. Then dial 947 for a local Weather Report matching your zip code. Finally, dial 949 to retrieve a worldwide weather forecast for most international cities. Enjoy!
Originally published: Monday, December 4, 2017 Updated: Friday, March 2, 2018
Support Issues. With any application as sophisticated as this one, you’re bound to have questions. Blog comments are a terrible place to handle support issues although we welcome general comments about our articles and software. If you have particular support issues, we encourage you to get actively involved in the PBX in a Flash Forums. It’s the best Asterisk tech support site in the business, and it’s all free! Please have a look and post your support questions there. Unlike some forums, ours is extremely friendly and is supported by literally hundreds of Asterisk and 3CX gurus and thousands of users just like you. You won’t have to wait long for an answer to your question.
Need help with Asterisk or 3CX? Visit the PBX in a Flash 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.
Some Recent Nerd Vittles Articles of Interest…
- The included applications are licensed pursuant to GPL2 with the exception of nv-worldwide-weather.php which is licensed pursuant to The MIT License. Terms and conditions of both licenses are included in /root/COPYING. [↩]