You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
})
.catch((error) => {
isRegistering = false;
console.error("Error starting the UserAgent:", error);
});
} I’ve reviewed the SIP.js documentation and attempted to use the onDisconnect and onConnect delegates for handling reconnections, but I'm unable to achieve reliable re-registration.
Any guidance or recommendations would be greatly appreciated.
The text was updated successfully, but these errors were encountered:
I am facing an issue with reconnection handling in SIP.js when the WebSocket connection is lost or the network is disconnected. After a disconnection, the onDisconnect delegate is triggered, but the UserAgent doesn't reconnect properly, and I can't maintain registration automatically.
const transportOptions = {
server: "wss:///ws",
traceSip: true,
iceCheckingTimeout: 35000,
register: true,
stunServers: ["stun:stun.l.google.com:19302"],
turnServers: [
{
urls: "t",
username: "",
credential: "",
},
],
connectionTimeout: 5,
maxReconnectionAttempts : 100,
reconnectionTimeout: 4,
keepAliveInterval: 10
};
const handleRegister = (event) => {
const uri = UserAgent.makeURI(
sip:${sipUri}@
);const userAgentOptions = {
authorizationUsername: sipUri,
authorizationPassword: "",
transportOptions,
uri,
delegate: {
onInvite,
onDisconnect: (error) => {
alert("disconnected")
console.log("Network connectivity lost");
if (!error) {
console.log("User agent stopped");
}
},
onConnect: () => {
alert("connected")
handleRegister();
console.log("Network connectivity established");
},
};
const ua = new UserAgent(userAgentOptions);
setUserAgent(ua);
ua.start()
.then(() => {
const registerer = new Registerer(ua);
return registerer.register({
requestDelegate: {
onAccept(response) {
isRegistering = false;
alert("registerred successfully")
console.log("UserAgent registered successfully", response);
},
onReject(sip) {
isRegistering = false; // Reset flag on failure
console.log("UserAgent registration failed", sip);
})
.catch((error) => {
isRegistering = false;
console.error("Error starting the UserAgent:", error);
});
} I’ve reviewed the SIP.js documentation and attempted to use the onDisconnect and onConnect delegates for handling reconnections, but I'm unable to achieve reliable re-registration.
Any guidance or recommendations would be greatly appreciated.
The text was updated successfully, but these errors were encountered: