Not allowed subscribe for missed calls of another extension

  • 1
  • Question
  • Updated 7 months ago

We are working on Ringcentral push notification app and now it is in production mode. We need to read other extensions missed call events but when we are trying to subscribe missed-calls and message-store events, then we are getting error as below :

 

"errorCode": "SUB-527",

"message": "Not allowed subscribe for missed calls of another extension"

 

Right now it is only allowing to subscribe for the same extension 101 which is admin default extension as shown in developer console. But when we are trying to subscribe for extension 102 or other extensions, it is giving the error as above.

We tested the app in sandbox account earlier and it was working properly. Also we have added permissions for read presence.

 

Please suggest.
Photo of Ashok kumar

Ashok kumar

  • 136 Points 100 badge 2x thumb

Posted 7 months ago

  • 1
Photo of Igor Bebin

Igor Bebin, Official Rep

  • 720 Points 500 badge 2x thumb
Hi Ashok,

Subscribing on missed-calls and incoming-call-pickup is allowed for the currently logged-in User due to security reasons. It's used to work this way for a long time. I believe there is no difference between Sandbox and Production for this behavior. 

message-store is available for any User with {{ReadMessages}} permission, typically it's available for Admin Users and own extensions. 

Could you please describe the scenario why do you need to get missed-calls notifications, which belong to another extension(s)?
Photo of Ashok kumar

Ashok kumar

  • 136 Points 100 badge 2x thumb
Thanks Igor for your feedback.
We have a requirement that if client gets any missed call on any of his extensions, then we need to add an action in velocify. For that we were working on getting the missed call event on our own server and from there pushing to velocify.
Is there any other way we can get the missed call push notification for all extensions?
Photo of Ashok kumar

Ashok kumar

  • 136 Points 100 badge 2x thumb
Please Reply as soon as possible.
Photo of Phong Vu

Phong Vu, Devangelist

  • 3,102 Points 3k badge 2x thumb
Hi Ashok,

I you can use this workaround solution to detect missed call for any extension under an account. The sample code is in Node JS, but you can implement similar way in other programming languages.
var RC = require('ringcentral')
require('dotenv').load()

var rcsdk = new RC({
  server: process.env.SERVER,
  appKey: process.env.APP_KEY,
  appSecret: process.env.APP_SECRET
})
var users = []
var platform = rcsdk.platform()

login()

function login(){
  platform.login({
    username: process.env.USERNAME,
    password: process.env.PASSWORD
  })
  .then(function(resp){
    removeRegisteredSubscription()
    subscribeForNotification()
  })
  .catch(function(e){
    console.log(e)
    throw e
  })
}

var subcription = rcsdk.createSubscription()
function subscribeForNotification(){
  var eventFilter = []
  eventFilter.push('/restapi/v1.0/account/~/presence')
  subcription.setEventFilters(eventFilter)
  .register()
  .then(function(resp){
      console.log('ready to get account presense')
  })
  .catch(function(e){
    throw e
  })
}
subcription.on(subcription.events.notification, function(msg){
  var user = {}
  user['extensionId'] = msg.body.extensionId
  user['telephonyStatus'] = msg.body.telephonyStatus
  checkMissedCall(user)
})

function checkMissedCall(user){
  var newUser = true
  for (var i=0; i<users.length; i++){
    if (users[i].extensionId == user.extensionId){
      newUser = false
      if (users[i].telephonyStatus == "Ringing" && user.telephonyStatus == "CallConnected"){
        users[i].telephonyStatus = user.telephonyStatus
        console.log("this extensionId " + users[i].extensionId + " has a accepted a call")
        break
      }
      if (user.telephonyStatus == "NoCall" && users[i].telephonyStatus == "Ringing"){
        users[i].telephonyStatus = user.telephonyStatus
        console.log("this extensionId " + users[i].extensionId + " has a missed call")
        break
      }
      users[i].telephonyStatus = user.telephonyStatus
    }
  }
  if (newUser){
    users.push(user)
  }
}

function removeRegisteredSubscription() {
    platform.get('/subscription')
      .then(function (response) {
        var data = response.json();
        if (data.records.length > 0){
          for(var record of data.records) {
            // delete old subscription before creating a new one
            platform.delete('/subscription/' + record.id)
              .then(function (response) {
                console.log("deleted: " + record.id)
              })
              .catch(function(e) {
                console.error(e);
                throw e;
              });
          }
        }
      })
      .catch(function(e) {
          console.error(e);
          throw e;
      });
}
Hope this helps!

+ Phong
Photo of Ashok Gupta

Ashok Gupta

  • 132 Points 100 badge 2x thumb
Thanks Phong Vu we will check.