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.
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) }) }
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