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

[NEW] Enable outbound calling for EE #25843

Merged
merged 6 commits into from
Jun 21, 2022

Conversation

amolghode1981
Copy link
Contributor

@amolghode1981 amolghode1981 commented Jun 13, 2022

Proposed changes (including videos or screenshots)

Adding structure for supporting EE features for Voip client. This PR handles making outbound calls.

Issue(s)

Steps to test or reproduce

Further comments

Description: Creating EE structure for outbound dialing.
Refactored VoIPUser.ts and made necessary fields protected.
Created VoIPUser or EEVoipClient based on the licensing in SimpleVoipUser
Made necessary changes for using the voip client.
@amolghode1981 amolghode1981 changed the base branch from develop to new/voip-outbound June 13, 2022 13:35
Description: Adding missing file.
@amolghode1981 amolghode1981 marked this pull request as ready for review June 13, 2022 13:41
@amolghode1981 amolghode1981 requested review from a team as code owners June 13, 2022 13:41
apps/meteor/client/lib/voip/VoIPUser.ts Outdated Show resolved Hide resolved
apps/meteor/client/lib/voip/VoIPUser.ts Outdated Show resolved Hide resolved

const createRoom = useCallback(
async (caller: ICallerInfo): Promise<IVoipRoom['_id']> => {
if (user) {
Copy link
Contributor

Choose a reason for hiding this comment

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

if (!user) return '' to avoid nesting

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

this.setupRemoteMedia();
this.emit('callestablished');
this._callState = 'IN_CALL';
Copy link
Contributor

Choose a reason for hiding this comment

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

Even if the if is used, this will override the answer_received _callState. Is that expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This would not matter. The problem is there is no chance for the system to receive 2 states. i.e ANSWER_RECEIVED and IN_CALL for outbound call. I am setting it there assuming between the statements this._callState = 'ANSWER_RECEIVED'; and this._callState = 'IN_CALL'; if there is any async call happens, the _callstate should be consistent.

But for now, it does not matter as sip.js does not give us any callback when remote answer is received. (When remote answer is received and correct, there is just of formality of sending ACK. the call and media has already establised. But sematically they are 2 different states).

return;
}
stopRingback();
if (callDetails.userState === UserState.UAC) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (callDetails.userState === UserState.UAC) {
if (callDetails.userState !== UserState.UAC) { return }

To avoid nesting

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

Comment on lines 279 to 284
if (!result.voipClient) {
return;
}
if (!user) {
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (!result.voipClient) {
return;
}
if (!user) {
return;
}
if (!result.voipClient || !user || result.voipClient.userState !== UserState.UAC) {
return;
}

Copy link
Contributor Author

@amolghode1981 amolghode1981 Jun 15, 2022

Choose a reason for hiding this comment

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

result.voipClient.userState will not be a part of this if. Even if the voipClient.userState !== UAC, we do want to stop the ringback.
It will be just
if (!result.voipClient || !callDetails.callInfo) {
return;
}

Comment on lines 286 to 288
if (result.voipClient.userState === UserState.UAC) {
startRingback(user);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (result.voipClient.userState === UserState.UAC) {
startRingback(user);
}
startRingback(user);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

Description: Handling review comments.
Copy link
Contributor

@murtaza98 murtaza98 left a comment

Choose a reason for hiding this comment

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

It looks good to me but I'll leave the final approval to the Frontend guys :)

@@ -24,7 +26,9 @@ export class SimpleVoipUser {
connectionRetryCount: voipRetryCount,
enableKeepAliveUsingOptionsForUnstableNetworks: enableKeepAliveForUnstableNetworks,
};

if (await hasLicense('livechat-enterprise')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Here we are creating and using a new license called 'voip-enterprise'

@tiagoevanp
Copy link
Contributor

I will approve and merge, but needs more attention when new/voip-outbound->develop

@tiagoevanp tiagoevanp merged commit 877f0b1 into new/voip-outbound Jun 21, 2022
@tiagoevanp tiagoevanp deleted the voip-outbound/outboundcall branch June 21, 2022 17:57
kodiakhq bot pushed a commit that referenced this pull request Jun 28, 2022
* Clickup Task: https://app.clickup.com/t/22bmce2
Description: Creating EE structure for outbound dialing.
Refactored VoIPUser.ts and made necessary fields protected.
Created VoIPUser or EEVoipClient based on the licensing in SimpleVoipUser
Made necessary changes for using the voip client.

* Clickup Task: https://app.clickup.com/t/22bmce2
Description: Adding missing file.

* Clickup Task: https://app.clickup.com/t/22bmce2
Description: Connector changes for detecting the outbound call.

* Clickup Task: https://app.clickup.com/t/22bmce2
Description: Handling review comments.<!-- This is a pull request template, you do not need to uncomment or remove the comments, they won't show up in the PR text. -->

<!-- Your Pull Request name should start with one of the following tags
  [NEW] For new features
  [IMPROVE] For an improvement (performance or little improvements) in existing features
  [FIX] For bug fixes that affect the end-user
  [BREAK] For pull requests including breaking changes
  Chore: For small tasks
  Doc: For documentation
-->

<!-- Checklist!!! If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code. 
  - I have read the Contributing Guide - https://github.com/RocketChat/Rocket.Chat/blob/develop/.github/CONTRIBUTING.md#contributing-to-rocketchat doc
  - I have signed the CLA - https://cla-assistant.io/RocketChat/Rocket.Chat
  - Lint and unit tests pass locally with my changes
  - I have added tests that prove my fix is effective or that my feature works (if applicable)
  - I have added necessary documentation (if applicable)
  - Any dependent changes have been merged and published in downstream modules
-->

## Proposed changes (including videos or screenshots)
<!-- CHANGELOG -->
<!--
  Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request.
  If it fixes a bug or resolves a feature request, be sure to link to that issue below.
  This description will appear in the release notes if we accept the contribution.
-->

<!-- END CHANGELOG -->

## Issue(s)
<!-- Link the issues being closed by or related to this PR. For example, you can use #594 if this PR closes issue number 594 -->

## Steps to test or reproduce
<!-- Mention how you would reproduce the bug if not mentioned on the issue page already. Also mention which screens are going to have the changes if applicable -->

## Further comments
<!-- If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc... -->


Co-authored-by: amolghode1981 <86001342+amolghode1981@users.noreply.github.com>
Co-authored-by: Murtaza Patrawala <34130764+murtaza98@users.noreply.github.com>
Co-authored-by: Aleksander Nicacio da Silva <6494543+aleksandernsilva@users.noreply.github.com>
Co-authored-by: Tiago Evangelista Pinto <17487063+tiagoevanp@users.noreply.github.com>
Co-authored-by: Guilherme Gazzo <5263975+ggazzo@users.noreply.github.com>
gabriellsh added a commit that referenced this pull request Jun 28, 2022
…ove/message-renderer-tweaks

* 'develop' of github.com:RocketChat/Rocket.Chat:
  [NEW] Enable outbound calling for EE (#25843) (#25960)
  Chore: Introduce new index to query active livechat conversations for cloud scaling (#26047)
  [FIX] Importer fails to download files from URLs with query string params (#25934)
  [IMPROVE] Moved call hold/unhold to EE (#26007)
  [NEW] Engagement Metrics - Phase 2 (#25505)
  Chore: Convert usePreventDefault, useQueryOptions, useShortcutOpenMenu (#26035)
  [FIX] Importer files are unnecessarily transferred over the network. (#25919)
  Chore: test turbo params (#26038)
  Chore: Create a token for each action (#26023)
  Chore: Migrate oembed to ts (#25622)
  Regression: Fix voip call wrap-up model not working (#26024)
  Chore: Updating Apps-Engine  (#26001)
  [IMPROVE] Differ Voip calls from Incoming and Outgoing (#25643)
  [FIX] Append path To Route For Custom Emoji (#24379)
  [IMPROVE] Moved call wrap up modal to EE (#25875)
  Chore: Major refactors in pageobjects (#26015)
gabriellsh added a commit that referenced this pull request Jun 29, 2022
…/clientPackage

* 'develop' of github.com:RocketChat/Rocket.Chat: (80 commits)
  [NEW] Community Edition Watermark (#25844)
  [BREAK] remove unused endpoints and restify others (#25889)
  Chore: add underscore to ddp-streamer
  [IMPROVE] VoIP admin page cleanup: remove unused settings (#25993)
  Regression: Fix micro services (#26054)
  Regression: Fix threads list (#26052)
  [NEW] VoIP Input/Output Device Selection (#25966)
  Chore: Account/Profile to TS (#25929)
  Chore: Add missing Swedish livechat translations (#26048)
  [IMPROVE] Expand the feature set of the new message rendering (#25970)
  Chore: Bump fuselage and update icon (#26036)
  [NEW][APPS] Allowing apps to register authenticated routes (#25937)
  [NEW] Enable outbound calling for EE (#25843) (#25960)
  Chore: Introduce new index to query active livechat conversations for cloud scaling (#26047)
  [FIX] Importer fails to download files from URLs with query string params (#25934)
  [IMPROVE] Moved call hold/unhold to EE (#26007)
  [NEW] Engagement Metrics - Phase 2 (#25505)
  Chore: Convert usePreventDefault, useQueryOptions, useShortcutOpenMenu (#26035)
  [FIX] Importer files are unnecessarily transferred over the network. (#25919)
  Chore: test turbo params (#26038)
  ...
@murtaza98 murtaza98 mentioned this pull request Jul 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants