Rate this page:

IVR usage example: multi-level menu

Most of IVRs nowadays provide a caller with several options that can be chosen in a multi-level menu. While this kind of IVR can be built using vanilla VoxEngine javascript code, it's better to use a helper module (Modules.IVR) we created to simplify the process. It lets developers build IVR menus in scenarios much faster and write less code for that. Let's build the following IVR using the module:

It's rather simple but has many input types: noinput, select, inputfixed, and inputunknown. VoxEngine scenario for this IVR menu:

Scenario code

Scenario code

This works exactly as it appears: IVR suggests a caller choose one of the options:

  • Press 1 to know the current time. Nothing else.
  • Press 2 to enter an extension number of an employee. In the code above, it can be only the "100" extension, as specified in lines 45-47. If "100" is specified, a scenario will try to make a PSTN call to the number specified in line 136. It should be a rented Voximplant number.
  • Press 3 to forward a call to any real phone number. After choosing this option, a caller should enter a valid phone number and press pound.

If you want your scenario to recognize human speech and act depending on what people say (not press on the keypad), please read our ASR howto for details.

Setup: Application, Scenario, and Rule

Go to the Applications section of the Voximplant Control panel, create an IVR application and an IVR-scenario inside it. Then create an IVR-rule in the Routing tab of the application with the following settings:

Setup: phone number

Now you have to rent 2 numbers: the first one is to test the scenario, the second one is to use as Called ID when forwarding a call.

Phone numbers and verification

While technically no source phone is involved in calling a target phone number from the cloud, some phone number should be displayed to the callee so that they can call back. It's better to specify a number rented from Voximplant for this purpose.

Please note that a valid address is required in some locations where the number is being purchased. And to use a Russian phone number, you need to pass verification.

Switch to the Numbers section, click Buy new phone number and choose 2 numbers: a test number and a real one. Pass verification if needed.

Finally, associate phone numbers with your application. Go to Applications again, click on the IVR application and switch to the Numbers tab. Choose Available and attach phone numbers to this application and the IVR-rule.

Now all incoming calls to the test number will be forwarded to the IVR-scenario and processed by it. Test it!