> This page is for Server SDKs.

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

# CollectAction

> Action handle for a play-and-collect operation.

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

[base-action-interface]: /docs/server-sdks/reference/python/relay/actions

[stop]: /docs/server-sdks/reference/python/relay/actions/collect-action/stop

[pause]: /docs/server-sdks/reference/python/relay/actions/collect-action/pause

[resume]: /docs/server-sdks/reference/python/relay/actions/collect-action/resume

[volume]: /docs/server-sdks/reference/python/relay/actions/collect-action/volume

[startinputtimers]: /docs/server-sdks/reference/python/relay/actions/collect-action/start-input-timers

Returned from [`call.play_and_collect()`][call-play-and-collect].
Tracks a combined play-and-collect operation where a prompt is played and user
input (digits or speech) is collected. Terminal states: `finished`, `error`,
`no_input`, `no_match`.

> **Note**
>
> `CollectAction` only resolves on collect events. Play events sharing the same
> `control_id` are ignored, so `await action.wait()` returns only when input
> collection completes.

Inherits all properties and methods from the
[base Action interface][base-action-interface] (`control_id`,
`is_done`, `completed`, `result`, `wait()`).

## **Properties**

No additional properties beyond the [base Action interface][base-action-interface].

## **Methods**

#### [stop](/docs/server-sdks/reference/python/relay/actions/collect-action/stop)

Stop the play-and-collect operation.

#### [pause](/docs/server-sdks/reference/python/relay/actions/collect-action/pause)

Pause the play-and-collect operation.

#### [resume](/docs/server-sdks/reference/python/relay/actions/collect-action/resume)

Resume a paused play-and-collect operation.

#### [volume](/docs/server-sdks/reference/python/relay/actions/collect-action/volume)

Adjust the prompt playback volume during a play-and-collect operation.

#### [start_input_timers](/docs/server-sdks/reference/python/relay/actions/collect-action/start-input-timers)

Manually start the initial_timeout timer on an active collect.

## **Example**

```python {12}
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.play_and_collect(
        media=[{"type": "tts", "params": {"text": "Press 1 for sales, 2 for support."}}],
        collect={"digits": {"max": 1, "digit_timeout": 5.0}},
    )

    event = await action.wait()
    result = event.params.get("result", {})
    digit = result.get("digits", "")
    print(f"User pressed: {digit}")

client.run()
```