Do not start a call while one is in progress.

This commit is contained in:
Greyson Parrelli
2026-04-02 08:57:48 -04:00
parent f81325e7ca
commit 518a81c7fa
3 changed files with 31 additions and 0 deletions
@@ -43,6 +43,11 @@ class CallLinkPreJoinActionProcessor(
override fun handlePreJoinCall(currentState: WebRtcServiceState, remotePeer: RemotePeer): WebRtcServiceState {
Log.i(TAG, "handlePreJoinCall():")
if (currentState.callInfoState.groupCall != null) {
Log.w(TAG, "handlePreJoinCall(): Group call already exists, ignoring duplicate pre-join request")
return currentState
}
val groupCall = try {
val callLink = callLinks.getCallLinkByRoomId(remotePeer.recipient.requireCallLinkRoomId())
if (callLink?.credentials == null) {
@@ -3,8 +3,10 @@ package org.thoughtcrime.securesms.service.webrtc;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.ResultReceiver;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import org.signal.core.util.logging.Log;
import org.signal.ringrtc.CallException;
@@ -37,6 +39,14 @@ public class GroupNetworkUnavailableActionProcessor extends WebRtcActionProcesso
this.actionProcessorFactory = actionProcessorFactory;
}
@Override
protected @NonNull WebRtcServiceState handleIsInCallQuery(@NonNull WebRtcServiceState currentState, @Nullable ResultReceiver resultReceiver) {
if (resultReceiver != null) {
resultReceiver.send(1, ActiveCallData.fromCallState(currentState).toBundle());
}
return currentState;
}
@Override
protected @NonNull WebRtcServiceState handlePreJoinCall(@NonNull WebRtcServiceState currentState, @NonNull RemotePeer remotePeer) {
Log.i(TAG, "handlePreJoinCall():");
@@ -1,6 +1,9 @@
package org.thoughtcrime.securesms.service.webrtc;
import android.os.ResultReceiver;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.annimon.stream.Stream;
@@ -43,10 +46,23 @@ public class GroupPreJoinActionProcessor extends GroupActionProcessor {
super(actionProcessorFactory, webRtcInteractor, tag);
}
@Override
protected @NonNull WebRtcServiceState handleIsInCallQuery(@NonNull WebRtcServiceState currentState, @Nullable ResultReceiver resultReceiver) {
if (resultReceiver != null) {
resultReceiver.send(1, ActiveCallData.fromCallState(currentState).toBundle());
}
return currentState;
}
@Override
protected @NonNull WebRtcServiceState handlePreJoinCall(@NonNull WebRtcServiceState currentState, @NonNull RemotePeer remotePeer) {
Log.i(tag, "handlePreJoinCall():");
if (currentState.getCallInfoState().getGroupCall() != null) {
Log.w(tag, "handlePreJoinCall(): Group call already exists, ignoring duplicate pre-join request");
return currentState;
}
byte dredDuration = (byte) RemoteConfig.dredDuration();
byte[] groupId = currentState.getCallInfoState().getCallRecipient().requireGroupId().getDecodedId();
GroupCall groupCall = webRtcInteractor.getCallManager().createGroupCall(groupId,