copyright: years: 2018 lastupdated: "2018-10-03"
Collecting dual-tone multi-frequency (DTMF) digits
IBM® Voice Gateway supports RFC 4733, RTP Payload for DTMF Digits, Telephony Tones, and Telephony Signals. Dual-tone multi-frequency (DTMF) signals are converted into single digit text utterances that are sent to the configured Watson API.
You can configure Voice Gateway to collect DTMF digits in the following ways.
- Using an action to collect a specified number of DTMF digits
- Using an action to collect a specified range of DTMF digits
- Using an action to collect a variable number of digits and end session with a termination key
- Collecting a single DTMF digit on each conversation turn
To customize DTMF collection sessions, you can specify action sequences in the Watson Assistant dialog and tailor your Voice Gateway configuration.
About the DTMF collection action
DTMF sessions begin for Voice Gateway when an action sequence is triggered in Watson Assistant, starting with the vgwActCollectDTMF
action tag.
The following action tells Voice Gateway to play the defined text to the caller, and then begin a DTMF session. The session ends when the caller either presses # or a post response timeout occurs.
{
"output": {
"text": {
"values": [
"Please enter the extension you are trying to reach and then press #."
]
},
"vgwAction": {
"command": "vgwActCollectDTMF",
"parameters": {
"dtmfTermKey": "#",
}
}
}
}
DTMF collection attributes
When you configure the vgwActCollectDTMF
action tag, it instructs Voice Gateway to collect dual-tone multi-frequency signaling (DTMF) input.
Attribute | Description |
---|---|
dtmfTermKey |
The DTMF termination key, which signals the end of DTMF input. For example, "# ". |
dtmfCount |
The number of DTMF digits to collect. |
dtmfMinCount |
The minimum number of DTMF digits to collect when you configure your DTMF collection to accept a range of entries. |
dtmfMaxCount |
The maximum number of DTMF digits to collect when you configure your DTMF collection to accept a range of entries. When this number of digits is collected, a conversation turn is initiated. |
dtmfInterDigitTimeoutCount |
The amount of time in milliseconds to wait for a new DTMF digit after a DTMF digit is received. During an active DTMF collection, this timeout activates when the first DTMF collection is received. When the inter-digit timout is active,
it deactivates the vgwPostResponseTimeout timer. If dtmfInterDigitTimeoutCount isn't specified, the post response timer resets after receiving each DTMF digit, and stays active until either the vgwPostResponseTimeout is met or the collection completes. |
dtmfIgnoreSpeech |
When set to true , speech is automatically disabled on the reception of a DTMF digit until either the collection completes or a timeout occurs. The default for this attribute is false . |
dtmfPauseAfterCollection |
Indicates whether to disable DTMF input when DTMF collection completes. All DTMF input is ignored until it's reenabled by the vgwActUnPauseDTMF action. The default for this attribute is false . |
Determining the DTMF collection outcome
The vgwDTMFCollectionSucceeded
state variable indicates whether the DTMF collection succeeded or failed. It's passed to the SOE or Watson Assistant workspace with the digits that are collected during the session after each DTMF
collection turn.
When Yes
, a DTMF collection succeeded for any of the following reasons.
- The caller pressed a termination key
- The number of digits that are collected from the caller is the number that is specified by
dtmfCount
ordtmfMaxCount
- A timeout occurred and the number digits collected falls within the range specified in the collection action.
When No
, a DTMF collection failed for any of the following reasons.
- A timeout occurred and no termination key was pressed.
- A timeout occurred, and the number of digits didn't match the number that is specified by
dtmfCount
- A timeout occurred, and the number of digits that are collected isn't within the range that is specified by
dtmfMinCount
anddtmfMaxCount
Even when vgwDTMFCollectionSucceeded
is No
, all of the collected digits are passed to the SOE or Watson Assistant workspace in the input string of the turn request.
DTMF configuration options
In addition to programming how to collect DTMF digits, you can also control the following behaviors.
- When DTMF is enabled or disabled
- How DTMF collection affects speech processing
- How DTMF interrupts or "barges in" over the playback to the caller
Disabling speech recognition during DTMF collection
During a DTMF session, you might want to collect only information input from DTMF. To ignore any noise that might be recognized as speech by Voice Gateway, you can use the dtmfIgnoreSpeech
parameter of the vgwActCollectDTMF
action tag.
The following example prompts users to enter the number for a phone extension with either speech or DTMF. On the first reception of a DTMF digit, this action then ignores any speech from the caller until the DTMF collection completes.
This collection ends when either the maximum number of digits are collected, no speech or DTMF came from the caller, or after the 1 second inter-digit timeout pause. When the collection ends, a turn event is initiated.
Remember: dtmfIgnoreSpeech
ignores speech after the first DTMF digit is received until the collection is complete. Also, dtmfInterDigitTimeoutCount
is enabled after Voice Gateway receives the first
DTMF digit in the collection.
{
"output": {
"text": {
"values": [
"Please enter the extension you are trying to reach."
]
},
"vgwAction": {
"command": "vgwActCollectDTMF",
"parameters": {
"dtmfMinCount": "4",
"dtmfMaxCount": "6",
"dtmfIgnoreSpeech": "true",
"dtmfInterDigitTimeoutCount":"1000"
}
}
}
}
Disabling DTMF barge-in
If you want to prevent users from interrupting playback with DTMF barge-in, you can disable DTMF barge-in by setting the vgwActDisableDTMFBargeIn
action tag in the JSON node definition. When vgwActDisableDTMFBargeIn
is initiated, Voice Gateway stays in the state for the remainder of the call, and does not collect DTMF while playback of speech is active.
To re-enable barge-in, set the vgwActEnableDTMFBargeIn
action tag within the dialog.
The following example disables DTMF barge-in and speech recognition, prompts the caller to enter the extension, and begins the DTMF collection session after the play transaction completes.
{
"output": {
"text": {
"values": [
"Please enter the extension you are trying to reach."
]
},
"vgwActionSequence": [
{
"command": "vgwActDisableDTMFBargeIn"
},
{
"command": "vgwActPlayText"
},
{
"command": "vgwActCollectDTMF",
"parameters": {
"dtmfMinCount": "3",
"dtmfIgnoreSpeech": true,
"dtmfinterDigitTimeoutCount": "1000"
}
}
]
}
}
Using an action to collect a specified number of DTMF digits
You can use either an exact number or a range of expected inputs for your DTMF collection. To collect a specific number of digits, configure the dtmfCount
attribute.
Using an action to collect a specified range of DTMF digits
To configure your DTMF collection to accept a range of digits, such as PINs, you can use the dtmfMinCount
and dtmfMaxCount
attributes. These attributes inclusively define the lower and upper limits for the number of
acceptable digits that can be entered during a DTMF collection session.
In the following example, the caller is prompted to enter their PIN, and can respond with a number that is 4-8 digits long. When one of the following events occurs, a conversation turn is initiated.
- A
vgwPostResponseTimeout
occurs because Voice Gateway receives no input from the caller. - A speech utterance is detected
- The maximum number of DTMF digits is collected,
dtmfMaxCount
- Or, an inter-digit timeout occurs
{
"output": {
"text": {
"values": [
"Please enter your PIN."
]
},
"vgwAction": {
"command": "vgwActCollectDTMF",
"parameters": {
"dtmfMinCount": "4",
"dtmfMaxCount": "8",
"dtmfInterDigitTimeoutCount": "1000"
}
}
}
}
Using an action to collect a variable number of digits and end the collection with a termination key
You can set the DTMF collection to end when callers press a termination key or after they finish DTMF input.
dtmfTermKey
- The termination key that a user presses to indicate that they finished DTMF entry.dtmfInterDigitTimeoutCount
- The amount of time in milliseconds to wait for a new DTMF digit after a DTMF digit is received.
If you don't use the action tag parameters to configure the inter-digit timeout for DTMF collection, Voice Gateway uses the value from vgwPostResponseTimeout
by default.
Avoid Trouble: dtmfInterDigitTimeoutCount
is only enabled and vgwPostResponseTimeout
is disabled after the first DTMF digit is received.
Collecting a single DTMF digit on each conversation turn
You can configure Voice Gateway to pause and unpause a DTMF collection session, by using the vgwActPauseDTMF
and vgwActUnPauseDTMF
action tags. If you don't pause DTMF collection, Voice Gateway initiates a conversation
turn for every DTMF digit that it receives. Voice Gateway also queues any DTMF digits that are received while a conversation turn is active so that no DTMF digits are lost. When DTMF isn't paused, you can use DTMF for voice bots to immediately
opt out if a DTMF key of 0
is received at any point during the call.
If DTMF is paused, your collection does not receive any DTMF.