Gather DTMF (Keypad)
If you hadn't yet read the intro part of this section, please click here to read it first.
Preface
Dealing with DTMF Input (click the phone keypad) will normally require more than a single scenario. One scenario will serve to actual CXML call flow, while the other scenario will process the input and potentially provide a new CXML call flow.
For the purpose of this tutorial, we will implement a simple IVR menu. To do so, we'll build two scenario, as described below:
Scenario Name | Description | Scenario Type |
---|---|---|
Main Menu | This will be the scenario that plays back our welcome message and waits for a DTMF input | Attached |
Menu Processor | This will analyse the selection, and provide a new CXML response based on it. | Detached |
You must first create your Menu Processor scenario, before creating your Main Menu scenario. The reason is that the Main Menu scenario will need to be aware of the Menu Processor, and thus, it MUST be defined first.
Scenario Diagram: Menu Processor

Our scenario includes 3 different modules, according to table below:
# | Module | Description |
---|---|---|
1 | Detached Voice Application | This is the Voice Application webhook. |
2 | Voice Application Response | Render the module output for execution. |
Each of the modules will generate one part of the CXML document to be returned, while the response will assemble all parts to a single rendered response.
Our Router will examine the inbound request "Digits" values, which will contain the value of the keypress from the caller. The Router branches are filtered as following:

Where each of the branches affectively executes a Make a Call module, to call a specific destination.
Scenario Diagram: Main Menu

Once a Router branch as been selected, the
Our scenario includes 5 different modules, according to table below:
# | Module | Description |
---|---|---|
1 | Attached Voice Application | This is the Voice Application webhook. |
2 | Say Something | Generate a Text-To-Speech Message. |
3 | Gather Input | Gather a keypad input from the caller. |
4 | Make a Call | Dial a remote location. |
5 | Voice Application Response | Render the module output for execution. |
Each of the modules will generate one part of the CXML document to be returned, while the response will assemble all parts to a single rendered response.
Scenario Modules Setup
[2] Say Something (Text-To-Speech)

The above module will produce the following CXML directive:
<Say voice="woman">Welcome to our company, please select one of the following options.
For sales, press 1. For support, press 2. For any other inquiry, please press 9 or
wait for the operator.</Say>
[3] Gather Input

The above module will produce the following CXML directive:
<Gather action="a remote make endpoint URL for the 'Menu Processor'">
<Say voice="woman">Welcome to our company, please select one of the following options.
For sales, press 1. For support, press 2. For any other inquiry, please press 9 or
wait for the operator.</Say>
</Gather>
[4] Make a call

The above module will produce the following CXML directive:
<Dial callerid="inbound caller ID">10000</Dial>
[5] Voice Application Result

The above module will produce the following CXML directive:
<Response>
<Gather action="a remote make endpoint URL for the 'Menu Processor'">
<Say voice="woman">Welcome to our company, please select one of the following options.
For sales, press 1. For support, press 2. For any other inquiry, please press 9 or
wait for the operator.</Say>
</Gather>
<Dial callerid="inbound caller ID">10000</Dial>
</Response>
Workflow
When a call initates a call to Cloudonix, the Voice Application to be executed first, will be the Main Menu. Once the caller clicked the keypad (or lack of selection), the call control will be passed to the Menu Processor scenario, which will in turn, process the request and route the call accordingly.
References
Module: Attached Voice Application
Module: Say Something
Module: Gather Input
Module: Make a call
Module: Voice Application Response