***

title: record_call
slug: /reference/python/agents/function-result/record-call
description: Start recording the call in the background.
max-toc-depth: 3
---------------------

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

[stop-record-call]: /docs/server-sdks/reference/python/agents/function-result/stop-record-call

[functionresult]: /docs/server-sdks/reference/python/agents/function-result

Start recording the call in the background. The conversation continues while
recording is active.

Raises `ValueError` if `format` is not `"wav"` or `"mp3"`, or if `direction`
is not `"speak"`, `"listen"`, or `"both"`.

<Note>
  For continuous call recording, omit `initial_timeout` and `end_silence_timeout`.
  Those parameters are for voicemail-style recordings that automatically stop on
  silence. Use [`stop_record_call()`][stop-record-call] to end continuous recordings.
</Note>

## **Parameters**

<ParamField path="control_id" type="Optional[str]" default="None" toc={true}>
  Identifier for this recording. Pass the same ID to `stop_record_call()` to
  stop this specific recording.
</ParamField>

<ParamField path="stereo" type="bool" default="False" toc={true}>
  Record in stereo (`True`) or mono (`False`).
</ParamField>

<ParamField path="format" type="str" default="wav" toc={true}>
  Recording file format.

  * `"wav"` -- uncompressed WAV audio
  * `"mp3"` -- compressed MP3 audio
</ParamField>

<ParamField path="direction" type="str" default="both" toc={true}>
  Audio direction to record.

  * `"speak"` -- what the agent says
  * `"listen"` -- what the caller says
  * `"both"` -- both sides of the conversation
</ParamField>

<ParamField path="terminators" type="Optional[str]" default="None" toc={true}>
  DTMF digits that stop recording when pressed (e.g., `"#"`).
</ParamField>

<ParamField path="beep" type="bool" default="False" toc={true}>
  Play a beep tone before recording starts.
</ParamField>

<ParamField path="input_sensitivity" type="float" default="44.0" toc={true}>
  Input sensitivity level for the recording.
</ParamField>

<ParamField path="initial_timeout" type="Optional[float]" default="None" toc={true}>
  Seconds to wait for speech to begin before auto-stopping. Used for
  voicemail-style recordings.
</ParamField>

<ParamField path="end_silence_timeout" type="Optional[float]" default="None" toc={true}>
  Seconds of silence after speech to wait before auto-stopping. Used for
  voicemail-style recordings.
</ParamField>

<ParamField path="max_length" type="Optional[float]" default="None" toc={true}>
  Maximum recording duration in seconds.
</ParamField>

<ParamField path="status_url" type="Optional[str]" default="None" toc={true}>
  URL to receive recording status webhook events.
</ParamField>

## **Returns**

[`FunctionResult`][functionresult] — self, for chaining.

## **Examples**

### Continuous Recording

```python {11}
from signalwire import AgentBase
from signalwire import FunctionResult

agent = AgentBase(name="my-agent", route="/agent")
agent.set_prompt_text("You are a helpful assistant.")

@agent.tool(name="start_recording", description="Start recording the call")
def start_recording(args, raw_data):
    return (
        FunctionResult("Recording started.")
        .record_call(
            control_id="main_recording",
            stereo=True,
            format="mp3"
        )
    )

agent.serve()
```

### Voicemail Recording

```python {11}
from signalwire import AgentBase
from signalwire import FunctionResult

agent = AgentBase(name="my-agent", route="/agent")
agent.set_prompt_text("You are a helpful assistant.")

@agent.tool(name="record_voicemail", description="Record a voicemail message")
def record_voicemail(args, raw_data):
    return (
        FunctionResult("Please leave your message after the beep.")
        .record_call(
            control_id="voicemail",
            beep=True,
            max_length=120.0,
            end_silence_timeout=3.0
        )
    )

agent.serve()
```