voximplant / react-native-demo

React Native Voximplant Demo
173 stars 146 forks source link

Established Connection Issue #83

Open shayan555 opened 3 years ago

shayan555 commented 3 years ago

Hi All,

We are facing issue once the connection disconnected then not able to reestablished the connection and showing error 'Temporarily Unavailable'

YuliaGrigorieva commented 3 years ago

Hello @shayan555 ,

Do you mean that the callee does not receive the incoming call and the caller gets "Temporary unavailble" error from CallFailed event?

Best regards, Yulia Grigorieva

shayan555 commented 3 years ago

Log : Client: emit event ConnectionClosed

Once the connection closed then callee does not receive the incoming call and the caller gets "Temporary unavailble" error from CallFailed

ahammedmishal commented 1 year ago

yes i got the same issue after some time after login when we call the user it will show Call failed : 'Temporarily Unavailable'

wilmxre commented 1 year ago

@ahammedmishal did you manage to fix this issue?

ahammedmishal commented 1 year ago

@ahammedmishal did you manage to fix this issue?

Yes i used direct google translation api

ahammedmishal commented 1 year ago

@ahammedmishal did you manage to fix this issue?

there is no fix by them so do your own logic. this happened voxim connection goes offf

wilmxre commented 1 year ago

@ahammedmishal how did you fix it?

ahammedmishal commented 1 year ago

in the root file of the app, i do like this .this temporarily unavailable mean that the user is not logged in,this happen after some time or app goes backgound or due to internet issues the voximplant connection will go so that time we need to call this function in every 5 seconds useEffect(() => { testConnection = async () => { let state = await Voximplant.getInstance().getClientState();
if (state !== Voximplant.ClientState.DISCONNECTED) {
loginWithToken(); } else { await Voximplant.getInstance().connect(); } }; const interval = setInterval(testConnection, 5000); return () => clearInterval(interval); }, []);

loginWithToken = async () => { try { let state = await Voximplant.getInstance().getClientState(); if (state === Voximplant.ClientState.DISCONNECTED) { await Voximplant.getInstance().connect(); } if (state !== Voximplant.ClientState.LOGGED_IN) { let usernames = ${userFullDetails?.username}@sdk-tutorial-exampleapp; let passwords = ${userFullDetails?.uid}; const loginClicked = async (usernames, passwords) => { await AsyncStorage.setItem('usernameValue', usernames); await AsyncStorage.setItem('uid', passwords); LoginManager.getInstance().loginWithPassword( usernames + '.voximplant.com', passwords, ); }; loginClicked(usernames, passwords); } } catch (e) { console.log('LoginManager: loginWithToken: ' + e.name); if (e.name === Voximplant.ClientEvents.AuthResult) { console.log('LoginManager: loginWithToken: error code: ' + e.code); } } };