Search code examples
ringcentralcall-queue

How to get RingCentral Call Queue Members Availability?


How can I get the Call Queue availability for queue members per queue which is shown in the Online Account Portal? I specifically want the Available, Busy and Unavailable statuses shown in the UI under "Members Availability" per queue.

I've found a few Call Queue APIs that can list queues and queue members but they provide member availability like the UI.

Call Queue APIs:

The image below is from the article on Call Queue - User Availability and Call Handling

RingCentral Call Queue Member Availability


Solution

  • The above is on the right track. Once the list of queue members is available, you can query each user for his or her queue availability.

    Note: A user's queue availability as presented below is the same for all queues they are present on so to do a presentation by queue, this information needs to be combined with their queue membership list. This can be retrieved from the queue or user perspective:

    To manage individual queue availability, add/remove the user from the queues of interest which can be done using the Edit Call Queue Members API.

    For both steps query the Get User Status API. An example is provided below.

    Get User Status API:

    An example request and response looks like the following:

    Request:

    GET /restapi/v1.0/account/{accountId}/extension/{extensionId}/presence
    

    Response:

    HTTP 200 OK
    
    {
      "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
    }
    

    Use the following to get the user's queue availability:

    1) User Queue Setting

    The user's Do Not Disturb dndStatus property is used for indicating whether the user is accepting or not accepting calls, including for call queues. The user can set their dndStatus to be one of the four following values where "Department" is another name for Call Queue:

    • DoNotAcceptAnyCalls
    • DoNotAcceptDepartmentCalls
    • TakeAllCalls
    • TakeDepartmentCallsOnly

    This can roughly be mapped to:

    • Unavailable for Queue Calls: DoNotAcceptAnyCalls or DoNotAcceptDepartmentCalls
    • Available for Queue Calls: TakeAllCalls or TakeDepartmentCallsOnly

    2) User Overall Availability

    The next step is to check the presenceStatus property which is an enumerated string with the following values: Offline, Busy, Available. Offline maps to Unavailable in the UI. This is an overall availability for both personal calls and queue calls.

    3) Queue Member Availability

    To create the queue member availability, combine the two properties above like the following pseudocode.

    I added an extra "Available" condition below which is strictly not needed, but useful for explanation:

    member_availability = 
      user.dndStatus == "DoNotAcceptAnyCalls"        ? "Unavailable" :
      user.dndStatus == "DoNotAcceptDepartmentCalls" ? "Unavailable" :
      user.presenceStatus == "Offline"               ? "Unavailable" :
      user.presenceStatus == "Busy"                  ? "Busy" :
      user.presenceStatus == "Available"             ? "Available" : "Available"
    

    This gives the user's availability for all queues they are on so this needs to be mapped to either a queue members list or the user's list of queues.

    Example Code

    Here's some Ruby wrapper code I wrote to make it easier to update the user's queue status here:

    RingCentral Ruby SDK extension_presence.rb