Merge pull request #36 from jambonz/feat/fix_phone_keep_retry_connect

fixed the phone online toggle button is not able to turn off when wss is disconnect
This commit is contained in:
Dave Horton
2024-09-13 16:11:47 +01:00
committed by GitHub

View File

@@ -309,18 +309,24 @@ export const Phone = ({
unregisteredReasonRef.current = "";
}
setStatus("disconnected");
if (isRestartRef.current) {
createSipClient();
isRestartRef.current = false;
setIsOnline(false);
setIsSwitchingUserStatus(false);
if (sipUA.current) {
sipUA.current.stop();
}
if (args.error) {
toast({
title: `Cannot connect to ${sipServerAddress}, ${args.reason}`,
title: `Cannot connect to ${sipServerAddress}${
args.reason ? `, ${args.reason}` : ""
}`,
status: "warning",
duration: DEFAULT_TOAST_DURATION,
isClosable: true,
});
} else if (isRestartRef.current) {
createSipClient();
isRestartRef.current = false;
}
});
// Call Status