Increase default iceGatheringTimeout

Added a default 'MEDIA' option: iceGatheringTimeout. This option allows admin to set a higher ICE gathering timeout, which can help when getting ICE errors during audio negotiation (eg 1004)
Default value set to 15s (current default is 5s).
This commit is contained in:
Mario Jr 2020-10-23 11:21:20 -03:00
parent 993c3a5a8a
commit a86ff72aa3
2 changed files with 20 additions and 9 deletions

View File

@ -30,6 +30,7 @@ const AUDIO_SESSION_NUM_KEY = 'AudioSessionNumber';
const USER_AGENT_RECONNECTION_ATTEMPTS = 3;
const USER_AGENT_RECONNECTION_DELAY_MS = 5000;
const USER_AGENT_CONNECTION_TIMEOUT_MS = 5000;
const ICE_GATHERING_TIMEOUT = MEDIA.iceGatheringTimeout || 15000;
const getAudioSessionNumber = () => {
let currItem = parseInt(sessionStorage.getItem(AUDIO_SESSION_NUM_KEY), 10);
@ -562,6 +563,7 @@ class SIPSession {
: audioDeviceConstraint,
video: false,
},
iceGatheringTimeout: ICE_GATHERING_TIMEOUT,
},
sessionDescriptionHandlerModifiersPostICEGathering:
[stripMDnsCandidates],
@ -791,11 +793,11 @@ class SIPSession {
};
};
const handleSessionTerminated = (message, cause) => {
const handleSessionTerminated = (message) => {
clearTimeout(callTimeout);
clearTimeout(iceNegotiationTimeout);
if (!message && !cause && !!this.userRequestedHangup) {
if (!message && !!this.userRequestedHangup) {
return this.callback({
status: this.baseCallStates.ended,
});
@ -805,18 +807,22 @@ class SIPSession {
// any possile errors
if (!this._currentSessionState) return false;
let mappedCause;
let cause;
if (!iceCompleted) {
mappedCause = '1004';
cause = 'ICE error';
} else {
cause = 'Audio Conference Error';
mappedCause = '1005';
}
logger.error({
logCode: 'sip_js_call_terminated',
extraInfo: { cause, callerIdName: this.user.callerIdName },
}, `Audio call terminated. cause=${cause}`);
let mappedCause;
if (!iceCompleted) {
mappedCause = '1004';
} else {
mappedCause = '1005';
}
return this.callback({
status: this.baseCallStates.failed,
error: mappedCause,

View File

@ -284,6 +284,11 @@ public:
echoTestNumber: 'echo'
relayOnlyOnReconnect: false
listenOnlyCallTimeout: 25000
#Timeout (ms) for gathering ICE candidates. When this timeout expires
#the SDP is sent to the server with the candidates the browser gathered
#so far. Increasing this value might help avoiding 1004 error when
#user activates microphone.
iceGatheringTimeout: 15000
presentation:
defaultPresentationFile: default.pdf
panZoomThrottle: 32