PIONEERS NEW: TTS Apps for PIAF5 & 3CX

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
20,217
Reaction score
5,974
With a little luck, we hope to have the Yahoo News Headlines and NWS Weather by ZIP Code apps ready for the 3CX pioneers this weekend. These work a little differently than in Incredible PBX builds... but they work great using IBM's Bluemix TTS Engine for the TTS component. In a nutshell, you run a cron job periodically to scoop up your local weather report and news headlines. Then anyone on the 3CX PBX can dial 947 for a weather report or 951 for news.

If you don't yet have an IBM account set up, now's the time. Instructions are included in this Nerd Vittles tutorial.
 
Last edited:
FOR THE PIONEERS: Here's How 3CX TTS Apps Work

Currently, there is no 3CX support for interactive TTS or STT applications. 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 report 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 Weather by ZIP Code report by dialing 947 or Worldwide Weather report by dialing 949. Here's how to proceed once you have your IBM account set up and have obtained your IBM TTS credentials as well as your free APIXU API key.

1. 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 two WAV files that we will use as placeholders in 3CX for current News Headlines and Weather reports.

2. 3CX Initial Setup from 3CX Dashboard (using web browser)

Before you can implement the Nerd Vittles TTS Apps for News Headlines and 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. To begin, we need to set up three Digital Receptionist extensions, one for the News Headlines and two for the Weather reports.

Login to your 3CX Dashboard with a browser. 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.

From the 3CX Dashboard, choose Digital Receptionist then Add. Fill in the blanks like this:

Name: Worldwide Weather
Extension: 949
Prompt: wwweather.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 Worldwide Weather Digital Receptionist.

Try things out by dialing 947, 949, and 951 from any 3CX extension. Be sure these work before proceeding!

3. 3CX Setup from Linux CLI (login as root using SSH/Putty)

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:
Code:
apt-get update
apt-get -y install php5-fpm php5-curl php5-cli php-pear php-db php5-gd sqlite3 libsqlite3-dev
sed -i 's|;cgi.fix_pathinfo=1|cgi.fix_pathinfo=0|' /etc/php5/fpm/php.ini
systemctl restart php5-fpm

Next, we need to put the Nerd Vittles scripts and ZIP code database for SQLite 3 in their proper places:
Code:
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, 6:20 am, and 6:25 am every day. Adjust to meet your own requirements.
Code:
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. Configuring the Applications

Next, we need to add your IBM and ApiXU API credentials, email address, a local ZIP code for U.S. weather reports and a city for international weather reports. Edit the credentials file and save it:
Code:
cd /root
nano -w ibm-credentials.php

5. Updating the News Headlines and Weather information

We need to run the News Headlines and two Weather 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.
Code:
cd /root
./nv-news-update.sh
./nv-weather-update.sh
./nv-wwweather-update.sh

6. Taking the TTS Apps for a Spin

From any phone connected to your 3CX PBX, try out the News Headlines (951) ,Weather by ZIP code (947) and Worldwide Weather (949) applications.
 
Last edited:
Nerd Vittles article will be available tomorrow.

All of our code is licensed pursuant to GPL2; however, ApiXU license terms apply to nv-worldwide-weather.php script:

The MIT License (MIT)

Copyright (c) 2015 Apixu.com

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
 
Last edited:

Members online

No members online now.

Forum statistics

Threads
26,687
Messages
174,410
Members
20,257
Latest member
Dempan
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Back
Top