News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
ReadCallRecording Permission
Tags: rest api
Feb 27, 2020 at 4:08pm   •   2 replies  •  0 likes
TC User

We're attempting to read and save call logs, following this guide: https://medium.com/ringcentral-developers/how-to-get-a-new-call-recording-notification-ee9f2a6e41a0 by @Phong Vu

Our app is in sandbox mode and it DOES have "ReadCallRecording" as a permission.

When we run this:

platform.get(record.recording.contentUri) 

We're getting this error: "In order to call this API endpoint, application needs to have [ReadCallRecording] permission"

Code: CMN-401

We're able to retrieve the contentUri successfully, but the above call is failing.

Any help would be appreciated.

2 Answers
answered on Feb 27, 2020 at 4:45pm  

Update: seems like it just took a little while to take effect... error stopped occurring with no changes to the code.


 0
answered on Feb 27, 2020 at 5:32pm  

I guess that you just add the missing permission and test it. If that is the case, wait for a few minutes for the system to apply the changes, then try again.

By the way, here is a new code to get new call recording notifications. I will update the tutorial later though.

function presenceEvent(msg){
  var user = {
    extensionId: msg.body.extensionId,
    sessionId: msg.body.activeCalls[0].sessionId,
    telephonyStatus: msg.body.telephonyStatus
  }
  checkTelephonyStatusChange(user)
}

function checkTelephonyStatusChange(user){
  var newUser = true
  for (var i=0; i<usersList.length; i++){
    if (usersList[i].extensionId == user.extensionId){
      console.log("OLD -> NEW: " + usersList[i].telephonyStatus + " -> " + user.telephonyStatus)
      newUser = false
      if (usersList[i].telephonyStatus == "NoCall" && user.telephonyStatus == "Ringing"){
        usersList[i].telephonyStatus = user.telephonyStatus
        console.log("ExtensionId " + usersList[i].extensionId + " has an incoming call")
        break
      }
      if (usersList[i].telephonyStatus == "Ringing" && user.telephonyStatus == "CallConnected"){
        usersList[i].telephonyStatus = user.telephonyStatus
        console.log("ExtensionId " + usersList[i].extensionId + " has a accepted a call")
        break
      }
      if (usersList[i].telephonyStatus == "Ringing" && user.telephonyStatus == "NoCall"){
        usersList[i].telephonyStatus = user.telephonyStatus
        console.log("ExtensionId " + usersList[i].extensionId + " has a missed call")
        break
      }
      if (usersList[i].telephonyStatus == "CallConnected" && user.telephonyStatus == "NoCall"){
        usersList[i].telephonyStatus = user.telephonyStatus
        console.log("ExtensionId " + usersList[i].extensionId + " has a terminated call")
        // wait for about 20 secs then check for call recordings
        var thisUser = usersList[i]
        setTimeout(function(){
          readExtensionCallLogs(thisUser)
        }, 20000)
        break
      }
    }
  }
  if (newUser){
    console.log("NEW USER: " + " -> " + user.telephonyStatus)
    if (user.telephonyStatus == "Ringing"){
      console.log("ExtensionId " + user.extensionId + " has an incoming call")
    }
    usersList.push(user)
  }
}

function readExtensionCallLogs(user){
  var endpoint = '/account/~/extension/'+ user.extensionId +'/call-log'
  var params = {}
  params['sessionId'] = user.sessionId
  platform.get(endpoint, params)
  .then(function(resp){
    async.each(resp.json().records,
      function(record, callback){
        if (record.hasOwnProperty("recording")){
          console.log("THIS CALL HAS A RECORDING: " + record.recording.contentUri)
          saveAudioFile(record)
          callback(null, "done")
        }
      },
      function(err){
        console.log("No call with call recording within this period of time.")
      }
    );
  })
  .catch(function(e){
    var err = e.toString();
    console.log(err)
  })
}



 0



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us