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

# record

> Start recording an active call via REST.

[pause]: /docs/server-sdks/reference/python/rest/calling/record-pause

[resume]: /docs/server-sdks/reference/python/rest/calling/record-resume

[stop]: /docs/server-sdks/reference/python/rest/calling/record-stop

Start recording an active call. Pass a `control_id` to name the recording so you
can [pause][pause],
[resume][resume],
or [stop][stop] it later. The response never carries `control_id` back — omit
it and you have no way to control this recording afterward.

## **Request**

### Schema (`calling.record`)

```yaml
components:
  schemas:
    uuid:
      type: string
      format: uuid
      description: Universal Unique Identifier.
      title: uuid
    CallingRecordAudioParamsFormat:
      type: string
      enum:
        - mp3
        - wav
        - mp4
      default: mp3
      description: The audio format for the recording.
      title: CallingRecordAudioParamsFormat
    Calling.PlayDirection:
      type: string
      enum:
        - listen
        - speak
        - both
      description: The direction of audio playback relative to the call participants.
      title: Calling.PlayDirection
    Calling.RecordAudioParams:
      type: object
      properties:
        beep:
          type: boolean
          default: false
          description: Whether to play a beep before recording starts.
        format:
          $ref: '#/components/schemas/CallingRecordAudioParamsFormat'
          default: mp3
          description: The audio format for the recording.
        stereo:
          type: boolean
          default: false
          description: Whether to record in stereo (separate channels for each direction).
        direction:
          $ref: '#/components/schemas/Calling.PlayDirection'
          default: speak
          description: The direction of audio to record.
        initial_timeout:
          type: number
          format: double
          minimum: 0
          default: 4
          description: Maximum time in seconds to wait for initial speech before stopping.
        end_silence_timeout:
          type: number
          format: double
          minimum: 0
          default: 0.5
          description: Time in seconds of silence after speech to stop recording.
        max_length:
          type: integer
          minimum: 0
          default: 0
          description: Maximum recording duration in seconds. Set to `0` for no limit.
        terminators:
          type: string
          default: '#'
          description: >-
            DTMF digits that terminate the recording when pressed. Accepts
            `0-9`, `A-D` (case insensitive), `*`, and `#`.
        input_sensitivity:
          type: number
          format: double
          minimum: 0
          maximum: 100
          default: 44
          description: Input sensitivity for voice detection (0.0-100.0).
      description: Audio recording parameters.
      title: Calling.RecordAudioParams
    Calling.RecordParams:
      type: object
      properties:
        audio:
          $ref: '#/components/schemas/Calling.RecordAudioParams'
          description: Audio recording configuration parameters.
      required:
        - audio
      description: >-
        Recording configuration wrapper. Currently only audio recording is
        supported.
      title: Calling.RecordParams
    CallingCallRequestDiscriminatorMappingCallingRecordParams:
      type: object
      properties:
        control_id:
          type: string
          description: >-
            Unique identifier for this record operation, used to control it
            later. Must be unique among active recordings on the call.
        record:
          $ref: '#/components/schemas/Calling.RecordParams'
          description: >-
            Recording configuration. Wraps the media-type-specific parameters
            (currently only `audio`).
        status_url:
          type: string
          format: uri
          description: >-
            Webhook URL that receives [record status
            callbacks](/docs/apis/rest/webhooks/record-status-callback) —
            including a `finished` event that contains the final recording URL.
            Must begin with `http://` or `https://`.
      required:
        - control_id
        - record
      description: An object of parameters that will be utilized by the active command.
      title: CallingCallRequestDiscriminatorMappingCallingRecordParams
    Calling.CallRecordRequest:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/uuid'
          description: The unique identifying ID of an existing call.
        params:
          $ref: >-
            #/components/schemas/CallingCallRequestDiscriminatorMappingCallingRecordParams
          description: An object of parameters that will be utilized by the active command.
      required:
        - id
        - params
      title: Calling.CallRecordRequest
