Skip to content
Snippets Groups Projects
Commit 2f75f610 authored by Mario Jr's avatar Mario Jr
Browse files

fix(audio): prevent false positive alerts of 1005 error

After reconnecting (with 1007 or 1005), user may gets 1005 when meeting
is ended by moderator.
parent 6db69c39
No related branches found
No related tags found
No related merge requests found
...@@ -60,6 +60,9 @@ const getAudioSessionNumber = () => { ...@@ -60,6 +60,9 @@ const getAudioSessionNumber = () => {
return currItem; return currItem;
}; };
const getCurrentAudioSessionNumber = () => {
return sessionStorage.getItem(AUDIO_SESSION_NUM_KEY) || '0';
}
/** /**
* Get error code from SIP.js websocket messages. * Get error code from SIP.js websocket messages.
...@@ -830,6 +833,7 @@ class SIPSession { ...@@ -830,6 +833,7 @@ class SIPSession {
let iceCompleted = false; let iceCompleted = false;
let fsReady = false; let fsReady = false;
let sessionTerminated = false;
const setupRemoteMedia = () => { const setupRemoteMedia = () => {
const mediaElement = document.querySelector(MEDIA_TAG); const mediaElement = document.querySelector(MEDIA_TAG);
...@@ -1057,9 +1061,8 @@ class SIPSession { ...@@ -1057,9 +1061,8 @@ class SIPSession {
}; };
}; };
const handleSessionTerminated = (message) => { const checkIfCallStopped = (message) => {
clearTimeout(callTimeout); if (fsReady || !sessionTerminated) return null;
clearTimeout(iceNegotiationTimeout);
if (!message && !!this.userRequestedHangup) { if (!message && !!this.userRequestedHangup) {
return this.callback({ return this.callback({
...@@ -1094,6 +1097,19 @@ class SIPSession { ...@@ -1094,6 +1097,19 @@ class SIPSession {
bridgeError: cause, bridgeError: cause,
bridge: BRIDGE_NAME, bridge: BRIDGE_NAME,
}); });
}
const handleSessionTerminated = (message) => {
logger.info({
logCode: 'sip_js_session_terminated',
extraInfo: { callerIdName: this.user.callerIdName },
}, 'SIP.js session terminated');
clearTimeout(callTimeout);
clearTimeout(iceNegotiationTimeout);
sessionTerminated = true;
checkIfCallStopped();
}; };
currentSession.stateChange.addListener((state) => { currentSession.stateChange.addListener((state) => {
...@@ -1124,17 +1140,26 @@ class SIPSession { ...@@ -1124,17 +1140,26 @@ class SIPSession {
}); });
Tracker.autorun((c) => { Tracker.autorun((c) => {
const selector = { meetingId: Auth.meetingID, userId: Auth.userID }; const selector = {
meetingId: Auth.meetingID,
userId: Auth.userID,
clientSession: getCurrentAudioSessionNumber(),
};
const query = VoiceCallStates.find(selector); const query = VoiceCallStates.find(selector);
query.observeChanges({ query.observeChanges({
changed: (id, fields) => { changed: (id, fields) => {
if ((this.inEchoTest && fields.callState === CallStateOptions.IN_ECHO_TEST) if (!fsReady && ((this.inEchoTest && fields.callState === CallStateOptions.IN_ECHO_TEST)
|| (!this.inEchoTest && fields.callState === CallStateOptions.IN_CONFERENCE)) { || (!this.inEchoTest && fields.callState === CallStateOptions.IN_CONFERENCE))) {
fsReady = true; fsReady = true;
checkIfCallReady(); checkIfCallReady();
}
if (fields.callState === CallStateOptions.CALL_ENDED) {
fsReady = false;
c.stop(); c.stop();
checkIfCallStopped();
} }
}, },
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment