简体   繁体   中英

How can I get a user's status as shown in the RingCentral softphone?

The RingCentral softphone application will show user status as the following. How can I get this via the API?

  • Available
  • Busy
  • Do Not Disturb
  • Invisible
  • On a Call
  • On Hold

I'm looking at the "Get User Status API" which has a presenceStatus property with the following values Offline , Busy , Available , but how do I get the full status list shown on the softphone?

https://developer.ringcentral.com/api-reference#Presence-getPresenceStatus

Here's an example screenshot:

在此处输入图片说明

User presence is the right place to find this information and this can be done statically via the REST API and via real-time updates using the Subscription API's Push Notifications.

The status shown in the softphone is an combination of several different values in user presence and can be as shown below.

The following KB article indicates how the status is determined:

Presence - View Presence via Favorites | RingCentral Phone

在此处输入图片说明

The status of their phone will be displayed as Available, Do Not Disturb, and Busy. Contacts on Invisible or Offline will be seen as Invisible.

The " Get User Status API " (aka Presence API) will return an object like the following:

{
  "uri": "https://platform.ringcentral.com/restapi/v1.0/account/403228676008/extension/403228676008/presence",
   "extension": {
      "uri": "https://platform.ringcentral.com/restapi/v1.0/account/403228676008/extension/403228676008",
      "id": 403228676008,
      "extensionNumber": "101"
   },
   "presenceStatus": "Available",
   "telephonyStatus": "NoCall",
   "userStatus": "Available",
   "dndStatus": "TakeAllCalls",
   "allowSeeMyPresence": true,
   "ringOnMonitoredCall": false,
   "pickUpCallsOnHold": true
}

From this, user status can be built using this pseudocode:

user_status = 
  !user.allowSeeMyPresence                ? "Invisible" :
  user.presenceStatus == "Offline"        ? "Invisible" :
  user.dndStatus == "DoNotAcceptAnyCalls" ? "Do Not Disturb" :
  user.telephonyStatus == "CallConnected" ? "On a Call" :
  user.telephonyStatus == "OnHold"        ? "On Hold" :
  user.presenceStatus == "Busy"           ? "Busy" : "Available"

Once a page you display this info, you can also update it in real time by creating a subscription to the presence endpoints for the users you wish to receive updates for.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM