Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(calling): wdm deregister method #3609

Merged
merged 7 commits into from
May 28, 2024

Conversation

mkesavan13
Copy link
Contributor

@mkesavan13 mkesavan13 commented May 22, 2024

COMPLETES SPARK-509669

This pull request addresses

2 device registrations occur in the Calling SDK.

  • calling.register which calls the internal.device.register from webex/calling.js
  • line.register which does the Mobius line registration

While we have the above two methods for deregistering, we do not have a deregister method only for line and not for calling which does the WDM device deletion operation

by making the following changes

  • This PR introduces that method in webex/calling.js - The Calling class such that, users can do this deregister upon successful deregistering of line
  • Or, they can call calling.deregister() method alone which will deregister all the active lines, disconnect mercury and delete WDM device as well

Recording

In the below recordings, you can see that the WDM device and Mercury registration doesn't happen before this change and they happen in the after-change screen recording,

Before:

Device.Deregister.-.Before.mov

After:

calling.deregister cleans up active lines automatically and deletes the WDM registration

Screen.Recording.2024-05-22.at.3.01.46.PM.mov

calling.deregister just deletes the WDM registration

Device.Deregister.-.After.line.deregister.mov

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Tooling change
  • Internal code refactor

The following scenarios where tested

  • Tested if the device registers and deregisters
  • Tried registering and deregistering several times to see if the "User has excessive device registrations" error pops up and it doesn't now

I certified that

  • I have read and followed contributing guidelines

  • I discussed changes with code owners prior to submitting this pull request

  • I have not skipped any automated checks

  • All existing and new tests passed

  • I have updated the documentation accordingly


Make sure to have followed the contributing guidelines before submitting.

@mkesavan13 mkesavan13 requested a review from a team as a code owner May 22, 2024 09:48
@mkesavan13 mkesavan13 added the validated If the pull request is validated for automation. label May 22, 2024
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-3609.d3m3l2kee0btzx.amplifyapp.com

const lineIds = Object.keys(this.callingClient?.getLines());

const lines = lineIds.length ? this.callingClient.getLines() : {};
for (const lineId of lineIds) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't we run the loop directly on the lines array? Why do we need to maintain another array of lineIds?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • lines isn't an array. It is an object that contains { lineId: lineObject }
  • When we do a for..in loop, it would go through prototype keys as well. Linter fails
  • That is why we had to get lineIds in an array and then use it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getLines() API returns Record<string, ILine> so similar to how we are doing Object.keys() to fetch the keys which is lineId, we can do Object.values() which will return line array and then we can run for loop in the line array returned.

packages/webex/src/calling.js Outdated Show resolved Hide resolved
Copy link
Contributor

@sreenara sreenara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one change needed regarding timeout

);
resolve();
});
setTimeout(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We won't need a timeout and reject here, once a deregister is called, assume that the user doesn't care about the result anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. I agree. Makes sense. Let me remove it.

@mkesavan13 mkesavan13 force-pushed the calling-deregister branch from 2521a9f to 9b4add4 Compare May 24, 2024 14:12
Copy link
Contributor

@Kesari3008 Kesari3008 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take care of the last comment and check why integration test is failing

@mkesavan13 mkesavan13 merged commit 6fc6ad1 into webex:next May 28, 2024
10 of 11 checks passed
@mkesavan13 mkesavan13 deleted the calling-deregister branch June 20, 2024 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
validated If the pull request is validated for automation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants