Skip to content

Commit

Permalink
fix: Don't try to listen to voip stream when not enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinSchoeler committed Dec 6, 2023
1 parent 9720def commit 1a3510d
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions apps/meteor/ee/client/hooks/useVoipClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1a3510d

Please sign in to comment.