Home » Incredible PBX » CentOS/SL Platform » Introducing Incredible PBX Custom Contexts for VitalPBX

The Most Versatile VoIP Provider: FREE PORTING

Introducing Incredible PBX Custom Contexts for VitalPBX

Last week we introduced Incredible PBX for VitalPBX 2.3.8 to the Asterisk® community. And today we’re pleased to present the first of many Incredible PBX® add-ons, Allison’s DEMO IVR featuring text-to-speech and voice recognition utilities that take your Asterisk PBX to a whole new level. When we’re finished, you’ll have Headlines News, Weather Reports, Today in History, Wolfram Alpha, Voice Recognition apps to call people in your AsteriDex phonebook and to call anyone else by simply speaking the number to dial, and good ol’ Lenny, the Telemarketer’s Worst Nightmare. We’ll utilize a single custom context to harness the power of 11 Asterisk utilities using an easily configurable Interactive Voice Response (IVR) interface. Last week, VitalPBX released a new Custom Contexts module that has no limitations on the number of contexts you can create for free. But, for today, we’ll do it the old-fashioned way just to demonstrate what’s possible. And it’s pure GPL code.

Prerequisites. Before deploying the Incredible PBX components, you’ll need to install VitalPBX on a platform of your choice behind a hardware-based firewall. You’ll need to add an extension 701 where you can receive calls on a softphone or SIP phone, and you’ll need at least one SIP trunk to make and receive calls from those not connected to your PBX. The Outbound Route for this trunk must support 10 and 11-digit calls in the following formats: NXXNXXXXXX and 1NXXNXXXXXX. You’ll also need to install the Custom Contexts add-on to VitalPBX and then configure the (free) Custom Context for use by the Incredible PBX add-ons. The Inbound Route for at least one of your trunks must send calls to this new Incredible PBX Custom Context. Our previous tutorial will walk you through the setup steps for all of this.

In the VitalPBX GUI, navigate to PBX:Applications:Custom Applications and add a new 3366 (D-E-M-O) application for the Incredible PBX Demo IVR. Make it look like the following. Save your entries and Reload your dialplan when you’re finished.

In the VitalPBX GUI, navigate to PBX:Applications:Conference and add a 2663 (C-O-N-F) conference that looks like the following using PINs of your choice for participants and the conference leader. Save your entries and Reload your dialplan when you’re finished.

Finally, navigate to Settings:Technology Settings:SIP Settings:OTHERS and set SRV Lookups to YES. Save your settings and reload the dialplan.

Obtaining IBM Watson TTS and STT Credentials

Incredible PBX uses IBM Watson® for TTS and STT support. This Nerd Vittles tutorial will walk you through getting your IBM account set up and obtaining both your TTS and STT credentials. Be sure to write down BOTH sets of credentials which you’ll need in a minute. For home and SOHO use, IBM access and services generally is FREE even though you must provide a credit card when signing up. Details are provided when you sign up. If you ever forget your passwords, you can retrieve them by navigating to Watson:ExistingServices:TTS or STT:View Full Details:Show Credentials.

Obtaining Wolfram Alpha Credentials

When people ask what exactly Wolfram Alpha is, our favorite answer was provided by Ed Borasky.

It’s an almanac driven by a supercomputer.