```

## **Response**

### Schema (`Calling.CallResponse`)

```yaml
components:
  schemas:
    uuid:
      type: string
      format: uuid
      description: Universal Unique Identifier.
      title: uuid
    Calling.CallDirection:
      type: string
      enum:
        - inbound
        - outbound
        - outbound-api
      description: The direction of the call.
      title: Calling.CallDirection
    CallingCallLegSource:
      type: string
      enum:
        - realtime_api
      description: Source of this call.
      title: CallingCallLegSource
    Calling.ChargeDetails:
      type: object
      properties:
        description:
          type: string
          description: Description for this charge.
        charge:
          type: number
          format: double
          description: Charged amount.
      required:
        - description
        - charge
      description: One itemized charge applied to the call.
      title: Calling.ChargeDetails
    Calling.CallResponseStatus:
      type: string
      enum:
        - queued
        - initiated
        - created
        - ringing
        - answered
        - ending
        - ended
        - failed
        - canceled
        - completed
      description: >-
        The current status of the call. As a call is placed and progresses, it
        moves through `queued`,

        `initiated`, `created`, `ringing`, `answered`, `ending`, and `ended`,
        though it can skip some of

        them, such as `answered` for a call that is never answered. `ended` is
        the final

        status of every call that was placed, however it ended; the `end_reason`
        in the

        [call state
        callback](/docs/apis/rest/webhooks/call-state-status-callback) for
        `ended` says why,

        such as `busy` or `noAnswer`.


        Three statuses are outcomes rather than steps: `failed`, `canceled`, and
        `completed`. A call

        that is never placed has one of these instead of `ended`, and no call
        state callback is sent

        for it.
      title: Calling.CallResponseStatus
    CallingCallLegType0:
      type: string
      enum:
        - relay_pstn_call
      title: CallingCallLegType0
    CallingCallLegType1:
      type: string
      enum:
        - relay_sip_call
      title: CallingCallLegType1
    CallingCallLegType2:
      type: string
      enum:
        - relay_webrtc_call
      title: CallingCallLegType2
    CallingCallLegType:
      oneOf:
        - $ref: '#/components/schemas/CallingCallLegType0'
        - $ref: '#/components/schemas/CallingCallLegType1'
        - $ref: '#/components/schemas/CallingCallLegType2'
      description: Type of this call.
      title: CallingCallLegType
    Calling.CallQosMetrics:
      type: object
      properties:
        audio_in_media_packet_count:
          type: integer
          description: Number of audio packets received.
        audio_in_dtmf_packet_count:
          type: integer
          description: Number of DTMF packets received.
        audio_in_skip_packet_count:
          type: integer
          description: >-
            Number of received audio intervals filled with comfort noise because
            no audio packet was

            available. It grows with lost or late packets and during DTMF
            digits.
        audio_in_flush_packet_count:
          type: integer
          description: >-
            Number of queued received packets discarded when the media stream
            was flushed, for example when

            the call was bridged or unbridged.
        audio_in_largest_jb_size:
          type: integer
          description: Not populated. Always `0` when the call has quality statistics.
        audio_in_flaw_total:
          type: integer
          description: Total number of flaws detected in received audio.
        audio_in_quality_percentage:
          type: number
          format: double
          description: Quality of the received audio, as a percentage.
        audio_in_mean_interval:
          type: number
          format: double
          description: Mean interval between received audio packets, in milliseconds.
        audio_in_jitter_min_variance:
          type: number
          format: double
          description: Smallest jitter variance measured on received audio.
        audio_in_jitter_max_variance:
          type: number
          format: double
          description: Largest jitter variance measured on received audio.
        audio_out_media_packet_count:
          type: integer
          description: Number of audio packets sent.
        audio_out_dtmf_packet_count:
          type: integer
          description: Number of DTMF packets sent.
        audio_out_lost:
          type: integer
          description: Number of sent audio packets lost.
        audio_out_jitter_min:
          type: number
          format: double
          description: Smallest jitter measured on sent audio.
        audio_out_jitter_max:
          type: number
          format: double
          description: Largest jitter measured on sent audio.
        audio_out_jitter_avg:
          type: number
          format: double
          description: Average jitter measured on sent audio.
        audio_rtt_min:
          type: number
          format: double
          description: Smallest round-trip time measured.
        audio_rtt_max:
          type: number
          format: double
          description: Largest round-trip time measured.
        audio_rtt_avg:
          type: number
          format: double
          description: Average round-trip time measured.
      description: >-
        Audio quality statistics measured on the call's media. `audio_in_*`
        values describe audio

        received from the far end, `audio_out_*` values audio sent to it. Each
        statistic is included

        only when it was measured, so any key may be absent.
      title: Calling.CallQosMetrics
    Calling.CallLeg:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/uuid'
          description: >-
            The unique identifier of the call on SignalWire. This can be used to
            update the call programmatically.
        from:
          type: string
          description: The origin number or address.
        to:
          type: string
          description: The destination number or address.
        direction:
          $ref: '#/components/schemas/Calling.CallDirection'
          description: The direction of the call.
        source:
          $ref: '#/components/schemas/CallingCallLegSource'
          description: Source of this call.
        url:
          type:
            - string
            - 'null'
          description: The URL associated with this call.
        charge:
          type: number
          format: double
          description: Total charge for this call.
        created_at:
          type: string
          format: date-time
          description: The date and time when the call was created.
        charge_details:
          type: array
          items:
            $ref: '#/components/schemas/Calling.ChargeDetails'
          description: Details on charges associated with this call.
        status:
          oneOf:
            - $ref: '#/components/schemas/Calling.CallResponseStatus'
            - type: 'null'
          description: The status of the call.
        duration:
          type:
            - integer
            - 'null'
          description: The duration of the call in seconds.
        duration_ms:
          type:
            - integer
            - 'null'
          description: The duration of the call in milliseconds.
        billing_ms:
          type:
            - integer
            - 'null'
          description: The billable duration of the call in milliseconds.
        type:
          $ref: '#/components/schemas/CallingCallLegType'
          description: Type of this call.
        parent_id:
          oneOf:
            - $ref: '#/components/schemas/uuid'
            - type: 'null'
          description: The parent call ID if this is a child call.
        qos_metrics:
          oneOf:
            - $ref: '#/components/schemas/Calling.CallQosMetrics'
            - type: 'null'
          description: >-
            Audio quality statistics for the call. `null` until the call has
            ended and its statistics have been recorded.
      required:
        - id
        - from
        - to
        - direction
        - source
        - url
        - charge
        - created_at
        - charge_details
        - status
        - duration
        - duration_ms
        - billing_ms
        - type
        - parent_id
        - qos_metrics
      description: Returned when the call is a standard PSTN, SIP, or WebRTC call.
      title: Calling.CallLeg
    CallingFabricDeviceLegSource:
      type: string
      enum:
        - realtime_api
      description: Source of this call.
      title: CallingFabricDeviceLegSource
    CallingFabricDeviceLegType:
      type: string
      enum:
        - fabric_subscriber_device_leg
      description: Type of this call.
      title: CallingFabricDeviceLegType
    Calling.FabricDeviceLeg:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/uuid'
          description: >-
            The unique identifier of the call on SignalWire. This can be used to
            update the call programmatically.
        from:
          type: string
          description: The origin number or address.
        to:
          type: string
          description: The destination number or address.
        direction:
          $ref: '#/components/schemas/Calling.CallDirection'
          description: The direction of the call.
        source:
          $ref: '#/components/schemas/CallingFabricDeviceLegSource'
          description: Source of this call.
        url:
          type:
            - string
            - 'null'
          description: The URL associated with this call.
        charge:
          type: number
          format: double
          description: Total charge for this call.
        created_at:
          type: string
          format: date-time
          description: The date and time when the call was created.
        charge_details:
          type: array
          items:
            $ref: '#/components/schemas/Calling.ChargeDetails'
          description: Details on charges associated with this call.
        status:
          description: >-
            The status of the call. Always null for Fabric subscriber device
            legs.
        type:
          $ref: '#/components/schemas/CallingFabricDeviceLegType'
          description: Type of this call.
      required:
        - id
        - from
        - to
        - direction
        - source
        - url
        - charge
        - created_at
        - charge_details
        - status
        - type
      description: >-
        Returned when the call is a Fabric subscriber device leg. The `status`
        field is always null for this type.
      title: Calling.FabricDeviceLeg
    Calling.CallResponse:
      oneOf:
        - $ref: '#/components/schemas/Calling.CallLeg'
        - $ref: '#/components/schemas/Calling.FabricDeviceLeg'
      title: Calling.CallResponse
```

## **Example**

```python {9}
from signalwire.rest import RestClient

client = RestClient(
    project="your-project-id",
    token="your-api-token",
    host="your-space.signalwire.com",
)

client.calling.record(
    call_id="call-id-xxx",
    control_id="record-1",
    audio={"format": "mp3", "stereo": True}
)
```