Collect Dtmf

Collect DTMF from the caller and store it in the call record. Multiple collections can be stored under custom-named keys. Typically collect_dtmf is used with Pivot. Most flows built outside of Pivot use menu.

If you aren’t using Pivot but still want to use collect_dtmf instead of menu, ignore the PHP portions of examples in this document.

Collecting DTMF

The initial 2600Hz JSON to collect DTMF could look something like:

<?php

header('content-type:application/json');

?>
{
    "module":"tts",
    "data":{
        "text": "Please enter up to four digits."
    },
    "children": {
        "_": {
            "module": "collect_dtmf",
            "data": {
                "max_digits": 4,
                "collection_name": "custom_name"
            },
            "children": {
                "_": {
                    "module": "pivot",
                    "data": {
                        "voice_url": "http://pivot.your.company.com/collected.php"
                    },
                    "children": {}
                }
            }
        }
    }
}

First, 2600Hz will use the TTS engine to say the text field. Next, it will wait for the user to press up to 4 DTMF (with # being a terminating DTMF that is not included in the collection). Finally, a second pivot request will be made the the collected.php script on your server.

This is a basic menu! Congrats, you can build custom IVRs!

Processing collected DTMF

Here is demonstrated speaking back the digits pressed to the caller; you could obviously key off the DTMF to do whatever further call processing.

<?php

header('content-type:application/json');

$dtmf = $_REQUEST['Digits'];

if ( empty($dtmf) ) {
?>

{
    "module": "tts",
    "data": {
        "text": "We didn't get that"
    },
    "children": {}
}

<?php } else if ( is_string($dtmf) ) { ?>

{
    "module": "tts",
    "data": {
        "text": "You typed <?= $dtmf ?>"
    },
    "children": {}
}

<?php } else { ?>

{
    "module": "tts",
    "data": {
        "text": "You typed <?= $dtmf['custom_name'] ?>"
    },
    "children": {}
}

<?php } ?>

The is_string($dtmf) check is to support the old way of returning DTMF in the Pivot request. Otherwise, you should receive an array of DTMF collections, indexed by the key name supplied (“default” if you didn’t specify one).

Schema

Validator for the Collect DTMF callflow element

KeyDescriptionTypeDefaultRequiredSupport Level
collection_nameStore collected DTMF in a named keystring()false
interdigit_timeoutHow long, in milliseconds, to wait for the next DTMFinteger(1..)false
max_digitsHow many DTMFs to collect from the callerinteger(1..)1false
skip_moduleWhen set to true this callflow action is skipped, advancing to the wildcard branch (if any)boolean()false
terminatorWhat DTMF will terminate collection before the timeout occursstring('1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '0' | '#' | '*')#false
terminators.[]string('1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '0' | '#' | '*')false
terminatorsWhat DTMFs will terminate collection before the timeout occursarray(string('1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '0' | '#' | '*'))false
timeoutHow long, in milliseconds, to wait for the first DTMFinteger(1..)5000false