Skip to content

Start recording a call

POST
/v1/Accounts/{auth_id}/Calls/{call_sid}/Recordings
curl --request POST \
--url https://api.siprtc.io/v1/Accounts/AC000000000000000000/Calls/0c9b8a7d-6e5f-4a3b-9c1d-2e3f4a5b6c7d/Recordings \
--header 'Authorization: Basic <credentials>' \
--header 'Content-Type: application/json' \
--data '{ "RecordingChannels": "mono", "RecordingStatusCallback": "https://example.com/voice/recording", "RecordingStatusCallbackEvent": "in-progress completed", "RecordingStatusCallbackMethod": "GET", "RecordingTrack": "inbound", "Trim": "trim-silence" }'

Starts recording a live call. The recording runs until the call ends or it is stopped with updateCallRecording, and the account’s recording policy applies (a refused recording answers 403 with the policy code). Parameters may be sent as JSON, as a form, or in the query string when the body is empty; a form may repeat RecordingStatusCallbackEvent instead of listing the events with spaces or commas. Values are matched without regard to case. Each call answers with the new recording’s SID, which the recording is later found under (GET /Accounts/{auth_id}/Recordings/{recording_sid}). A call that is not live answers 400 with an empty JSON string as the body.

auth_id
required
string

Your account Auth ID, or the Auth ID of a sub-account you own

Example

AC000000000000000000
call_sid
required
string

Call SID (a UUID) of the live call

Example

0c9b8a7d-6e5f-4a3b-9c1d-2e3f4a5b6c7d

Recording options; all optional

object
RecordingChannels

mono mixes both parties into one channel; dual records them on separate channels. When empty the account’s recording settings decide.

string
Allowed values: mono dual

Example

dual
RecordingStatusCallback

Absolute http or https URL SIPRTC sends recording events to.

string

Example

https://example.com/voice/recording
RecordingStatusCallbackEvent

Recording events to send: any of in-progress, completed, absent, separated by spaces or commas (or repeat the form parameter). Default completed.

string

Example

in-progress completed
RecordingStatusCallbackMethod

HTTP method for RecordingStatusCallback: GET or POST.

string
Allowed values: GET POST

Example

POST
RecordingTrack

Audio recorded: inbound, outbound or both. When empty the account’s recording settings decide.

string
Allowed values: inbound outbound both

Example

both
Trim

trim-silence removes leading and trailing silence from the file; do-not-trim keeps it. When empty the account’s recording settings decide.

string
Allowed values: trim-silence do-not-trim

Example

trim-silence

Recording started: sid, call_sid, account_sid, api_version

Media type application/json
object
account_sid

Auth ID of the account.

string
api_version

API version, v1.

string
call_sid

SID of the recorded call.

string
sid

Recording SID (a UUID).

string
start_time

Not currently populated.

string
status

On update, the status that was requested (paused, in-progress or stopped); empty when a recording is started.

string
uri

Not currently populated.

string

Example

{
"account_sid": "AC000000000000000000",
"api_version": "v1",
"call_sid": "0c9b8a7d-6e5f-4a3b-9c1d-2e3f4a5b6c7d",
"sid": "7d1c3b5a-9e8f-4a6b-8c2d-1e0f3a4b5c6d",
"start_time": "",
"status": "paused",
"uri": ""
}

A parameter is invalid (code 20001, e.g. "RecordingChannels must be one of mono, dual, got ‘stereo’"), the body could not be read (21210), or the call is not live (body is an empty JSON string)

Media type application/json
object
code

Error code, e.g. 21201 (no To), 21213 (no From), 21205 (no Url), 21211 (invalid To), 21210 (From not verified, or unreadable request), 21219 (To not verified on a trial account), 10001 (account not active), 20001 (invalid parameter), 20009 (no live call to delete). The insufficient-balance error carries 258.

integer
message

Human-readable explanation.

string
more_info

A link for more information: https:// followed by the host the request was sent to, without its api. prefix.

string
status

The HTTP status of the response.

integer

Example

{
"code": 21201,
"message": "No 'To' number is specified",
"more_info": "https://siprtc.io",
"status": 400
}

Authentication failed: missing or invalid credentials (JSON string from the API gateway)

Media type application/json
string

Example generated

example

The account’s recording policy refused the recording (code 64001, 64004 or 64005)

Media type application/json
object
Sid

Recording SID the request concerned.

string
call_sid

Call SID.

string
code

Present when the account’s recording policy refused the recording: 64001 blocked by policy, 64004 policy unavailable (recording refused), 64005 voicemail recording blocked.

integer
message

Present with code.

string
status

Always failed.

string

Example

{
"Sid": "7d1c3b5a-9e8f-4a6b-8c2d-1e0f3a4b5c6d",
"call_sid": "0c9b8a7d-6e5f-4a3b-9c1d-2e3f4a5b6c7d",
"code": 64001,
"message": "recording refused by policy, code 64001",
"status": "failed"
}