question

don-jackson7565 avatar image
don-jackson7565 asked ·

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?
aaa
1 |1000 characters needed characters left characters exceeded

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 ·
Share
1 |1000 characters needed characters left characters exceeded

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 ·
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 Share
1 |1000 characters needed characters left characters exceeded

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

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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