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

# record_call

> Start recording the call in the background.

[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"`.

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.

## **Parameters**

**`control_id`** `Optional[str]` — default: None

Identifier for this recording. Pass the same ID to `stop_record_call()` to
stop this specific recording.

---

**`stereo`** `bool` — default: False

Record in stereo (`True`) or mono (`False`).

---

**`format`** `str` — default: wav

Recording file format.

* `"wav"` -- uncompressed WAV audio
* `"mp3"` -- compressed MP3 audio

---

**`direction`** `str` — default: both

Audio direction to record.

* `"speak"` -- what the agent says
* `"listen"` -- what the caller says
* `"both"` -- both sides of the conversation

---

**`terminators`** `Optional[str]` — default: None

DTMF digits that stop recording when pressed (e.g., `"#"`).

---

**`beep`** `bool` — default: False

Play a beep tone before recording starts.

---

**`input_sensitivity`** `float` — default: 44.0

Input sensitivity level for the recording.

---

**`initial_timeout`** `Optional[float]` — default: None

Seconds to wait for speech to begin before auto-stopping. Used for
voicemail-style recordings.

---

**`end_silence_timeout`** `Optional[float]` — default: None

Seconds of silence after speech to wait before auto-stopping. Used for
voicemail-style recordings.

---

**`max_length`** `Optional[float]` — default: None

Maximum recording duration in seconds.

---

**`status_url`** `Optional[str]` — default: None

URL to receive recording status webhook events.

---

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