Requesting presence for all extensions always returns "Offline"

  • 1
  • Question
  • Updated 1 year ago
  • Answered
  • (Edited)
I am needing to pull all presence details for all extensions, and according to the documentation, I should be able to do this without problem. According to the documentation
The presenceStatus is returned as Offline (the parameters telephonyStatusmessageuserStatus and dndStatus are not returned at all) for the following extension types: Department/Announcement Only/Take Messages Only (Voicemail)/Fax User/Paging Only Group/Shared Lines Group/IVR Menu/Application Extension/Park Location.
The extensions that I am working with are not any of any of these types (mainly "DigitalUser"). Also, I have checked that my admin extension has the feature name "Presence" set to true, which seems to mean that it should be able to pull other extension's presence. 
Enables user extension to monitor other extensions' presence
Please help me identify what I am doing wrong. Reading through the documentation, everything should be setup, and I cannot see anything that I am doing wrong.

Thanks!

Update:

I should also mention that when requesting an individual extension's presence, I get what I am expecting. The presence is not "Offline", and I am getting the TelephonyStatus, UserStatus, DndStatus, and Message, where it exists. I am not getting any of these other statuses when using the bulk request described above.

Thanks again!
Photo of Spring IT

Spring IT

  • 310 Points 250 badge 2x thumb

Posted 3 years ago

  • 1
Photo of Benjamin Dean

Benjamin Dean, Alum

  • 8,662 Points 5k badge 2x thumb
I do not see the "bulk request" you mentioned, could you please provide the full API request/response with headers which you are using?
Photo of Spring IT

Spring IT

  • 310 Points 250 badge 2x thumb
Yeah, the request is
https://platform.ringcentral.com/restapi/v1.0/account/~/presence?page=1&perPage=1000
And the response for just one extension (we have some 4000) is
{
  "uri" : "https://platform.ringcentral.com/restapi/v1.0/account/~/presence?page=1&perPage=1000",
  "records" : [ {
    "uri" : "https://platform.ringcentral.com/restapi/v1.0/account/~/extension/**********/presence",
    "extension" : {
      "uri" : "https://platform.ringcentral.com/restapi/v1.0/account/~/extension/**********",
      "id" : **********,
      "extensionNumber" : "2388"
    },
    "presenceStatus" : "Offline"
  }]
}
Thanks.
(Edited)
Photo of Benjamin Dean

Benjamin Dean, Alum

  • 8,662 Points 5k badge 2x thumb
