In our last article, we introduced Incredible PBX® 16-15 featuring Asterisk® 16 and FreePBX® 15 on the new Raspberry Pi 4 with Raspbian 10. But we’re just getting started. Today we want to show off the real power of this $35 on-premise platform with the addition of IBM’s voice recognition software. Your first 500 minutes a month are free. In conjunction with Incredible PBX, you’ll get flawless transcription and email delivery of your voicemail messages plus a voice dialer that lets you call anyone in your AsteriDex phonebook by simply dialing 411 and saying the name of the person or company you wish to call. We’ve got a few more surprises plus some tips for the $5.95 Blinkt rainbow light show that will have your friends drooling with envy. If you haven’t yet installed Incredible PBX 16-15, start there.

Configuring Gmail as Exim Smart Relay Host

Before you can receive voicemail messages by email, your server needs to be able to successfully send email messages. Most Raspberry Pi implementations will be on networks managed by companies like Comcast, Spectrum, and AT&T that block downstream mail servers (that’s you) from sending email. The solution is to use Gmail or your local ISP as a smart relay host to send mail from your server. Here’s how to set it up using a Gmail account without two-step authentication. Log into your server as root and run ./configure-exim-email. Choose "mail sent by smarthost; received via SMTP or fetchmail." Accept all the defaults until you get to Outgoing Smarthost prompt. Enter: smtp.gmail.com::587. At the following prompts, choose NO, NO, mbox, and NO. When the setup completes, edit /etc/exim4/passwd.client and insert the following line using your Gmail AcctName and AcctPW:

*.google.com:AcctName@gmail.com:AcctPW
smtp.gmail.com:AcctName@gmail.com:AcctPW

Save the file and then issue the following commands to complete the setup:

update-exim4.conf
systemctl restart exim4
exim4 -qff

Now send yourself a test email message to make sure things are working properly:

echo "test" | mail -s testmessage yourname@yourmailprovider.com

Some prefer an email notification whenever your server is booted. Once you have configured a relay host above, you can add this feature by editing /etc/rc.local and adding the following lines just above the service knockd start line using your actual email address:

_PRIVATE="Private IP: `cat /etc/hostip | cut -f1-2 -d " "`"
_PUBLIC=" Public IP: `curl -s -S --user-agent \
"Mozilla/4.0" http://myip.incrediblepbx.com | awk 'NR==2'`"
echo "$_PRIVATE\n$_PUBLIC" | mail -s "RasPi 16-15 has booted" yourname@yourmailserver.com


Obtaining IBM Cloud Speech to Text Credentials

Follow this link to set up your IBM account and obtain credentials for both Speech to Text (STT) and Text to Speech (TTS) services. Please note that your STT and TTS API keys will NOT be the same. So don’t accidentally use the wrong one. For today, we’ll need your STT API Key.

Installing STT Engine for Voicemail Transcription

Now we’re ready to deploy IBM’s STT Engine to (1) transcribe your voicemails and (2) deliver them by email. To begin, open the Incredible PBX web GUI with your browser and edit extension 701 under Applications -> Extensions. Click on the Voicemail tab. Enter an Email Address for delivery of your voicemails. Set Email Attachment, Play CID, and Play Envelope to YES. After testing things out, you may want to actually Delete Voicemails after email delivery, but leave it set to NO for the time being. Click Submit and Apply Config to save your settings.

Next, log into the Linux CLI as root and change to the /usr/local/sbin directory. Then copy the sendmailmp3.ibm file to sendmailmp3: Then edit sendmailmp3.

cd /usr/local/sbin
cp -p sendmailmp3.ibm sendmailmp3
nano -w sendmailmp3

Scroll down to line #21 and enter your actual API_KEY replacing the X’s inside the quotes. Save the file: Ctrl-X, Y, then ENTER. Now call extension 701’s voicemail (*701) and leave yourself a short voicemail message. Within a minute or two, it should be delivered to your email address that you specified for extension 701 voicemails. It will include the voicemail recording as well as a transcription.

Deploying the AsteriDex Voice Dialer

AsteriDex is an open source database that is included in every Incredible PBX deployment. You can access it within the web GUI under the Third Party Addon tab. By default, it includes entries for some of the major airlines. You can create as many additional entries as you wish. Also included with Incredible PBX is a voice dialer that is accessed by dialing 411. You’ll be prompted for the name of the person or company to contact. Once you say the name, the voice dialer will place the call using your default outbound route for 10-digit calls. The missing piece is voice recognition software to transcribe what you say into text that can be looked up in AsteriDex to retrieve the number to call. That’s where IBM’s STT engine enters the picture. To deploy it, start by replacing the 411 context in your dialplan. Then we’ll edit the getnumber.sh shell script and insert your STT credentials.

cd /var/lib/asterisk/agi-bin
sed -i ':// BEGIN Call by Name:,:// END Call by Name:d' \
 /etc/asterisk/extensions_custom.conf
sed -i '/[from-internal-custom]/r /var/lib/asterisk/agi-bin/ibm-411.txt' \
 /etc/asterisk/extensions_custom.conf
asterisk -rx "dialplan reload"
nano -w getnumber.sh

Scroll down to line #13 and make it look like this: API_USERNAME="apikey"

On Line #14, enter your actual API_KEY between the quotation marks replacing the X’s. Then save the file: Ctrl-X, Y, then ENTER.

Now pick up a phone connected to your PBX and dial 411. When prompted for the person/company to call, say "American Airlines."

Move Over Siri. Here Comes Iris.

If the idea of instant access to all the world’s information is appealing but you’re not quite ready to invite Siri, Alexa, and Google into your bedroom, then IRIS may be your cup of tea. With the Incredible PBX implementation of Wolfram Alpha, you simply dial I-R-I-S (4747) from any phone, ask a question, and the world’s greatest almanac tied to a supercomputer will provide you an answer. So long as it’s for non-commercial use, you get 2,000 free queries a month just by signing up for a Wolfram Alpha account. Here’s a sample of what’s available:

Weather in Charleston South Carolina
Weather forecast for Washington D.C.
Next solar eclipse
Otis Redding
Define politician
Who won the 1969 Superbowl? (Broadway Joe)
What planes are flying overhead now? (flying over your server’s location)
Ham and cheese sandwich (nutritional information)
Holidays 2019 (summary of all holidays for 2019 with dates and DOW)
Medical University of South Carolina (history of MUSC)
Star Trek (show history, air dates, number of episodes, and more)
Apollo 11 (everything you ever wanted to know)
Cheapest Toaster (brand and price)
Battle of Gettysburg (sad day 🙂 )
Daylight Savings Time 2019 (date ranges and how to set your clocks)
Tablets by Motorola (pricing, models, and specs from Best Buy)
Doughnut (you don’t wanna know)
Snickers bar (ditto)
Weather (local weather at your server’s location)

Deploying IRIS is simple. Once you have your Wolfram Alpha APP-ID, edit the 4747 file in /var/lib/asterisk/agi-bin and insert your APP-ID in the first line of the file. Then save it. In the same directory, edit wolfram.sh and enter apikey for your API_USERNAME, your actual IBM STT API key as your API_PASSWORD, and reenter your Wolfram Alpha APPID. Then save the file. Now dial I-R-I-S (4747) from any phone and ask one of the sample questions above.

UPDATE: A bug crept into the Wolfram Alpha scripts somewhere along the way. Here’s the fix, but you don’t need to install it. Simply log out and back into your Raspberry Pi as root, and the Automatic Update Utility will install it for you.

cd /var/lib/asterisk/agi-bin
sed -i 's|results.chr(13).chr(10);|results.chr(13).chr(10).chr(34);|' 4747.php

Using Allison’s Demo IVR for Feature Set Access

Rather than remembering all of the dial codes we’ve documented above, the easiest way to get instant access to all the features we’ve discussed plus more is to dial D-E-M-O (3366) from any phone connected to your PBX. Better yet, you can share the feature set with your friends by configuring the Demo IVR as the Inbound Route Destination for one of your DIDs. Be careful sharing your password for Telephone Reminders to avoid having some creep schedule multiple reminders to make expensive calls to some ship in the middle of nowhere.

Updating pbxstatus to Support NeoRouter

If you have deployed the NeoRouter VPN on your server, you’ve probably noticed that the pbxstatus display looks a bit awkward now since there are multiple local IP addresses. Here’s the fix. Edit /usr/local/sbin/pbxstatus. Scroll down to line #6 and replace it with the following. Then save the file.

_IP=" Private IP: `cat /etc/hostip | cut -f1-2 -d " "`"

Adding Blinkt for Non-Blacklisted Incoming Calls

If you deployed the Blinkt hardware addition following our last tutorial, we wanted to add an additional feature that will provide visual alerts when incoming calls arrive. Here’s how:

