diff --git a/apps/meteor/ee/client/hooks/useVoipClient.ts b/apps/meteor/ee/client/hooks/useVoipClient.ts index 93048c50016a..abf01e50752c 100644 --- a/apps/meteor/ee/client/hooks/useVoipClient.ts +++ b/apps/meteor/ee/client/hooks/useVoipClient.ts @@ -39,23 +39,25 @@ export const useVoipClient = (): UseVoipClientResult => { const isEE = useHasLicenseModule('voip-enterprise'); const voipEnabled = settingVoipEnabled && voipConnectorEnabled; - useEffect( - () => - subscribeToNotifyLoggedIn(`voip.statuschanged`, (enabled: boolean): void => { - setVoipConnectorEnabled(enabled); - }), - [setResult, setVoipConnectorEnabled, subscribeToNotifyLoggedIn], - ); + useEffect(() => { + if (!voipEnabled || !user) { + return; + } + subscribeToNotifyLoggedIn(`voip.statuschanged`, (enabled: boolean): void => { + setVoipConnectorEnabled(enabled); + }); + }, [user, voipEnabled, setResult, setVoipConnectorEnabled, subscribeToNotifyLoggedIn]); useEffect(() => { const uid = user?._id; const userExtension = user?.extension; - if (!uid || !userExtension || !voipEnabled) { setResult(empty); return; } + let client: VoIPUser; + registrationInfo({ id: uid }).then( (data) => { let parsedData: IRegistrationInfo;