question

Rob Ljunggren avatar image
Rob Ljunggren asked ·

DND from Desk phones or Can Admins set this for users

1) I want to be able to have Users in my Call/Hunt group have the ability to set themselves to DND from there deskphone with out having to also have the Softphone installed.

2) Can an admin go in and set users that forget to go in to DND for them?

call queuednd
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.

1 Answer

· Write an Answer
Phong Vu avatar image
Phong Vu answered ·

Yes, you can write an app, login with the super admin user, then you can read all users' presence status and set their status as well. Here is some code snippet in Node JS.

var SDK = require('ringcentral')

RINGCENTRAL_CLIENTID = 'your app client id'
RINGCENTRAL_CLIENTSECRET = 'your app client secret'
RINGCENTRAL_SERVER = 'https://platform.devtest.ringcentral.com'

RINGCENTRAL_USERNAME = 'super admin user name'
RINGCENTRAL_PASSWORD = 'password'
RINGCENTRAL_EXTENSION = '101'

var rcsdk = new SDK({
      server: RINGCENTRAL_SERVER,
      appKey: RINGCENTRAL_CLIENTID,
      appSecret: RINGCENTRAL_CLIENTSECRET
  });
var platform = rcsdk.platform();
platform.login({
      username: RINGCENTRAL_USERNAME,
      password: RINGCENTRAL_PASSWORD,
      extension: RINGCENTRAL_EXTENSION
      })
      .then(function(resp) {
          get_users_presence()
      });

function get_users_presence(){
    platform.get('/account/~/presence')
        .then(function (resp) {
          var jsonObj = resp.json()
          for (var record of jsonObj.records){
            console.log("====")
            console.log(JSON.stringify(record))
            // check the extension you want to change its presence status
            if (record.extension.id == "244609004"){
              set_user_presence(record.extension.id)
              break
            }
          }
        })
        .catch(function(e){
          console.log(e.message)
        });
}

function set_user_presence(extId){
    var endpoint = '/account/~/extension/'+ extId +'/presence'
    platform.put(endpoint, {
              dndStatus: "DoNotAcceptAnyCalls"
        })
        .then(function (resp) {
          var jsonObj = resp.json()
          console.log(resp.text())
        })
        .catch(function(e){
          console.log(e.message)
        });
}


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.

Thanks for the Help!

1 Like 1 · ·

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.