use of org.signal.ringrtc.CallException in project Signal-Android by WhisperSystems.
the class IncomingCallActionProcessor method handleAcceptCall.
@Override
@NonNull
protected WebRtcServiceState handleAcceptCall(@NonNull WebRtcServiceState currentState, boolean answerWithVideo) {
RemotePeer activePeer = currentState.getCallInfoState().requireActivePeer();
Log.i(TAG, "handleAcceptCall(): call_id: " + activePeer.getCallId());
SignalDatabase.sms().insertReceivedCall(activePeer.getId(), currentState.getCallSetupState(activePeer).isRemoteVideoOffer());
currentState = currentState.builder().changeCallSetupState(activePeer.getCallId()).acceptWithVideo(answerWithVideo).build();
try {
webRtcInteractor.getCallManager().acceptCall(activePeer.getCallId());
} catch (CallException e) {
return callFailure(currentState, "accept() failed: ", e);
}
return currentState;
}
use of org.signal.ringrtc.CallException in project Signal-Android by WhisperSystems.
the class OutgoingCallActionProcessor method handleTurnServerUpdate.
@Override
@NonNull
public WebRtcServiceState handleTurnServerUpdate(@NonNull WebRtcServiceState currentState, @NonNull List<PeerConnection.IceServer> iceServers, boolean isAlwaysTurn) {
try {
VideoState videoState = currentState.getVideoState();
RemotePeer activePeer = currentState.getCallInfoState().requireActivePeer();
CallParticipant callParticipant = Objects.requireNonNull(currentState.getCallInfoState().getRemoteCallParticipant(activePeer.getRecipient()));
webRtcInteractor.getCallManager().proceed(activePeer.getCallId(), context, videoState.getLockableEglBase().require(), AudioProcessingMethodSelector.get(), videoState.requireLocalSink(), callParticipant.getVideoSink(), videoState.requireCamera(), iceServers, isAlwaysTurn, NetworkUtil.getCallingBandwidthMode(context), null, currentState.getCallSetupState(activePeer).isEnableVideoOnCreate());
} catch (CallException e) {
return callFailure(currentState, "Unable to proceed with call: ", e);
}
return currentState.builder().changeLocalDeviceState().cameraState(currentState.getVideoState().requireCamera().getCameraState()).build();
}
use of org.signal.ringrtc.CallException in project Signal-Android by WhisperSystems.
the class SignalCallManager method peekGroupCallForRingingCheck.
public void peekGroupCallForRingingCheck(@NonNull GroupCallRingCheckInfo info) {
if (callManager == null) {
Log.i(TAG, "Unable to peekGroupCall, call manager is null");
return;
}
networkExecutor.execute(() -> {
try {
Recipient group = Recipient.resolved(info.getRecipientId());
GroupId.V2 groupId = group.requireGroupId().requireV2();
GroupExternalCredential credential = GroupManager.getGroupExternalCredential(context, groupId);
List<GroupCall.GroupMemberInfo> members = GroupManager.getUuidCipherTexts(context, groupId).entrySet().stream().map(entry -> new GroupCall.GroupMemberInfo(entry.getKey(), entry.getValue().serialize())).collect(Collectors.toList());
callManager.peekGroupCall(SignalStore.internalValues().groupCallingServer(), credential.getTokenBytes().toByteArray(), members, peekInfo -> {
receivedGroupCallPeekForRingingCheck(info, peekInfo.getDeviceCount());
});
} catch (IOException | VerificationFailedException | CallException e) {
Log.e(TAG, "error peeking for ringing check", e);
}
});
}
use of org.signal.ringrtc.CallException in project Signal-Android by WhisperSystems.
the class SignalCallManager method onStartCall.
@Override
public void onStartCall(@Nullable Remote remote, @NonNull CallId callId, @NonNull Boolean isOutgoing, @Nullable CallManager.CallMediaType callMediaType) {
Log.i(TAG, "onStartCall(): callId: " + callId + ", outgoing: " + isOutgoing + ", type: " + callMediaType);
if (callManager == null) {
Log.w(TAG, "Unable to start call, call manager is not initialized");
return;
}
if (remote == null) {
return;
}
process((s, p) -> {
RemotePeer remotePeer = (RemotePeer) remote;
if (s.getCallInfoState().getPeer(remotePeer.hashCode()) == null) {
Log.w(TAG, "remotePeer not found in map with key: " + remotePeer.hashCode() + "! Dropping.");
try {
callManager.drop(callId);
} catch (CallException e) {
s = p.callFailure(s, "callManager.drop() failed: ", e);
}
}
remotePeer.setCallId(callId);
if (isOutgoing) {
return p.handleStartOutgoingCall(s, remotePeer, WebRtcUtil.getOfferTypeFromCallMediaType(callMediaType));
} else {
return p.handleStartIncomingCall(s, remotePeer);
}
});
}
use of org.signal.ringrtc.CallException in project Signal-Android by WhisperSystems.
the class GroupJoiningActionProcessor method handleLocalHangup.
@NonNull
protected WebRtcServiceState handleLocalHangup(@NonNull WebRtcServiceState currentState) {
Log.i(tag, "handleLocalHangup():");
GroupCall groupCall = currentState.getCallInfoState().requireGroupCall();
try {
groupCall.disconnect();
} catch (CallException e) {
return groupCallFailure(currentState, "Unable to disconnect from group call", e);
}
currentState = currentState.builder().changeCallInfoState().callState(WebRtcViewModel.State.CALL_DISCONNECTED).groupCallState(WebRtcViewModel.GroupCallState.DISCONNECTED).build();
webRtcInteractor.postStateUpdate(currentState);
return terminateGroupCall(currentState);
}
Aggregations