mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
do not end call if connection fails, instead wait for new offer
This commit is contained in:
parent
0cb4a13494
commit
0719700371
3 changed files with 20 additions and 2 deletions
|
@ -31,7 +31,7 @@ window.getNodeVersion = () => config.node_version;
|
|||
|
||||
window.sessionFeatureFlags = {
|
||||
useOnionRequests: true,
|
||||
useCallMessage: false,
|
||||
useCallMessage: true,
|
||||
};
|
||||
|
||||
window.versionInfo = {
|
||||
|
|
|
@ -5,6 +5,7 @@ import { openConversationWithMessages } from '../../../state/ducks/conversations
|
|||
import {
|
||||
answerCall,
|
||||
callConnected,
|
||||
callReconnecting,
|
||||
CallStatusEnum,
|
||||
endCall,
|
||||
incomingCall,
|
||||
|
@ -601,7 +602,7 @@ function handleConnectionStateChanged(pubkey: string) {
|
|||
window.log.info('handleConnectionStateChanged :', peerConnection?.connectionState);
|
||||
|
||||
if (peerConnection?.signalingState === 'closed' || peerConnection?.connectionState === 'failed') {
|
||||
closeVideoCall();
|
||||
window.inboxStore?.dispatch(callReconnecting({ pubkey }));
|
||||
} else if (peerConnection?.connectionState === 'connected') {
|
||||
const firstAudioInput = audioInputsList?.[0].deviceId || undefined;
|
||||
if (firstAudioInput) {
|
||||
|
|
|
@ -76,6 +76,22 @@ const callSlice = createSlice({
|
|||
state.callIsInFullScreen = false;
|
||||
return state;
|
||||
},
|
||||
callReconnecting(state: CallStateType, action: PayloadAction<{ pubkey: string }>) {
|
||||
const callerPubkey = action.payload.pubkey;
|
||||
if (callerPubkey !== state.ongoingWith) {
|
||||
window.log.info('cannot reconnect a call we did not start or receive first');
|
||||
return state;
|
||||
}
|
||||
const existingCallState = state.ongoingCallStatus;
|
||||
|
||||
if (existingCallState !== 'ongoing') {
|
||||
window.log.info('cannot reconnect a call we are not ongoing');
|
||||
return state;
|
||||
}
|
||||
|
||||
state.ongoingCallStatus = 'connecting';
|
||||
return state;
|
||||
},
|
||||
startingCallWith(state: CallStateType, action: PayloadAction<{ pubkey: string }>) {
|
||||
if (state.ongoingWith) {
|
||||
window.log.warn('cannot start a call with an ongoing call already: ongoingWith');
|
||||
|
@ -112,6 +128,7 @@ export const {
|
|||
endCall,
|
||||
answerCall,
|
||||
callConnected,
|
||||
callReconnecting,
|
||||
startingCallWith,
|
||||
setFullScreenCall,
|
||||
} = actions;
|
||||
|
|
Loading…
Reference in a new issue