question

don-jackson7565 avatar image
don-jackson7565 asked Phong Vu commented

Is there a simple Node.js code sample for downloading call recordings?

I'm using node.js to pull down call logs. Now I would like to download call recordings. Is there a simple JavaScript code sample for me to start from?

call logs
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image
Phong Vu answered
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

don-jackson7565 avatar image
don-jackson7565 answered Phong Vu commented
Thanks Phong Vu. That gives me a good start.
When I log in, then run:

rcsdk.platform().get('/restapi/v1.0/account/~/recording/<recording id here>').then(function(res) {
    return res.response().buffer(); // we are accessing Node Fetch's Response
}).then(function(buffer) {
 
}

I get the error:

"body used already for: https://platform.ringcentral.com/restapi/v1.0/account/~/recording/<recording id>"


When I put in an invalid recording id it tells me that callRecordingId is not found, but when I put a valid id in it gives me the above error

Is my get not structured properly?

1 comment
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image Phong Vu ♦♦ commented ·
Hi Don,

The example code is not precise.

Use my test code below. Assumed that the record is an item in the records array from the response. Always check if the recording is available

if (record.recording != undefined) {     recordingId = record.recording.id     rcsdk.platform().get(record.recording.contentUri)     .then(function(res) {         return res.response().buffer();     })     .then(function(buffer) {         console.log("buffer")         fs.writeFileSync(recordingId + '.mp3', buffer);     })     .catch(function(e){         throw e     })
}

You can also check the record content type to define the audio file name extension.

Hope this helps,
+ Phong
0 Likes 0 ·

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys