> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gnani.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# DTMF Collection

Let your voice agents listen, capture, and respond to **keypad inputs** from users — essential for collecting sensitive inputs like phone numbers and PIN codes securely and efficiently.

**DTMF (Dual-Tone Multi-Frequency)** support ensures your agents can handle numeric inputs with precision, whether it's authenticating users or routing calls based on input.

## What is DTMF and Why Enable It?

DTMF is a system that sends numeric input over phone lines — like when you enter a PIN, press "1 for support", or key in an account number. With DTMF enabled, your voice agents can collect:

* **Phone Numbers**
* **PIN Codes**
* **Account Numbers or OTPs**

**Why it matters:**

* **Secure Input:** Collect sensitive information without relying on voice transcription.
* **Better UX:** Give users a familiar way to respond via dial pad.
* **Essential for IVR:** Key component of any interactive phone workflow.
* **Improves Accuracy:** Ideal for situations with background noise or low-quality audio, where speech recognition may struggle.

## How to Enable DTMF Support

You’ll find a toggle under **Agent Settings → Customize → DTMF Collection**.

> ⚠️ **Important:** Simply turning on the DTMF toggle does **not** activate the full flow.\
> To make it work, you must also update your **system prompt** using the correct DTMF signals as shown below.

## DTMF Collection Template

Update your system prompt with the following format when collecting inputs. The signal format must be **precisely** followed.

### Collecting Phone Number

When your agent asks for a phone number:

* Append this signal: `| DTMF1010`
* Ask the user clearly to provide input **after the beep**
* Input must be a 10-digit number (e.g., `8197800293`)

**System Prompt Example:**

> "Can you please provide your phone number after the beep tone? | DTMF1010"

**If the input is invalid:**

> "That doesn't seem like a valid phone number. Please enter a 10-digit phone number after the beep. | DTMF1010"

### Collecting Pin Code

When your agent asks for a PIN:

* Append this signal: `| DTMF0610`
* Input must be exactly 6 digits (e.g., `560033`)

**System Prompt Example:**

> "Can you please provide your pin code after the beep tone? | DTMF0610"

**If the input is invalid:**

> "That doesn’t seem like a valid pin code. Please enter a 6-digit pin after the beep. | DTMF0610"

## How DTMF Signals Work

DTMF signals follow the format:\
`| DTMF[XXYY]`\
Where:

* `XX` = Expected number of digits
* `YY` = Time (in seconds) allowed for user input

For example:

* `DTMF1010` → Expect **10 digits**, allow **10 seconds**
* `DTMF0610` → Expect **6 digits**, allow **10 seconds**

> ⚠️ **Tip:** Always set the `YY` duration based on the TTS utterance length.\
> If the message is long but the time is short, the input might **timeout before the beep.**

## 💡 Bonus Tips & Best Practices

| Tip                                      | Why It Helps                                                                                                            |
| ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| **Match time to utterance length**       | If the `YY` value (input time) is too short for your message, users won't be able to respond in time.                   |
| **Don’t strip or reformat DTMF signals** | They must remain at the end of the prompt **exactly** as written.                                                       |
| **Handle invalid input loops**           | Guide the user to retry if their input doesn’t match the expected format.                                               |
| **Use clear instructions**               | Mention “after the beep” to guide user expectations and ensure input is captured.                                       |
| **Enable barge-in (optional)**           | If you're using TTS, enabling barge-in allows users to enter input **without waiting** for the entire prompt to finish. |
| **Validate inputs post-call**            | You can log or validate the collected digits after the call for reporting or verification workflows.                    |
| **Use in noisy environments**            | DTMF ensures input collection even when speech transcription is unreliable due to background noise.                     |

By enabling and correctly using DTMF, you open up powerful, secure, and user-friendly workflows for your voice agents — from authentication to onboarding and beyond.

Let your agents hear more than just voices. Let them listen to actions.
