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.
This commit is contained in:
parent
6db69c39d8
commit
2f75f6107e
@ -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 {
|
|||||||
|
|
||||||
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 {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
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 {
|
|||||||
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 {
|
|||||||
});
|
});
|
||||||
|
|
||||||
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();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user