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

# Collect Digits

> Capture DTMF digit input from the caller

The **Collect Digits** node prompts the caller and captures DTMF key presses. It supports input validation, retries, and configurable TTS for prompts.

## Behavior

* Plays a prompt message (via TTS or pre-recorded audio)
* Listens for DTMF key presses until the terminate key is pressed, max digits are reached, or timeout occurs
* Validates input against an optional regex pattern
* Retries on invalid input up to the configured retry count
* Stores collected digits and count in output variables

## Configuration

### Input settings

| Parameter           | Type   | Default | Range       | Description                                 |
| ------------------- | ------ | ------- | ----------- | ------------------------------------------- |
| `minDigits`         | number | `1`     | 1–32        | Minimum digits required                     |
| `maxDigits`         | number | `16`    | 1–32        | Maximum digits accepted                     |
| `terminateKey`      | string | `"#"`   | single char | Key that ends input early (e.g., `#`)       |
| `timeout`           | number | `10`    | 1–60        | Overall timeout in seconds                  |
| `interDigitTimeout` | number | `3`     | 1–15        | Max seconds between consecutive key presses |

### Validation

| Parameter           | Type   | Default                              | Description                                                             |
| ------------------- | ------ | ------------------------------------ | ----------------------------------------------------------------------- |
| `validationPattern` | string | `""`                                 | Regex pattern to validate input (e.g., `^\d{10}$` for 10-digit numbers) |
| `validationMessage` | string | `"Invalid format."`                  | Message played when validation fails                                    |
| `retries`           | number | `3`                                  | Number of retry attempts on invalid input (1–5)                         |
| `retryMessage`      | string | `"Invalid input. Please try again."` | Message played before each retry                                        |

### Prompt

| Parameter       | Type   | Default                      | Description                                                     |
| --------------- | ------ | ---------------------------- | --------------------------------------------------------------- |
| `promptMessage` | string | `"Please enter your input."` | TTS text for the initial prompt                                 |
| `audioUrl`      | string | `""`                         | URL of pre-recorded audio (takes priority over `promptMessage`) |

### TTS settings

| Parameter  | Type   | Default                 | Description                |
| ---------- | ------ | ----------------------- | -------------------------- |
| `provider` | enum   | `"ElevenlabsTTSConfig"` | TTS provider               |
| `model`    | enum   | `"eleven_flash_v2_5"`   | TTS model                  |
| `voice`    | string | `"default"`             | Voice identifier           |
| `voiceId`  | string | `""`                    | Provider-specific voice ID |
| `speed`    | number | `1.0`                   | Speech rate (0.5–2.0)      |

## Output handles

| Handle      | Description                                     |
| ----------- | ----------------------------------------------- |
| **Success** | Valid digits collected                          |
| **Timeout** | No input received within the timeout            |
| **Invalid** | All retry attempts exhausted with invalid input |

## Output variables

| Variable      | Type   | Description                |
| ------------- | ------ | -------------------------- |
| `digits`      | string | The collected DTMF digits  |
| `digit_count` | number | Number of digits collected |

## Use cases

<AccordionGroup>
  <Accordion title="Account number lookup">
    Prompt for a 10-digit account number with `validationPattern: "^\d{10}$"`. On success, pass `{{digits}}` to a Database node.
  </Accordion>

  <Accordion title="PIN verification">
    Set `maxDigits: 4`, `terminateKey: "#"`, and `validationPattern: "^\d{4}$"` to collect a 4-digit PIN.
  </Accordion>

  <Accordion title="Phone number collection">
    Set `minDigits: 10`, `maxDigits: 15` to collect an international phone number. Use the `digits` output variable in an SMS node to send a confirmation.
  </Accordion>
</AccordionGroup>
