Start recording a call
const url = 'https://api.siprtc.io/v1/Accounts/AC000000000000000000/Calls/0c9b8a7d-6e5f-4a3b-9c1d-2e3f4a5b6c7d/Recordings';const options = { method: 'POST', headers: {Authorization: 'Basic <credentials>', 'Content-Type': 'application/json'}, body: '{"RecordingChannels":"mono","RecordingStatusCallback":"https://example.com/voice/recording","RecordingStatusCallbackEvent":"in-progress completed","RecordingStatusCallbackMethod":"GET","RecordingTrack":"inbound","Trim":"trim-silence"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “ Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ”Your account Auth ID, or the Auth ID of a sub-account you own
Example
AC000000000000000000Call SID (a UUID) of the live call
Example
0c9b8a7d-6e5f-4a3b-9c1d-2e3f4a5b6c7dRequest Body
Section titled “ Request Body ”Recording options; all optional
object
mono mixes both parties into one channel; dual records them on separate channels. When empty the account’s recording settings decide.
Example
dualAbsolute http or https URL SIPRTC sends recording events to.
Example
https://example.com/voice/recordingRecording events to send: any of in-progress, completed, absent, separated by spaces or commas (or repeat the form parameter). Default completed.
Example
in-progress completedHTTP method for RecordingStatusCallback: GET or POST.
Example
POSTAudio recorded: inbound, outbound or both. When empty the account’s recording settings decide.
Example
bothtrim-silence removes leading and trailing silence from the file; do-not-trim keeps it. When empty the account’s recording settings decide.
Example
trim-silenceobject
mono mixes both parties into one channel; dual records them on separate channels. When empty the account’s recording settings decide.
Example
dualAbsolute http or https URL SIPRTC sends recording events to.
Example
https://example.com/voice/recordingRecording events to send: any of in-progress, completed, absent, separated by spaces or commas (or repeat the form parameter). Default completed.
Example
in-progress completedHTTP method for RecordingStatusCallback: GET or POST.
Example
POSTAudio recorded: inbound, outbound or both. When empty the account’s recording settings decide.
Example
bothtrim-silence removes leading and trailing silence from the file; do-not-trim keeps it. When empty the account’s recording settings decide.
Example
trim-silenceResponses
Section titled “ Responses ”Recording started: sid, call_sid, account_sid, api_version
object
Auth ID of the account.
API version, v1.
SID of the recorded call.
Recording SID (a UUID).
Not currently populated.
On update, the status that was requested (paused, in-progress or stopped); empty when a recording is started.
Not currently populated.
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)
object
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.
Human-readable explanation.
A link for more information: https:// followed by the host the request was sent to, without its api. prefix.
The HTTP status of the response.
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)
Example generated
exampleThe account’s recording policy refused the recording (code 64001, 64004 or 64005)
object
Recording SID the request concerned.
Call SID.
Present when the account’s recording policy refused the recording: 64001 blocked by policy, 64004 policy unavailable (recording refused), 64005 voicemail recording blocked.
Present with code.
Always failed.
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"}