Letters in DTMF | GRXML | Multiple Keypress on same number
Categories:
Decoding DTMF: Handling Letters and Multiple Keypresses in IVR and GRXML

Explore the nuances of Dual-Tone Multi-Frequency (DTMF) signaling, how letters are represented, and strategies for managing multiple keypresses on the same number in Interactive Voice Response (IVR) systems and GRXML grammars.
Dual-Tone Multi-Frequency (DTMF) is the signaling system used for touch-tone telephones. Each keypress generates a unique combination of two sine wave tones â one from a low-frequency group and one from a high-frequency group. While most people are familiar with the numbers 0-9, the standard DTMF keypad also includes the letters A, B, C, and D, along with the asterisk (*) and pound (#) symbols. Understanding how these signals are interpreted is crucial for designing robust Interactive Voice Response (IVR) systems and crafting effective GRXML grammars.
DTMF Keypad Layout and Letter Representation
The standard DTMF keypad is a 4x4 matrix. The rows correspond to low frequencies, and the columns correspond to high frequencies. When a key is pressed, a tone from its row and a tone from its column are generated simultaneously. While consumer phones typically only show numbers, *, and #, the full DTMF specification includes the A, B, C, and D keys, which are often used in specialized applications like military communications, radio control, or internal PBX systems.
graph TD subgraph Low Frequencies F697["697 Hz"] --> R1(Row 1) F770["770 Hz"] --> R2(Row 2) F852["852 Hz"] --> R3(Row 3) F941["941 Hz"] --> R4(Row 4) end subgraph High Frequencies F1209["1209 Hz"] --> C1(Col 1) F1336["1336 Hz"] --> C2(Col 2) F1477["1477 Hz"] --> C3(Col 3) F1633["1633 Hz"] --> C4(Col 4) end R1 --- C1 --> K1["1"] R1 --- C2 --> K2["2 (A)"] R1 --- C3 --> K3["3 (B)"] R1 --- C4 --> K4["A"] R2 --- C1 --> K5["4"] R2 --- C2 --> K6["5 (B)"] R2 --- C3 --> K7["6 (C)"] R2 --- C4 --> K8["B"] R3 --- C1 --> K9["7"] R3 --- C2 --> K10["8 (C)"] R3 --- C3 --> K11["9 (D)"] R3 --- C4 --> K12["C"] R4 --- C1 --> K13["*"] R4 --- C2 --> K14["0"] R4 --- C3 --> K15["#"] R4 --- C4 --> K16["D"]
DTMF Keypad Frequency Matrix and Key Assignments
As you can see, the letters A, B, C, D occupy the rightmost column. While some older phones might have letters (like ABC on '2', DEF on '3', etc.) printed on the number keys, these are primarily for text input (like T9 texting) and do not correspond to unique DTMF tones. The DTMF system itself only recognizes the specific tones for 0-9, *, #, A, B, C, and D.
Handling Multiple Keypresses on the Same Number in GRXML
A common challenge in IVR design is distinguishing between single and multiple presses of the same key, especially when a user might press '2' twice to indicate '22' versus pressing '2' and then '2' again for a different menu option. GRXML (Grammar XML) is a W3C standard for defining grammars that speech recognition engines and DTMF decoders use to interpret user input. GRXML provides mechanisms to define patterns for sequences of DTMF tones.
<?xml version="1.0"?>
<grammar version="1.0" xml:lang="en-US" root="main" mode="dtmf">
<rule id="main">
<one-of>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>0</item>
<item>*</item>
<item>#</item>
<item>A</item>
<item>B</item>
<item>C</item>
<item>D</item>
<item>22</item> <!-- Matches two consecutive '2' presses -->
<item>333</item> <!-- Matches three consecutive '3' presses -->
</one-of>
</rule>
</grammar>
Basic GRXML grammar recognizing single DTMF digits and specific multiple keypresses.
In the example above, the grammar explicitly defines 22
and 333
as valid inputs. If a user presses '2' twice in quick succession, the IVR system, if configured with this grammar, would recognize it as the 22
input. Without such explicit definitions, the system might interpret two '2' presses as two separate '2' inputs, or it might time out after the first '2' if it's expecting a single digit.
Advanced GRXML for Flexible Input
For more flexible input, such as a variable-length account number or a sequence of digits where multiple presses of the same number are common, you can use GRXML's item
and count
attributes, or define more complex rule references.
<?xml version="1.0"?>
<grammar version="1.0" xml:lang="en-US" root="accountNumber" mode="dtmf">
<rule id="digit">
<one-of>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>0</item>
</one-of>
</rule>
<rule id="accountNumber">
<item repeat="3-6">
<ruleref uri="#digit"/>
</item>
<tag>out.account = rules.latest();</tag>
</rule>
</grammar>
GRXML grammar for a 3-6 digit account number, allowing repeated digits.
In this advanced example, the accountNumber
rule uses repeat="3-6"
to indicate that the digit
rule should be matched between 3 and 6 times. This allows for inputs like '123', '112233', or '999999' to be recognized as a single account number. The tag
element can be used to capture the recognized sequence for further processing in the IVR application.