So I just tested this in both my sandbox(https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/presence) and production (https://platform.ringcentral.com/restapi/v1.0/account/~/presence) accounts, and it is working as expected (returning multiple extensions' presence data).

That leads me to ask three questions:

1. Have you tried removing the query parameters to see if that resolves the issue of only receiving a single record in the response?

2. Are you certain that all the other extensions in the account are set to allow their presence to be visible?

3. Could you please create a developer support case for this to be investigated further if you have not already? There is a link in this page for creating a new developer support case: https://developers.ringcentral.com/support.html
(Edited)
Photo of Spring IT

Spring IT

  • 310 Points 250 badge 2x thumb
Yeah, I have verified that I can get the presence information for one (and up to 30, as the documentation says) extensions at a time using this call
https://platform.ringcentral.com/restapi/v1.0/account/~/extension/{ids}/presence
This must mean that these extensions have their presence visible.

However, you say that it is working as expected. At first glance it seemed to be working for me as well, but for every extension I get a PresenceStatus of "Offline", which simply is not the case. I also do not get any TelephonyStatus, UserStatus, DndStatus information as described above.

For instance, when requesting the presence for our extension with extensionNumber 492 using the above URI, I get the correct response with the TelephonyStatus, UserStatus and DndStatus and a presenceStatus of "Available" as follows
{
  "uri": "https://platform.ringcentral.com/restapi/v1.0/account/~/extension/{id}/presence",
  "extension": {
    "uri": "https://platform.ringcentral.com/restapi/v1.0/account/~/extension/{id}",
    "id": {id},
    "extensionNumber": "492"
  },
  "presenceStatus": "Available",
  "telephonyStatus": "NoCall",
  "userStatus": "Available",
  "dndStatus": "TakeAllCalls"
}
However, when requesting the presence for all extensions using the URI I specified in my earlier reply, I get the following response without TelephonyStatus, UserStatus or DndStatus and with a presenceStatus of "Offline"
{
    "uri" : "https://platform.ringcentral.com/restapi/v1.0/account/~/extension/{id}/presence",
    "extension" : {
      "uri" : "https://platform.ringcentral.com/restapi/v1.0/account/~/extension/{id}",
      "id" : {id},
      "extensionNumber" : "492"
    },
    "presenceStatus" : "Offline"
  }
Thanks for your help, and I will create a ticket now.
(Edited)
Photo of Benjamin Dean

Benjamin Dean, Alum

  • 8,662 Points 5k badge 2x thumb
This must mean that these extensions have their presence visible.
To the above: Not necessarily which is why I asked you to create a support ticket.

However, you say that it is working as expected. At first glance it seemed to be working for me as well, but for every extension I get a PresenceStatus of "Offline", which simply is not the case.
This is where things begin to get interesting...Are all the extensions you're trying to fetch DigitalLines only? The reason that I ask this is because unless the employee is actively logged in to the Extension, and their device has been authorized with the extension, digital extensions may show up as "Offline". Since digital lines are typically used only with Soft Phones, it means that they can authenticate from a variety of locations. Each time they do this, they should be required to accept the e911 information (or set it up) which helps act as authorizing a device in the account (which will display as "Online"). If a user has not set these things up, then I'm not 100% positive you are going to see Digital Lines as "Online".

Here are a couple of debugging steps which might help get you on track:

1. I would invalidate the credentials with which you are using to authenticate and retrieve the access_token are actually the Super Admin or Admin. You can do this by making a GET request to "/restapi/v1.0/account/~/extension/~/authz-profile" once you have obtained a valid `access_token`. The URL properties contained within the response can guide you towards being able to see more information about the EffectiveRoles that set of credentials has, and will let you know if it is an Admin or SuperAdmin role.

2. I would login to the Online Account Portal (using the [Super]Admin credentials you have) to view the Authorization and activation state for a sampling of the Extensions you expect to be seeing, as well as to review their Presence visibility settings.

3. In your Sandbox account, use credentials for a similar extension to production (or create one if you have less than 4 users in the sandbox account), login to the Soft Phone (in developer mode) using these credentials, and try adjusting the settings for the user to match production and re-evaluate the results of the API requests based on the state changes of the Soft Phone and user.

I recommended you create the support ticket just to be certain there aren't any underlying issues.
Photo of Spring IT

Spring IT

  • 310 Points 250 badge 2x thumb
Thanks Ben. I have verified the credentials that I am using are for an AccountAdministration user. Which means that I would have to get the Super Admin credentials to accomplish item 2 on your list. I could do some testing in sandbox as you suggest in step 3, however, I have already verified that the result I am getting back from the https://platform.ringcentral.com/restapi/v1.0/account/~/presence URI is not correct. This was done by requesting the presence for a single extension which had a presenceStatus of "Offline" from the above request using the https://platform.ringcentral.com/restapi/v1.0/account/~/extension/{ids}/presence URI, and received a presenceStatus of "Available" as mentioned above. I do not see the benefit of trying to do some additional validation when I have already proved that the results are incorrect from the request returned from the first URI.
Photo of Spring IT

Spring IT

  • 310 Points 250 badge 2x thumb
It looks like I do have the "Super Admin" credentials. How would I go about seeing the extension information in the online portal?
Photo of Benjamin Dean

Benjamin Dean, Alum

  • 8,662 Points 5k badge 2x thumb
As I stated before, you will see "Offline" ONLY if an extension has TURNED OFF presence visibility permission (see this screenshot) from within the Online Account Portal (https://service[.devtest].ringcentral.com). This must be turned on from within the Online Account Portal.





You can see this response I executed after turning off this extension's presence permission (extension 103) is identical to yours "OFFLINE" only.

However all of the other extensions which have this feature turned on respond with the data you are expecting (for instance the 101 extension which shows all the data in both the presenceList and the presenceByExtensionId).

presenceByExtensionId Response ({{rcApiBaseUri}}/v1.0/account/~/extension/133128004/presence):

{  "uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/account/133128004/extension/133128004/presence...;,
  "extension": {
    "uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/account/133128004/extension/133128004";,
    "id": 133128004,
    "extensionNumber": "101"
  },
  "presenceStatus": "Available",
  "telephonyStatus": "NoCall",
  "userStatus": "Available",
  "dndStatus": "DoNotAcceptDepartmentCalls"
}

presenceList Response ({{rcApiBaseUri}}/v1.0/account/~/presence):

{  "uri" : "https://platform.devtest.ringcentral.com/restapi/v1.0/account/133128004/presence?page=1&perPage=...;,
  "records" : [ {
    "uri" : "https://platform.devtest.ringcentral.com/restapi/v1.0/account/133128004/extension/135445004/presence...;,
    "extension" : {
      "uri" : "https://platform.devtest.ringcentral.com/restapi/v1.0/account/133128004/extension/135445004";,
      "id" : 135445004,
      "extensionNumber" : "1"
    },
    "presenceStatus" : "Offline"
  }, {
    "uri" : "https://platform.devtest.ringcentral.com/restapi/v1.0/account/133128004/extension/133128004/presence...;,
    "extension" : {
      "uri" : "https://platform.devtest.ringcentral.com/restapi/v1.0/account/133128004/extension/133128004";,
      "id" : 133128004,
      "extensionNumber" : "101"
    },
    "presenceStatus" : "Available",
    "telephonyStatus" : "NoCall",
    "userStatus" : "Available",
    "dndStatus" : "DoNotAcceptDepartmentCalls"
  }, {
    "uri" : "https://platform.devtest.ringcentral.com/restapi/v1.0/account/133128004/extension/133165004/presence...;,
    "extension" : {
      "uri" : "https://platform.devtest.ringcentral.com/restapi/v1.0/account/133128004/extension/133165004";,
      "id" : 133165004,
      "extensionNumber" : "102"
    },
    "presenceStatus" : "Available",
    "telephonyStatus" : "NoCall",
    "userStatus" : "Available",
    "dndStatus" : "DoNotAcceptDepartmentCalls"
  }, {
    "uri" : "https://platform.devtest.ringcentral.com/restapi/v1.0/account/133128004/extension/138323004/presence...;,
    "extension" : {
      "uri" : "https://platform.devtest.ringcentral.com/restapi/v1.0/account/133128004/extension/138323004";,
      "id" : 138323004,
      "extensionNumber" : "105"
    },
    "presenceStatus" : "Available",
    "telephonyStatus" : "NoCall",
    "userStatus" : "Available",
    "dndStatus" : "TakeAllCalls"
  }, {
    "uri" : "https://platform.devtest.ringcentral.com/restapi/v1.0/account/133128004/extension/664573005/presence...;,
    "extension" : {
      "uri" : "https://platform.devtest.ringcentral.com/restapi/v1.0/account/133128004/extension/664573005";,
      "id" : 664573005,
      "extensionNumber" : "103"
    },
    "presenceStatus" : "Offline"
  }, {
    "uri" : "https://platform.devtest.ringcentral.com/restapi/v1.0/account/133128004/extension/134694004/presence...;,
    "extension" : {
      "uri" : "https://platform.devtest.ringcentral.com/restapi/v1.0/account/133128004/extension/134694004";,
      "id" : 134694004,
      "extensionNumber" : "104"
    },
    "presenceStatus" : "Offline",
    "telephonyStatus" : "NoCall",
    "userStatus" : "Offline",
    "dndStatus" : "DoNotAcceptAnyCalls"
  } ],
  "paging" : {
    "page" : 1,
    "totalPages" : 1,
    "perPage" : 100,
    "totalElements" : 6,
    "pageStart" : 0,
    "pageEnd" : 5
  },
  "navigation" : {
    "firstPage" : {
      "uri" : "https://platform.devtest.ringcentral.com/restapi/v1.0/account/133128004/presence?page=1&perPage=...;
    },
    "lastPage" : {
      "uri" : "https://platform.devtest.ringcentral.com/restapi/v1.0/account/133128004/presence?page=1&perPage=...;
    }
  }
}

If you are not seeing the same thing, just communicate the differences with the team handling your support ticket just as you have with me sir. This could possibly be 
Photo of Benjamin Dean

Benjamin Dean, Alum

  • 8,662 Points 5k badge 2x thumb
LOL. We were posting at the same time.

Here is the KB Article for managing presence for extensions: https://success.ringcentral.com/articles/RC_Knowledge_Article/How-to-set-up-Presence-permissions-for...
Photo of Spring IT

Spring IT

  • 310 Points 250 badge 2x thumb
Thanks for the documentation. I was searching around the wrong area :)

So, my question is this - What does your presenceByExtensionId result look like for extension 103 (you showed 101) when the presence is set to non visible? I would expect it to also show as "Offline", not as "Available" as I am seeing. 

I have checked that my example extension from above (extensionNumber: 492) does indeed have its presence set to visible.



So, based on your test here, I should indeed be seeing a presenceStatus of "Available" as it is showing as available here in the portal

Photo of Igor Bebin

Igor Bebin, Official Rep

  • 860 Points 500 badge 2x thumb
I'm afraid green icon on below screenshot is not the same as what you're getting via API:


This icon shows device registartion state, but not "presence" status. 

Could you please confirm the following:
1. So you're getting "presenceStatus" : "Offline" without any other details for ext 492 when polling {{rcApiBaseUri}}/v1.0/account/~/presence, but getting expected response for ({{rcApiBaseUri}}/v1.0/account/~/extension/{ext 492}/presence)?
2. How many Users/extensions do you have on account? 
3. Could you please provide extensionId?

Just in case, there is another way to get bulk response, e.g. ({{rcApiBaseUri}}/v1.0/account/~/extension/{ext1,ext2,ext3...}/presence)
Photo of Spring IT

Spring IT

  • 310 Points 250 badge 2x thumb
Thanks, Igor, for your reply.

Here is the phone status from Phones & Numbers => Phone Details for extension 492:



Is there something else that I should be checking?

Here are the answers to your questions:

1. Yes, this is exactly correct.
2. We have 4394 extensions.
3. I did not provide the extension ID as I was not sure if was something that should be kept confidential. If there is no reason not to share it, I will be happy to provide it.

I do understand that I can use the ({{rcApiBaseUri}}/v1.0/account/~/extension/{ext1,ext2,ext3...}/presence) URI as you mention, however, this has a limit of 30 extensionID's per call. So, while this does seem to work, It will be much, much less efficient than using the {{rcApiBaseUri}}/v1.0/account/~/presence URI.

Thanks again.
Photo of Anton Nikitin

Anton Nikitin, Official Rep

  • 3,024 Points 3k badge 2x thumb
We have an issue with this API for large accounts (actually for ones which have more than 300 extensions) which causes such such effect.
We plan to fix it as soon as possible. Actually account presence API was not publicly announced because of a number of known issues.

How critical is this issue for you use case? The answer will let us to prioritize it properly. 
Photo of Spring IT

Spring IT

  • 310 Points 250 badge 2x thumb
Thanks for the information, Anton. This is very good to know, and I am glad you are aware of the issue.

It would be really nice to use this account presence API call as it is a lot more efficient for what we are trying to accomplish, but I believe we can accomplish what we need for now by using the presence by ID call, it will just be a lot slower as we have a lot of extensions.

What is your current timeline for getting this issue resolved?

Thanks!
Photo of Anton Nikitin

Anton Nikitin, Official Rep

  • 3,024 Points 3k badge 2x thumb
We plan to fix it in the release which is coming into production in Feb 2017. 

Actually, do you really need to get presence of ALL extensions? What is your use case? Do you plan to poll it just once (to get initial state) and then subscribe to push notifications to get updates?
Photo of Spring IT

Spring IT

  • 310 Points 250 badge 2x thumb
This is great news! I will keep my eye out for the update in February.

My current plan was to poll it daily to get the current presence. However, it sounds like there may be a better way using notification subscriptions. I have not experimented with these yet and am not entirely sure how to use them, but I will search through the documentation to see what I can come up with.

Thanks!
Photo of Andy Haas

Andy Haas

  • 322 Points 250 badge 2x thumb
@Anton, How would I subscribe to the entire company to get presence update on those users?
Photo of Anton Nikitin

Anton Nikitin, Official Rep

  • 3,024 Points 3k badge 2x thumb
Andy, can you try subscribing with "/restapi/v1.0/account/~/presence" filter? Does it work for you?
Photo of Andy Haas

Andy Haas

  • 322 Points 250 badge 2x thumb
I have and I get no notification when I do that.
Photo of Andy Haas

Andy Haas

  • 322 Points 250 badge 2x thumb
This is working. allowSeeMyPresence was turned off for the user that I was using.