That’s an understatement. It’s a bit like calling Google Search a topic index. Unlike Google which provides links to web sites that can provide answers to queries, Wolfram Alpha provides specific and detailed answers to almost any question. Here are a few examples (with descriptions of the functionality) to help you wrap your head around the breadth of information. For a complete list of what’s available, visit Wolfram Alpha’s Examples by Topic. Type a sample query here. Some of our favorites include:

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 2012 (summary of all holidays for 2012 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 2012 (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)

Before you can actually use our TTS implementation of Wolfram Alpha, you’ll need to obtain a free Wolfram Alpha account. As you can imagine, there have to be some rules when you’re using someone else’s supercomputer for free. So here’s the deal. It’s free for non-commercial, personal use once you sign up for an account. But you’re limited to 2,000 queries a month which works out to almost 70 queries a day. Every query requires your personal application ID, and that’s how Wolfram Alpha keeps track of your queries. Considering the price, we think you’ll find the query limitation generous compared to other web resources.

To get started, sign up for a free Wolfram Alpha API account. Just provide your email address and set up a password. It takes less than a minute. Log into your account and click on Get An App ID. Make up a name for your application and write down (and keep secret) your APP-ID code. That’s all there is to getting set up with Wolfram Alpha. If you want to explore costs for commercial use, there are links to let you get more information.

Installing Incredible PBX Components

To install the Incredible PBX components on your VitalPBX server, login to your server as root and issue the following commands:

# on VitalPBX 3.x servers only, issue next 2 commands:
ln -s /etc/asterisk/vitalpbx /etc/asterisk/ombutel
ln -s /usr/share/vitalpbx /usr/share/ombutel

cd /
yum -y install dialog wget nano tar mailx
cp -p /etc/crontab /etc/crontab.bak
wget http://incrediblepbx.com/incrediblepbx-vitalpbx.tar.gz
tar zxvf incrediblepbx-vitalpbx.tar.gz
rm -f incrediblepbx-vitalpbx.tar.gz
chown asterisk:asterisk /var/lib/asterisk
chown asterisk:apache /var/lib/asterisk/agi-bin
/etc/init.d/asterisk restart

The GPL3 license for all of the Incredible PBX components is available for review in /root/COPYING.

Configuring Your Incredible PBX Credentials

In addition to your Wolfram Alpha APPID, there are two sets of IBM credentials to plug into the Asterisk AGI scripts. Keep in mind that there are different passwords for the IBM Watson TTS and STT services. The TTS credentials will look like the following: $IBM_password. The STT credentials look like this: $API_PASSWORD. Don’t mix them up. The username for both TTS and STT is now the single word: apikey

All of the scripts requiring credentials are located in /var/lib/asterisk/agi-bin so switch to that directory after logging into your server as root. Edit each of the following files and insert your TTS credentials in the variables already provided: nv-today2.php, ibmtts.php, and ibmtts2.php. Edit each of the following files and insert your STT credentials in the variables already provided: getquery.sh, getnumber.sh, and getnumber2.sh. Finally, edit 4747 and insert your Wolfram Alpha APPID.

If you ever want to learn how to develop applications for Asterisk, these scripts coupled with the dialplan code included in /etc/asterisk/ombutel/extensions__80-1-incrediblepbx.conf will point you in the right direction with easy to follow examples.

Using Asteridex with VitalPBX

AsteriDex is a web-based dialer and address book application for Asterisk and VitalPBX. It lets you store and manage phone numbers of all your friends and business associates in an easy-to-use SQLite3 database. You simply call up the application with your favorite web browser: http://vitalpbx-ip-address/asteridex4/. When you click on a contact that you wish to call, AsteriDex first calls you at extension 701, and then AsteriDex connects you to your contact through another outbound call made using your default outbound trunk that supports numbers in the 1NXXNXXXXXX format.

Before AsteriDex Click-to-Call will work, you must authorize AsteriDex to access Asterisk from your browser. After logging into your server as root, edit the following file in /etc/asterisk/ombutel: manager__50-ombutel-user.conf. For each browser IP address you wish to authorize, add an entry like the following immediately below the existing permit entry in the file. Then reload the Asterisk dialplan: asterisk -rx "dialplan reload"


Taking Incredible PBX for a Test Drive

You can take Incredible PBX for VitalPBX on a test drive in two ways. You can call our server, and then you can try things out on your own server and compare the results. Call our IVR by dialing 1-843-606-0555. For our international friends, you can use the following SIP URI for a free call: 10159591015959@atlanta.voip.ms. For tips on setting up your own secure, hybrid SIP URI with VitalPBX, see our original tutorial. The FreePBX® setup is virtually identical except for the location of the custom SIP setting for match_auth_username=yes. On a VitalPBX server, you will enter it here: Settings:Technology Settings:SIP Settings:CUSTOM.

With Allison’s Demo IVR, you can choose from the following options:

  • 0. Chat with Operator — connects to extension 701
  • 1. AsteriDex Voice Dialer – say "Delta Airlines" or "American Airlines" to connect
  • 2. Conferencing – log in using 1234 as the conference PIN
  • 3. Wolfram Alpha Almanac – say "What planes are flying overhead now?"
  • 4. Lenny – The Telemarketer’s Worst Nightmare
  • 5. Today’s News Headlines — courtesy of Yahoo! News
  • 6. Weather by ZIP Code – enter any 5-digit ZIP code for today’s weather
  • 7. Today in History — courtesy of OnThisDay.com
  • 8. Chat with Nerd Uno — courtesy of SIP URI connection to 3CX iPhone Client
  • 9. DISA Voice Dialer — say any 10-digit number to be connected
  • *. Current Date and Time — courtesy of VitalPBX

CAUTION: We have intentionally disabled outbound calls using Option #9 and redirected callers to Lenny. The reason is that an unscrupulous caller could easily run up your phone bill by entering a number with expensive destination charges. If you wish to enable the feature, despite the risks, you can edit extensions__80-1-incrediblepbx.conf and make the change.

You can call your own IVR in two ways. From an internal VitalPBX phone, dial D-E-M-O (2663) to be connected. Or simply dial the number of the DID you routed to the Incredible PBX Custom Context. Either way, you should be connected to the Incredible PBX IVR running on your VitalPBX server. Be sure that you heed AND test the CAUTION documented above.

Using Incredible PBX Features Independently of IVR

Now that we have some of the Incredible PBX applications in place using the IVR, there may be situations in which you want callers to be able to access the individual components without navigating through the IVR. For example, you may want to let users contact LENNY (53669) directly. There are three steps to do this: (1) add a new Custom Context for the feature desired, (2) add a new Custom Application with the number to associate with the application, and (3) add a snippet of dialplan code to extensions__80-custom.conf redirecting the Custom Context to the matching IVR priority. Then reload Asterisk dialplan.

For the new Lenny Custom Context, here are the entries:

Description: Lenny
Context: lenny
Extension: s
Priority: 1
Destination: Terminate Call -> Hangup

For the new Lenny Custom Application, here are the entries:

Code: 53669
Name: Lenny
Enabled: Yes
Destination:  Custom Contexts -> Lenny

In /etc/asterisk/ombutel/extensions__80-custom.conf, add the following dialplan code and reload the Asterisk dialplan: asterisk -rx "dialplan reload"

exten => s,1,NoOp(Lenny)
 same => n,Answer
 same => n,Goto(incrediblepbx,53669,1)

Let’s walk through one more example to be sure you get the hang of it. To mimic the News Headlines (951) setup on other Incredible PBX platforms, here are the steps:

For the News Custom Context, here are the entries:

Description: News
Context: news
Extension: s
Priority: 1
Destination: Terminate Call -> Hangup

For the News Custom Application, here are the entries:

Code: 951
Name: News
Enabled: Yes
Destination:  Custom Contexts -> News

In /etc/asterisk/ombutel/extensions__80-custom.conf, add the following dialplan code and reload the Asterisk dialplan: asterisk -rx "dialplan reload"

exten => s,1,NoOp(News)
 same => n,Answer
 same => n,Goto(incrediblepbx,5,1)

Coming Events. We still plan to address security for those that want to deploy this terrific platform in the cloud. And we’re already working on a new version of CallerID Superfecta for VitalPBX that will let you use OpenCNAM to associate names with CallerID numbers. You can follow our progress and offer suggestions on the PIAF Forum.

Originally published: Monday, October 14, 2019

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. I am interested in Voicemail transcriptions within VitalPBX and I thought the IBM TTS would provide that, but I am not seeing where that can be set up.

    [WM: As you probably know, VitalPBX is closed source. Unfortunately, there is no current way for us to integrate voicemail transcription. One workaround would be to forward calls to a Google Voice trunk and let Google handle the voicemail transcription for you.

    Update: I passed this along to the VitalPBX folks, and they’ve solved it in less than a day! We’ll write it up on Nerd Vittles very soon.]

  2. Is the "CAUTION" warning about the DID for outbound calls due to the closed source as well? Because Travelin Man isn’t included? I am looking into a simple ipbx for a small office and VitalPBX looked good to be installed on a VPS, but this concerned me a little, after I had lost a couple of bugs because was hacked on a forgotten test vps installation in the past.

    [WM: The caution concerns some of the Incredible PBX feature set that lets incoming callers "dial back out" of your PBX. While Travelin’ Man IS included, it merely restricts who can access your PBX over the Internet, not by telephone. Anybody in the world can call you if they know your number. So the safest course (if you leave the "call out" features enabled in the IVR) is to use a Google Voice trunk in conjunction with Incredible PBX so that outbound calls from the IVR are limited to those destinations that are actually free.]

Comments are closed.