FOP2 IVR Flow module allows you to create interactive voice response systems (IVR) or other type of call flows and interactions using a simple drag and drop interface. It can interface with external APIs to gather data and select branches based on logic conditions, time conditions, selected options or spoken words via asterisk speech capabilities.

To do so, it has a pallette of block types you can drag and drop into the canvas so you can construct call flows and logic visually and in a simple manner.

What you'll learn

What you'll need

As there are many block types, they are grouped into categories to make it simpler to locate them. Categories are shown on a left sidebar, and when clicked they will expand to show each block type on them (while collapsing the other category that was open previously)

Available cagegories are:

In the following steps we will dig into each category to see what block types are available in them

In the Destinations category we have blocks that will send the caller to some place, either outside the flow or to some other block in the same flow

Go To

This block will send the caller someplace else in the PBX. Destinations could be extensions, voicemail boxes, queues, conferences, other IVRs, other Flows, etc. All of the available destinations from your PBX that can be accessed will be listed as a valid destination to send the caller to. When clicking on the block to access it properties you will be presented with a select box with all of those destinations to chose one of them.

Hangup

This block will hangup the call right away. Take into account that any leaf node (that is, a block that has no children and is not a destination kind of block, will terminate the call once it is reached)

Jump

Some times you need the flow to go some place else in the same IVR/Flow. This block type allows you to do so. When clicking on it to enter its properties, you will be presented with just one text field where you should use the node number you want the flow to continue. Not all block types can be selected as a jump destination. If that is the case you will get a warning error. When you select a correct and allowed node number, a blue line will connect the blocks to indicate where the jump is being done.

In this category you will find blocks that gather input data from the caller, either via DTMF or Speech.

Capture Data

This block will capture/read digits from the caller using DTMF and will store whatever was entered into a variable. This node will automaticallly add a Timeout child to it that will be followed if the user fails to enter full data after the configured timeout is reached. When clicking on the block to set its properties, you will be able to fill:

Options Menu

This block will present a menu of options to chose from to the user. It's the heart of an IVR system. When added into your flow, it will automatically add a Timeout child and also an Invalid child, as the set of options to be chosen from might be limited and you have to catch possible errors or mistakes. Properites for this block are:

Chosen Menu Option

This block must be added as an Options Menu child, next to the Invalid and Timeout ones. It is used to take the branch when the user enters some digit, patter or says something.

When clicking on it to open its properties, you can set:

As mentioned above, not only a single digit can be used, but also a number of any lenght or an asterisk dialplan patterns. A pattern starts with an underscore and has a regular expression feel to it. Example of patterns you could use:

When selecting options, and if the menu has Direct Dial enabled, you must be sure to avoid collitions between valid extensions and option numbers

One of the most powerfull features of this module is the ability to interact with external systems using API calls either to set or get data and use that to take specific paths based on external data.

There are just two block types, but the first one has many different options to set.

API Call

This blocks allows you to do such calls, there are four supported API Call types:

Asterisk DB

ASTDB is a popular way to store persistent information in a simple key/value pair manner. This type lets you perform read, write and delete operations on the Asterisk Database (ASTDB).

The Operation select box lets you chose the operation to perform.

For the Read operation you have two parameters to set:

For the Read operation you have two parameters to set:

The Delete operation has just one field to fill, the Delete Key one, where you can specify the ASTDB family/key route. As the other operations, you can always use variables to construct the key.

URL

This type lets you perform an HTTP request to any server in a variety of methods, described in its parameters:

AGI Script

This type lets you call an arbitrary AGI script. Usually you will set channel variables in this script so you can evaluate them later and take logic paths based on their values. If the AGI accepts parameters, just enumerate them using commas.

SQL

This block lets you run al SQL query. The system is hardcoded to run an ODBC function named SQL. Such function already exists on Issabel systems and will be able to contact to the "asterisk" database and perform queries on any table in such database. It is possible to modify the ODBC function to use a different DSN connection, but that configuration is up to you to make such modifications. For FreePBX it is possible to create ODBC functions also, here is how such function looks like:

/etc/asterisk/odbc/additional.conf

[SQL]
dsn=asterisk
readsql=${ARG1}

Inside /etc/asterisk/res_odbc_additional.conf the available connctions are listed. And the actual DSNs are defined in /etc/odbc.ini

The parameters to set in this type are:

Write in Queue Log

This block type allows you to add lines into the asterisk queue_log file. This file is used to track usage of Asterisk queues. You can use this feature to write special events into the queue activity log file that can be then reported or linked to existing reports via Asternic Call Center Stats PRO. You can use this to add satisfaction survey results or similar.

The parameters to set on this block when clicked are:

To integrate with Asternic Call Center Stats PRO there are some special events that you can use to update data in existing tables or insert records into tables. An example for inserting an entry into a new table named "survey" in the "qstats" database would be the following:

Uniqueid: ${UNIQUEID}
Queue: stats.survey
Agent: score
Event: INSERT
Additional Info: ${SCORE}

From the above example, the SCORE variable should be set before via menu option, api call, or data capture.

Blocks in this cateogry are used to play audio files or data to the caller.

Playback

This block will play any system recording set by the admin available on the PBX. You should made the recordings available before so they appear for selection in this block. The only parameter to set is Audio to select from the recording from the list.

Say

This block will be able to say digits, numbers or alpha using native PBX recorded sounds. Properites for it are:

TTS Speech

This block lets you use Text to Speech to convert any text entered into spoken words using the configured TTS engine (available from FOP2 Manager - Plugins - IVR Flow Settings). There are two parameters to set:

Blocks that can set and evaluate variables, and conditions to branch based on logic or time.

Evaluate Variable

This block let you specify what variable you want to evaluate in the following Logic Condition blocks. The only paramter to set is the variable name, should be entered as is, not with the asterisk formatting with ${}

Set Variable

This blocks let you set a variable to any value. Whenever you add this block a children will be automatically added with the default condition, that is, the path that will be taken if no other logic condition matches. You have two properties:

Here is an example on how to increment a counter

Variable: COUNTER
Value: $[${COUNTER}+1]

Asterisk function are varied and powerful, and vary from Asterisk version to version. You might want to refer to Asterisk documentation to see what you have available.

Logic Condition

A Logic condition block will compare the variable specified in the parent Evaluate Variable block with the operator and value you chose. The options to set are:

-Condition: Either greater than, less than, greater or equal, less or equal, equals or contains -Value: The value to compare with

If there is a match, then that block branch will be taken. Order of evaluation is done from left to right, so if any logic condition to the left matches, then it won't compare with other conditions set to the right.

Time Condition

This block allows you to branch based on any given time group defined on the PBX. When added, two children are added automatically: True and False, those are the branches that will be followed if the time matches or not the configured date times on the time group.

There is just one setting for this block, the list of defined time groups in your PBX, or the option to select Always True or Always false if you want to override the time for some reason and always take the chosen branch without the need to alter the diagram itself.

Wait

This block just adds a wait in the call processing. The property is the time in seconds to wait before continuing to the next block.

Congratulations! You now know all the block types available in the IVR Flow module. Combining them you can create really powerful voice automation scripts that can perform a variety of task.

You could even use the module just to query apis and do logic branching based on results without any user input (Like doing priority queuing for VIP clients).

Further reading