Rate this page:

IVR module basics

The IVR module is a helper module to provide your apps with IVR functionality. Of course, you implement IVR functionality on a lower level via the Call.say, Call.startPlayback, and Call.handleTones methods, but this module gives you more straightforward approach.

To use the IVR module, add the following line to your scenario code:

require(Modules.IVR);

You can use all this module's functions, events, and classes only after this line.

This module supports 4 types of IVR states:

  1. Prompt with no input:
Prompt with no input example

Prompt with no input example

The nextState property defines the state that IVR transits to after the prompt is played successfully. If it is not specified, the onInputComplete callback is invoked.

  1. Selection menu. Specify voice prompts and next states to transit for each specific input:
Selection menu example

Selection menu example

In this example, if a customer presses 1 or 2, IVR proceeds to the state2, and if one presses 0, state1 loops. Pay attention to the last line — you can find more information in the IVRSettings API reference.

  1. Fixed length input. You can use it if you the need user to enter, for example, an extension number and you know the exact length of desired input.
Fixed length input example

Fixed length input example

  1. Variable length input. You can use it when you do not know how many digits need to be entered. In this case, the data input needs to be finished by pressing a button, for example, "#":
Variable length input example

Variable length input example

An alternative variant is to check input every time the user presses any digit and see if it is suitable. For example, the input may be considered correct when the user presses the same digits 2 times in a row:

Check input every time

Check input every time

Here is an IVR example that prompts the customer for a 3-digit extension number. On timeout route call to queue, on success call a local user:

IVR scenario example

IVR scenario example

Refer to the Building an IVR article for a complete step-by-step guide on how to build an IVR.