> 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_call > Record call in the background. [statuscallbacks]: #statuscallbacks Record call in the background. Unlike the [`record` method](/docs/swml/reference/calling/record), the `record_call` method will start the recording and continue executing the SWML script while allowing the recording to happen in the background. To stop call recordings started with `record_call`, use the [`stop_record_call`](/docs/swml/reference/calling/stop-record-call) method. ## **Properties** **`record_call`** `object` — required An object that accepts the following properties. --- **`record_call.control_id`** `string` — default: Auto-generated, saved to record\_control\_id variable Identifier for this recording, to use with [`stop_record_call`](/docs/swml/reference/calling/stop-record-call) --- **`record_call.stereo`** `boolean` — default: false Whether to record in stereo mode --- **`record_call.format`** `string` — default: wav Format (`"wav"`, `"mp3"`, or `"mp4"`) --- **`record_call.direction`** `string` — default: both Direction of the audio to record: `"speak"` for what party says, `"listen"` for what party hears, `"both"` for what the party hears and says --- **`record_call.terminators`** `string` String of digits that will stop the recording when pressed. Default is empty (no terminators). --- **`record_call.beep`** `boolean` — default: false Whether to play a beep before recording --- **`record_call.input_sensitivity`** `number` — default: 44.0 How sensitive the recording voice activity detector is to background noise? A larger value is more sensitive. Allowed values from `0.0` to `100.0`. --- **`record_call.initial_timeout`** `number` — default: 0 How long, in seconds, to wait for speech to start? --- **`record_call.end_silence_timeout`** `number` — default: 0 How much silence, in seconds, will end the recording? --- **`record_call.max_length`** `number` Maximum length of the recording in seconds. --- **`record_call.status_url`** `string` HTTP or HTTPS URL to deliver record status events. Learn more about [status callbacks][statuscallbacks]. --- ## **Variables** Set by the method: * **record\_call\_url:** (out) the URL of the newly started recording. * **record\_call\_result:** (out) `success` | `failed`. * **record\_control\_id:** (out) control ID of this recording. ## **StatusCallbacks** > **Status callbacks are advisory** > > Status callbacks are asynchronous, best-effort HTTP notifications: delivery can be delayed or fail silently — if your server is unreachable, the callback simply never arrives. Don't gate time-critical or business-critical actions solely on receiving one. Confirm state via the REST API before acting, or use a transport with visible failure modes — see [Status callback reliability](/docs/platform/webhooks#status-callback-reliability). A POST request will be sent to `status_url` with a JSON payload like the following: **`event_type`** `string` The type of event. Always `calling.call.record` for this method. --- **`event_channel`** `string` The channel for the event, includes the SWML session ID. --- **`timestamp`** `number` Unix timestamp (float) when the event was generated. --- **`project_id`** `string` The project ID associated with the call. --- **`space_id`** `string` The Space ID associated with the call. --- **`params`** `object` An object containing recording-specific parameters. --- **`params.call_id`** `string` The call ID. --- **`params.node_id`** `string` The node handling the call. --- **`params.control_id`** `string` The control ID for this record operation. --- **`params.state`** `string` The current recording state. **Valid values:** `recording`, `paused`, `finished`, `no_input`, `error`. --- **`params.url`** `string` URL of the recorded media on `files.signalwire.com`. Present from the `recording` state onward. --- **`params.recording_id`** `string` ID of the recording, matching the `id` returned by the [Recordings API](/docs/apis/rest/recordings/list-call-recordings). --- **`params.duration`** `integer` Recording duration in seconds. Present when the recording ends. --- **`params.size`** `integer` Recording file size in bytes. Present when the recording ends. --- **`params.start_time`** `number` Unix timestamp (float) when the recording started. Present when the recording ends. --- **`params.end_time`** `number` Unix timestamp (float) when the recording ended. Present when the recording ends. --- **`params.first_frame_time`** `number` Unix timestamp (float) of the first recorded audio frame. Present when state is `finished`. --- **`params.pause_behavior`** `string` How paused recording handles audio. Only present when `state` is `paused`. **Valid values:** `silence`, `skip`. --- **`params.segment_id`** `string` The call segment the recording belongs to. --- **`params.record`** `object` The configuration the recording ran with. --- **`record.audio.format`** `string` Recording format. **Valid values:** `wav`, `mp3`, `mp4`. --- **`record.audio.direction`** `string` Direction of the audio recorded. **Valid values:** `speak`, `listen`, `both`. --- **`record.audio.stereo`** `boolean` Whether the recording was made in stereo mode. --- ### Raw JSON example ```json { "event_type": "calling.call.record", "event_channel": "swml:xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "timestamp": 1640000000.123, "project_id": "xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "space_id": "xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "params": { "call_id": "xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "node_id": "xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "control_id": "xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "state": "finished", "url": "https://files.signalwire.com///recordings/.wav", "recording_id": "xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "duration": 18, "size": 298284, "start_time": 1789651036.217461, "end_time": 1789651055.516839, "first_frame_time": 1789651036.219012, "segment_id": "xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "record": { "audio": { "format": "wav", "direction": "both", "stereo": false } } } } ``` --- ## **Examples** ### Start an MP3 recording of the call #### YAML ```yaml version: 1.0.0 sections: main: - record_call: format: mp3 ``` #### JSON ```json { "version": "1.0.0", "sections": { "main": [ { "record_call": { "format": "mp3" } } ] } } ``` ### Record and play back #### Record both sides of the conversation: #### YAML ```yaml version: 1.0.0 sections: main: - record_call: beep: true terminators: '#' - play: urls: - 'say:Leave your message now' - 'silence:10' - stop_record_call: {} - play: urls: - 'say:Playing back' - '${record_call_url}' ``` #### JSON ```json { "version": "1.0.0", "sections": { "main": [ { "record_call": { "beep": true, "terminators": "#" } }, { "play": { "urls": [ "say:Leave your message now", "silence:10" ] } }, { "stop_record_call": {} }, { "play": { "urls": [ "say:Playing back", "${record_call_url}" ] } } ] } } ``` #### Record only the speaker's side #### YAML ```yaml version: 1.0.0 sections: main: - record_call: beep: true direction: speak - play: urls: - 'say:Leave your message now' - 'silence:10' - stop_record_call: {} - play: urls: - 'say:Playing back' - '${record_call_url}' ``` #### JSON ```json { "version": "1.0.0", "sections": { "main": [ { "record_call": { "beep": true, "direction": "speak" } }, { "play": { "urls": [ "say:Leave your message now", "silence:10" ] } }, { "stop_record_call": {} }, { "play": { "urls": [ "say:Playing back", "${record_call_url}" ] } } ] } } ``` > Record call in the background.