A2Billing – Integrating IVR’s into the Family Phone System
Today – I want to change my mom’s inbound telephone line to include an IVR.
Since Mom has an accountant to handle her bills and finances, we want calls related to those things to go to the accountant, and not reach mom and get her agitated. (This type of agitation tends to spread to everyone around. Not good.
)
At the same time, we don’t want to break our nice new A2Billing setup either.
Here are the design goals:
- Route Moms inbound calls to an IVR
- The IVR has two choices, talk to the accountant, or talk to Mom
- Billing must not be broken.
Here’re the basic steps we will take to get there from here.
- Create the IVR
- Create a Dial Plan, and Custom Destination to provide a call path to the accountant
- Create a misc application to provide a path to the IVR
- Create a Rate Card to the new IVR destination
- Edit the A2B Destination for Mom's DID
Overview
We presume you already have built up your system, and that the DID we are working with is already routed to an end user successfully and working fine with A2Billing. If not, don’t bother proceeding now, as it won’t magically start working just because we are adding the IVR.
To accomplish our goals, virtually none of the call flow between FreePBX and A2Billing need be changed.
Essentially, the inbound call flow for the DID stays the same.
In the case of an inbound DID call, the Rate Selection Rule in A2B finds the destination extension to be a complete (or
longest) match in the Ratecard created for that extension. That Rate Card is associated with the Local Destination Trunk. The Local destination trunk sends the call back to FreePBX to delivery to the
destination configured in A2B for the DID. The presence of the IVR changes nothing in this call flow.
The ONLY change to call flow, is the A2B destination for the DID is changed to the extension of the IVR, instead of Mom’s actual extension.
The accountant is available by URI - so we’ll set up a simple dial plan that goes directly there.
Step 1: Create the Accountant Call Path
Add the Dial Plan Fragment
In FreePBx config edit, in extension_override_freepbx.conf, add the following context. (I usually add to the bottom of the file to avoid other contexts.)
[accounting]
exten => s,1,Dial(
sip/[email protected])
(Where xxx and yyy are replaced to from your valid URI)
Note that you could use any valid dial syntax here – including PSTN calls if that’s all your accountant has.
Add the Custom Destination
In FreePBx Custom Destinations, Add a custom destination with the following characteristics:
Custom Destination:
accounting,s,1
Description:
Accounting
When you have all the settings as described, save your changes, apply configuration changes, and continue with reload.
Step 2: Create the IVR Sound File
The IVR will play a recording telling folks to press one if they are calling about busniees, and 2 if they want to talk to Mom. Because we have Cepstral, we want to create the IVR announcement using Allison’s Voice.
Prepare the sound files.
To create the IVR announcement you can record them in your own voice, or create them with swift (Cepstral) or flite. To use flite/swift, create a text file containing the things you want spoken.
The following example includes the use of Cepstral’s mark up language which allows you to alter the way the text is spoken. To use this example with flite, simply remove the htm-like code, leaving it to be plain text.
moms-ivr.txt should contain text something like this:
<break strength='strong' />Hello - you have reached the Smith residence.<break strength='medium' />
If you are calling to discuss financial concerns, bill payments, or money matters of any kind, please press 1 now.<break strength='medium' />If you are calling to speak to the Smiths, please press <emphasis level='strong'> 2 </emphasis> now.
Upload the moms-ivr.txt file to your pbx. I use winscp, and place them in /root.
Log into your pbx (I use putty), and cd /root
Flite and swift have the same syntax. From putty:
Code:
[FONT="]swift -f moms-ivr.txt –o moms-ivr.wav[/FONT]
[FONT="]or [/FONT]
[FONT="]flite -f moms-ivr.txt –o moms-ivr.wav[/FONT]
Step 3: Upload the sound file to System Recordings.
The next step is to move the wav file we created in step 2 back to your local PC. No reason to let them build up in the /root folder. I use winscp to move them back to a storage folder on my pc.
NOTE: In Step 4, we use a neat effect in the IVR, for which it will be easiest if we have TWO COPIES of the moms-ivr.wav file. Once you have moved the file back to your PC, make a second copy of it named moms-ivrr.wav
Once you have both copies of the wave file ready, use the FreePBX System Recordings function to upload them. Leave the files named as they are.
Step 4: Create Composite IVR Timeout Message
We would like the IVR message to repeat once if the caller does not respond, in case they weren’t paying attention the first time around. But I also want to add some additional words to the effect – “Hey – you need to press a button” before repeating the IVR sound file.
To do that, well use a neat feature of FreePBX that I call
composite system recordings. In step 3, above, we created and uploaded 2 identical copies of the IVR wave file (moms-ivr, and mom-ivrr). We will use moms-ivr.wav for the first time the IVR plays.
Now lets make a
composite system recording response to play during the replay(s) of the IVR sound file.
Using FreePBX System Recordings locate and select the moms-ivrr file on the list.
Under the files section, click the blue down-arrow 3 times to open up 3 blank lines above it.
Using the drop down box, locate the following sound files, and select them, one for each blank box we created in the Files section:
Top Box:
talking-to-myself
Second Box:
sorry-your-having-problems
Third Box:
please-try-again
The fourth box should already have
moms-ivrr listed. When you have all the files arranged as described, save your changes, apply configuration changes, and continue with reload.
Step 5: Create the IVR
In FreePBX, Setup, IVR, select Add IVR. Create an IVR with the following characteristics:
Change Name: Smith-IVR
Announcement:
moms-ivr
Timeout:
7
Enable Directory:
NO / Unchecked
VM Return to IVR:
NO / Unchecked
Enable Direct Dial:
NO / Unchecked
Loop before t-dest:
YES / Checked
Timeout message:
moms-ivrr
Repeat Loops:
2
In the Options area, use the following Destinations:
Keypress: 1
Custom Destination:
Accounting
Keypress: 2
Extensions:
Mom’s Extension
Keypress: t
Terminate Call:
Congestion
When you have all the settings arranged as described, save your changes, apply configuration changes, and continue with reload.
Step 6: Add Misc Application
Because A2B will need to be able to route calls to the IVR, the IVR needs to be assigned a dialable number. In FreePBX, Setup, Misc Applications, Select Add Misc Application.
Create the Misc application with the following characteristics:
Description:
Smith IVR
Feature Code:
any valid extension (keep the 10xx pattern to maximize a2b integration ease.)
Feature Status:
Enabled
Desitnation:
IVR: Smith-IVR
When you have all the settings arranged as described, save your changes, apply configuration changes, and continue with reload.
Step 7: Configure A2Billing
In FreePBX, we leave the inbound route for Mom’s DID going directly into A2B. Inside A2Billing, we need to make a couple of alterations. This assumes you have your system set up as per the rest of this 6 Part thread.
Add Rate Card
Before A2B can route calls to mom’s IVR, it has to have a valid rate for that destination.
From inside the A2B admin webui, under RATE CARD select add rate. Create a rate with the following characteristics:
RATECARD:
Local Destination
DIAL PREFIX:
Your IVR Extension (Feature Code used in step 6)
DESTINATION:
Mom’s10 digit DID
BUY RATE, BUYRATE DURATION, BUYRATE BILLING BLOCK, and the corresponding SELL RATES need to be set to the values you have determined are appropriate for this inbound DID. (As you did when you created the inbound DID billing function in previous parts of this article.)
When you have all the settings arranged as described, save your changes with CONFIRM DATA.
Modify Destination
Now, we must tell A2B to route Moms inbound calls to her new IVR, instead of directly to her extension.
While still in the A2B admin webui, under DID, select List Destination. Locate the destination for Mom’s DID, and select EDIT.
On the DESTINATION line, change the value from Mom’s extension, to the
IVR Extension (Feature Code used in step 6), and CONFIRM DATA.
If everything has gone well for you – when you call the DID, you are greeted by your IVR, and A2B is rating the call normally. Since this works, my mind has been going overboard coming up with cool reasons to use IVR's within our hybrid FreePBX/A2Billing Family Phone System.
I'd be very interested to know how
you use the IVR integration with A2Billing. :chefb:
Until Next time -