> For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

# collect

> Collect DTMF or speech input without playing media.

[play-and-collect]: /docs/server-sdks/reference/python/relay/call/play-and-collect

[calling-call-collect]: /docs/server-sdks/reference/python/relay/call#events

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

[standalonecollectaction]: /docs/server-sdks/reference/python/relay/actions

Collect DTMF digit or speech input without playing a prompt. Use this when you
want to listen for input silently or after a prompt has already been played
separately. For collecting input with a prompt, use
[`play_and_collect()`][play-and-collect].

This method emits [`calling.call.collect`][calling-call-collect] events. See [Call Events][call-events] for payload details.

## **Parameters**

DTMF digit collection settings.

Maximum number of digits to collect.

Seconds to wait between digits before completing.

Characters that terminate digit collection (e.g., `"#"`).

Speech recognition settings.

Seconds of silence to wait before finalizing speech input.

Maximum seconds to listen for speech.

Speech recognition language code (e.g., `"en-US"`).

Words or phrases to boost recognition accuracy.

Seconds to wait for the first input before ending with `no_input`.

Enable partial speech recognition results.

Keep collecting after each result instead of stopping.

Send an event when input is first detected.

Start input timers immediately. If `False`, call
`action.start_input_timers()` to start them manually.

Custom control ID. Auto-generated if not provided.

Callback invoked when collection completes.

## **Returns**

[`StandaloneCollectAction`][standalonecollectaction] -- An action
handle with `stop()`, `start_input_timers()`, and `wait()` methods.

## **Example**

```python {15}
from signalwire.relay import RelayClient

client = RelayClient(
    project="your-project-id",
    token="your-api-token",
    host="your-space.signalwire.com",
    contexts=["default"],
)

@client.on_call
async def handle_call(call):
    await call.answer()

    # Collect digits silently (e.g., extension entry)
    action = await call.collect(
        digits={"max": 4, "digit_timeout": 3, "terminators": "#"},
        initial_timeout=10,
    )
    event = await action.wait()

    result = event.params.get("result", {})
    extension = result.get("digits", "")
    print(f"Extension entered: {extension}")

client.run()
```