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(audio): improvements in audio logging #12899

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
50 changes: 38 additions & 12 deletions bigbluebutton-html5/imports/api/audio/client/bridge/sip.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ const getAudioSessionNumber = () => {
return currItem;
};

const getCurrentAudioSessionNumber = () => {
return sessionStorage.getItem(AUDIO_SESSION_NUM_KEY) || '0';
}

/**
* Get error code from SIP.js websocket messages.
Expand Down Expand Up @@ -324,7 +327,8 @@ class SIPSession {

const timeout = setTimeout(() => {
trackerControl.stop();
logger.error({ logCode: 'sip_js_transfer_timed_out' }, 'Timeout on transferring from echo test to conference');
logger.warn({ logCode: 'sip_js_transfer_timed_out' },
'Timeout on transferring from echo test to conference');
this.callback({
status: this.baseCallStates.failed,
error: 1008,
Expand Down Expand Up @@ -835,6 +839,7 @@ class SIPSession {

let iceCompleted = false;
let fsReady = false;
let sessionTerminated = false;

const setupRemoteMedia = () => {
const mediaElement = document.querySelector(MEDIA_TAG);
Expand Down Expand Up @@ -934,14 +939,14 @@ class SIPSession {

const handleIceNegotiationFailed = (peer) => {
if (iceCompleted) {
logger.error({
logger.warn({
logCode: 'sipjs_ice_failed_after',
extraInfo: {
callerIdName: this.user.callerIdName,
},
}, 'ICE connection failed after success');
} else {
logger.error({
logger.warn({
logCode: 'sipjs_ice_failed_before',
extraInfo: {
callerIdName: this.user.callerIdName,
Expand All @@ -961,7 +966,7 @@ class SIPSession {

const handleIceConnectionTerminated = (peer) => {
if (!this.userRequestedHangup) {
logger.error({
logger.warn({
logCode: 'sipjs_ice_closed',
extraInfo: {
callerIdName: this.user.callerIdName,
Expand Down Expand Up @@ -1062,9 +1067,8 @@ class SIPSession {
};
};

const handleSessionTerminated = (message) => {
clearTimeout(callTimeout);
clearTimeout(iceNegotiationTimeout);
const checkIfCallStopped = (message) => {
if (fsReady || !sessionTerminated) return null;

if (!message && !!this.userRequestedHangup) {
return this.callback({
Expand All @@ -1088,7 +1092,7 @@ class SIPSession {
mappedCause = '1005';
}

logger.error({
logger.warn({
logCode: 'sip_js_call_terminated',
extraInfo: { cause, callerIdName: this.user.callerIdName },
}, `Audio call terminated. cause=${cause}`);
Expand All @@ -1099,6 +1103,19 @@ class SIPSession {
bridgeError: cause,
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) => {
Expand All @@ -1117,7 +1134,7 @@ class SIPSession {
handleSessionTerminated();
break;
default:
logger.error({
logger.warn({
logCode: 'sipjs_ice_session_unknown_state',
extraInfo: {
callerIdName: this.user.callerIdName,
Expand All @@ -1129,17 +1146,26 @@ class SIPSession {
});

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);

query.observeChanges({
changed: (id, fields) => {
if ((this.inEchoTest && fields.callState === CallStateOptions.IN_ECHO_TEST)
|| (!this.inEchoTest && fields.callState === CallStateOptions.IN_CONFERENCE)) {
if (!fsReady && ((this.inEchoTest && fields.callState === CallStateOptions.IN_ECHO_TEST)
|| (!this.inEchoTest && fields.callState === CallStateOptions.IN_CONFERENCE))) {
fsReady = true;
checkIfCallReady();
}

if (fields.callState === CallStateOptions.CALL_ENDED) {
fsReady = false;
c.stop();
checkIfCallStopped();
}
},
});
Expand Down