cp -p /root/rainbow.py /usr/local/sbin/.
echo "asterisk ALL = NOPASSWD: /usr/local/sbin/rainbow.py" >> /etc/sudoers
echo '[app-blacklist-check]
include => app-blacklist-check-custom
exten => s,1(check),GotoIf($["${BLACKLIST()}"="1"]?blacklisted)
exten => s,n,Set(CALLED_BLACKLIST=1)
exten => s,n,System(/usr/bin/sudo /usr/local/sbin/rainbow.py &)
exten => s,n,Return()
exten => s,n(blacklisted),Answer
exten => s,n,Set(BLDEST=${DB(blacklist/dest)})
exten => s,n,ExecIf($["${BLDEST}"=""]?Set(BLDEST=app-blackhole,hangup,1))
exten => s,n,GotoIf($["${returnhere}"="1"]?returnto)
exten => s,n,GotoIf(${LEN(${BLDEST})}?${BLDEST}:app-blackhole,zapateller,1)
exten => s,n(returnto),Return()
;--== end of [app-blacklist-check] ==--;
' >> /etc/asterisk/extensions_override_freepbx.conf
asterisk -rx "dialplan reload"




 

Originally published: Monday, August 19, 2019



Need help with Asterisk? Visit the PBX in a Flash Forum.


 

Special Thanks to Our Generous Sponsors

FULL DISCLOSURE: RentPBX, Amazon, Skyetel, Vitelity, DigitalOcean, Vultr, Digium, 3CX, Sangoma, TelecomsXchange and VitalPBX have provided financial support to Nerd Vittles and our open source projects through advertising, referral revenue, and/or merchandise. 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 plus quadruple data center redundancy assures that you’ll never have a failed call. Tutorial and sign up details are here.

VitalPBX is perhaps the fastest-growing PBX offering based upon Asterisk with an installed presence in more than 100 countries worldwide. VitalPBX has generously offered to provide a customized White Label version of Incredible PBX that is specifically tailored for use with Incredible PBX and VitalPBX custom applications. Soon!
 

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.
 


​​3CX is a software PBX that’s easy to install & manage. It includes integrated softphones, WebRTC conferencing and essential add-ons out of the box, at no additional cost. Try the free edition at www.3cx.com. Better yet, download the PIAF5 ISO powered by 3CX. Free version includes support for 8 simultaneous calls with a SIP trunk.

  • Run on Premise or in the Cloud, on Windows and now on Linux
  • Softphones for iOS, Android, Win & Mac
  • Easy install, backup & restore, version upgrades
  • Automatically configures IP Phones, SIP Trunks & Gateways

  • RentPBX, a long-time partner and supporter of PIAF project, is offering generous discounts for Nerd Vittles readers. For all of your Incredible PBX hosting needs, sign up at www.RentPBX.com and use code NOGOTCHAS to get the special pricing. The code will lower the price to $14.99/month, originally $24.99/month. It’s less than 50¢/day.


    Print Friendly, PDF & Email

    Be Sociable, Share!

    Tags:

    This article has 1 comment

    1. Google Home outage hits users, ‘100 percent failure rate’ reported
      https://bgr.com/2017/06/05/google-home-outage-2017-assistant

      After this server issue crippled Google’s Home assistant (and some people could not even turn on the lights), I realized the value of OFFLINE speech recognition. And now we see in the news that recordings are being permanently stored and reviewed by humans for training purposes at all of the cloud-based speech recognition providers. So I would like to bring these offline alternatives to your attention:

      https://pypi.org/project/SpeechRecognition
      https://www.quora.com/What-are-the-top-ten-speech-recognition-APIs
      _____

      "Mozilla researchers aim to create a competitive offline STT engine called Pipsqueak that promotes security and privacy. This implementation of a deep learning STT engine can be run on a machine as small as a Raspberry Pi 3."

      https://research.mozilla.org/machine-learning
      https://blog.mozilla.org/blog/2017/11/29/announcing-the-initial-release-of-mozillas-open-source-speech-recognition-model-and-voice-dataset
      https://voice.mozilla.org/en

      Mozilla DeepSpeech is a TensorFlow implementation of Baidu’s DeepSpeech architecture
      https://github.com/mozilla/DeepSpeech

      "Our word error rate on LibriSpeech’s test-clean set is 6.5%, which gets us close to human level performance."
      — "Yes, this model can be used to do offline speech recognition."

      https://hacks.mozilla.org/2017/11/a-journey-to-10-word-error-rate

      comment:
      if the error rate of IBM’s online engine is 5.5% , you can see how impressive Baidu’s engine is, to achieve a 6.5% error rate on a Raspberry Pi (!)
      ___________

      PS: at first glance I thought the Blinkt device was kind of a gimmick — but now I think I might want that, if I could make each lamp to be an activity indicator for a different extension (plus a couple lights for channel activity on a 2-channel SIP trunk.) This could be helpful for troubleshooting purposes, and would also remind me not to commit any changes in the PBX user interface until all extension & channel activity has ceased. 😉