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.