webex/webex-js-sdk

Webex JS SDK Calling - Devices not being unregistered

rajravat opened this issue · 11 comments

We are currently using the webex js sdk calling features in a solution. Some of the devs occasionally see an error stating that "User has excessive device registrations". We are unregistering the line by calling line.deregister() method as per the Kitchen Sink example app and we see the line.on("unregistrated") callback fire successfully, but we still continue to see this error.

What i have observed is that calling this endpoint shows devices that are registered when the user logs in:

https://wdm-k.wbx2.com/wdm/api/v1/devices/

however, the devices do not get removed from here when line.deregister() is called, is this a bug? They do eventually disappear from that endpoint after a few days, but it doesn't seem to be anything that we have control over, is anyone able to advise if this is a bug and/or if there are other things we can do to prevent getting the "excessive device registrations" error?

We are using the 3.0.0-next-1 SDK via unpkg from https://unpkg.com/webex@3.0.0-next.1/umd/calling.min.js

I am also aware that we can log into https://idbroker-eu.webex.com/idb/profile#/tokens and click "end session", but this only seems to be related to tokens, not devices.

Thanks

@rajravat can you please explain a bit more about your authorization flow? How many devices are you registering? Is it possible that unregister() is not part of your regular flow, meaning that you only call that function if you are seeing the error "User has excessive device registrations"?
Note that it is good practice to unregister the device as soon as it is not needed anymore. Every registered device counts against your limit of 750 tokens. The https://idbroker-eu.webex.com/idb/profile#/tokens link is one way of de-registering unused devices, another one is to use this API https://developer.webex.com/docs/api/v1/authorizations .

A single user logs into a desktop application (we are using the Edge WebView2 embedded into the app). This is done via auth code flow as explained on the cisco dev docs, we get an auth code and exchange it for an access token.

We then call Calling.init and pass the credentials through as can be seen in the code below:

image

image

once the user has closed down the application we call line.register()
image

We successfully see the "unregistered device successfully" message in the console.

however, querying the following url, we do not see the device get removed:
https://wdm-k.wbx2.com/wdm/api/v1/devices/

@rajravat thanks for the reply. In this case we would need to dig deeper to find out why the device is not removed from the list. We would need full Console logs for that and since it might contain personal info, best would be to create a Dev Support ticket for this - https://developer.webex.com/support . Thanks

Thanks,

you can reproduce the same problem using the sample kitchen sink app website:

https://webex.github.io/webex-js-sdk/samples/calling/

  1. Put in your access token
  2. Initialise calling

At this point if you perform a get request on this url (https://wdm-k.wbx2.com/wdm/api/v1/devices/), you will see the device registration it has just created.

  1. Click register
  2. Click unregister (which called line.deregister()

Check the url again (https://wdm-k.wbx2.com/wdm/api/v1/devices/) and you will see it has not removed any devices.

You can then press f5 and perform the same actions again and see that more and more devices just get added to the wdm url without getting removed.

I've noticed in the bot framework api, it has a function to delete all the registrations:

https://github.com/WebexCommunity/webex-node-bot-framework/blob/main/lib/websocket.js
image

@rajravat thanks for the instructions, I was able to replicate this on the Calling Kitchensink app. We are working on it with the SDK engineering team and will let you know.

@rajravat short update:
this is working as designed right now.

There are 2 device registrations that occur in the Calling SDK.

WDM registration to create a web device in Webex.
Registration with Webex Calling which creates the registration for the line.
The line.deregister() does not unregister the WDM. WDM device deletion is a different method which we have not exposed on the Calling SDK.
We will investigate our code and check if we can trigger a WDM deletion from the Calling SDK method.

Thanks for the update

cc @sreenara , delete on WDM

Thanks,

you can reproduce the same problem using the sample kitchen sink app website:

https://webex.github.io/webex-js-sdk/samples/calling/

  1. Put in your access token
  2. Initialise calling

At this point if you perform a get request on this url (https://wdm-k.wbx2.com/wdm/api/v1/devices/), you will see the device registration it has just created.

  1. Click register
  2. Click unregister (which called line.deregister()

Check the url again (https://wdm-k.wbx2.com/wdm/api/v1/devices/) and you will see it has not removed any devices.

You can then press f5 and perform the same actions again and see that more and more devices just get added to the wdm url without getting removed.

I've noticed in the bot framework api, it has a function to delete all the registrations:

https://github.com/WebexCommunity/webex-node-bot-framework/blob/main/lib/websocket.js image

We will need to expose this as part of webex object i think , @jbenyovs

BTW, the same issue can be reproed on Webex JS SDK Meeting as well. You can repro it using the meeting kitchen app https://webex.github.io/webex-js-sdk/samples/browser-plugin-meetings/

@rajravat this issue is fixed and is available as part of webex@3.0.0-next.31

So, instead of line.deregister() you can start calling the method calling.deregister() which will take care of deregistering all the active lines and also deregistering the WDM devices. If you do that, you will not see the error anymore. Please try out and see if it works for you too.

Thank you