diff --git a/src/window/phone/index.tsx b/src/window/phone/index.tsx index 3db865e..dd3cd3a 100644 --- a/src/window/phone/index.tsx +++ b/src/window/phone/index.tsx @@ -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