***

title: collect
slug: /reference/python/relay/call/collect
description: Collect DTMF or speech input without playing media.
max-toc-depth: 3
---------------------

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

[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].

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

## **Parameters**

<ParamField path="digits" type="Optional[dict]" toc={true}>
  DTMF digit collection settings.
</ParamField>

<Indent>
  <ParamField path="digits.max" type="int" toc={true}>
    Maximum number of digits to collect.
  </ParamField>

  <ParamField path="digits.digit_timeout" type="float" toc={true}>
    Seconds to wait between digits before completing.
  </ParamField>

  <ParamField path="digits.terminators" type="str" toc={true}>
    Characters that terminate digit collection (e.g., `"#"`).
  </ParamField>
</Indent>

<ParamField path="speech" type="Optional[dict]" toc={true}>
  Speech recognition settings.
</ParamField>

<Indent>
  <ParamField path="speech.end_silence_timeout" type="float" toc={true}>
    Seconds of silence to wait before finalizing speech input.
  </ParamField>

  <ParamField path="speech.speech_timeout" type="float" toc={true}>
    Maximum seconds to listen for speech.
  </ParamField>

  <ParamField path="speech.language" type="str" toc={true}>
    Speech recognition language code (e.g., `"en-US"`).
  </ParamField>

  <ParamField path="speech.hints" type="list[str]" toc={true}>
    Words or phrases to boost recognition accuracy.
  </ParamField>
</Indent>

<ParamField path="initial_timeout" type="Optional[float]" toc={true}>
  Seconds to wait for the first input before ending with `no_input`.
</ParamField>

<ParamField path="partial_results" type="Optional[bool]" toc={true}>
  Enable partial speech recognition results.
</ParamField>

<ParamField path="continuous" type="Optional[bool]" toc={true}>
  Keep collecting after each result instead of stopping.
</ParamField>

<ParamField path="send_start_of_input" type="Optional[bool]" toc={true}>
  Send an event when input is first detected.
</ParamField>

<ParamField path="start_input_timers" type="Optional[bool]" toc={true}>
  Start input timers immediately. If `False`, call
  `action.start_input_timers()` to start them manually.
</ParamField>

<ParamField path="control_id" type="Optional[str]" toc={true}>
  Custom control ID. Auto-generated if not provided.
</ParamField>

<ParamField path="on_completed" type="Optional[Callable[[RelayEvent], Any]]" toc={true}>
  Callback invoked when collection completes.
</ParamField>

## **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()
```