Reduce delay for the first reconnection attempt of audio's websocket

This is the same behavior we used to have on older sip.js version code
By doing this we reduce errors when user try to perform join/hangup during an websocket reconnection
This commit is contained in:
Mario Jr 2020-11-23 12:40:38 -03:00
parent 5d4d9ab0f5
commit af48c8977d

View File

@ -541,19 +541,19 @@ class SIPSession {
},
}, `User agent reconnection attempt ${attempts}`);
setTimeout(() => {
this.userAgent.reconnect().then(() => {
this._reconnecting = false;
resolve();
}).catch(() => {
this.userAgent.reconnect().then(() => {
this._reconnecting = false;
resolve();
}).catch(() => {
setTimeout(() => {
this._reconnecting = false;
this.reconnect(++attempts).then(() => {
resolve();
}).catch((error) => {
reject(error);
});
});
}, USER_AGENT_RECONNECTION_DELAY_MS);
}, USER_AGENT_RECONNECTION_DELAY_MS);
});
});
}