> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# detect_digit

> Detect DTMF digits on a call.

[detect]: /docs/server-sdks/reference/python/relay/call/detect

Detect DTMF digits. A typed convenience over [`detect()`][detect] that builds the
`{"type": "digit", "params": {...}}` configuration for you. All parameters are
keyword-only.

## Parameters

**`digits`** `str | None` — default: None

The digits to listen for, such as `"1234567890*#"`. Omit to detect any digit.
Keyword-only.

---

**`timeout`** `float | None` — default: None

Maximum seconds to run the detector before stopping. Keyword-only.

---

**`on_completed`** `Callable[[RelayEvent], Any] | None` — default: None

Callback invoked when the operation reaches a terminal state. Can be a regular
function or async coroutine. Keyword-only.

---

## Returns

[`DetectAction`](/docs/server-sdks/reference/python/relay/actions) -- An action handle with `stop()` and `wait()` methods. It resolves on the first detection result.

## Example

```python {12-14}
from signalwire.relay import RelayClient

client = RelayClient(
    project="your-project-id",
    token="your-api-token",
    contexts=["default"],
)

@client.on_call
async def handle_call(call):
    await call.answer()
    action = await call.detect_digit(digits="0123456789", timeout=15)
    event = await action.wait()
    print("Detect result:", event.params)

client.run()
```