Skip to content

Commit

Permalink
[FIX] Client disconnection on network loss (#25170)
Browse files Browse the repository at this point in the history
* Clickup Task: https://app.clickup.com/t/245c0d8
Description:
Agent gets disconnected (or Unregistered) from asterisk in multiple ways. The goal is that agent should remain online
unless agent explicitly logs off.
Agent can stop receiving calls in multiple ways due to network loss. Network loss can happen in following ways.
1. User tries to switch the network. User experiences a glitch of disconnectivity. This can be simulated by turning the network off
in the network tab of chrome's dev tool. This can disconnect the UA if the disconnection happens just before the registration refresh.
2. Second reason is when computer goes in sleep mode.
3. Third reason is that when asterisk is crashed/in maintenance mode/explicitly stopped.

Solution:
The idea is to detect the network disconnection and start the start the attempts to reconnect.
The detection of the disconnection does not happen in case#1. The SIPUA's UserAgent transport does not
call onDisconnected when network loss of such kind happens. To tackle this problem, window's online and offline event handlers are
used.

The number of retries is configurable but ideally it is to be kept at -1. Whenever disconnection happens, it should keep on trying to
reconnect with increasing backoff time. This behaviour is useful when the asterisk is stopped.

When the server is disconnected, it should be indicated on the phone button.

* Clickup Task: https://app.clickup.com/t/245c0d8
Description:
1. Replaced complex state handling in OmnichannelCallToggleReady.tsx. This was creating lot of erros.
Added simple network status check and the phone button displays the latest state of things.
2. Some files were overwriting the changes in develop branch. Replaced that with correct changes.

* Clickup Task: https://app.clickup.com/t/245c0d8
Description: Adding semi-colon to fix error.

* Clickup Task : https://app.clickup.com/t/245c0d8
Description : Fixing review commnts.

* removing unused files

* Clickup Task: https://app.clickup.com/t/245c0d8
Description:
Renaming file to correct the spelling. Making necessary changes in index.ts

* Clickup Task: https://app.clickup.com/t/245c0d8
Description:
Fixing incorrect spelling.

* Add description to setting

Co-authored-by: Kevin Aleman <kaleman960@gmail.com>
  • Loading branch information
amolghode1981 and KevLehman authored Apr 20, 2022
1 parent f5b18a0 commit d1318e2
Show file tree
Hide file tree
Showing 12 changed files with 388 additions and 112 deletions.
8 changes: 8 additions & 0 deletions apps/meteor/app/lib/server/startup/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3209,6 +3209,14 @@ settingsRegistry.addGroup('Call_Center', function () {
value: true,
},
});
this.add('VoIP_Retry_Count', -1, {
type: 'int',
public: true,
enableQuery: {
_id: 'VoIP_Enabled',
value: true,
},
});
});

this.section('Management_Server', function () {
Expand Down
3 changes: 2 additions & 1 deletion apps/meteor/client/lib/voip/SimpleVoipUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export class SimpleVoipUser {
registrar: string,
webSocketPath: string,
iceServers: Array<object>,
voipRetryCount: number,
callType?: 'audio' | 'video',
mediaStreamRendered?: IMediaStreamRenderer,
): Promise<VoIPUser> {
Expand All @@ -17,9 +18,9 @@ export class SimpleVoipUser {
authPassword: password,
sipRegistrarHostnameOrIP: registrar,
webSocketURI: webSocketPath,

enableVideo: callType === 'video',
iceServers,
connectionRetryCount: voipRetryCount,
};

return VoIPUser.create(config, mediaStreamRendered);
Expand Down
Loading

0 comments on commit d1318e2

Please sign in to comment.