use of org.thoughtcrime.securesms.ringrtc.RemotePeer in project Signal-Android by WhisperSystems.
the class SignalCallManager method sendCallMessage.
public void sendCallMessage(@NonNull final RemotePeer remotePeer, @NonNull final SignalServiceCallMessage callMessage) {
networkExecutor.execute(() -> {
Recipient recipient = Recipient.resolved(remotePeer.getId());
if (recipient.isBlocked()) {
return;
}
try {
messageSender.sendCallMessage(RecipientUtil.toSignalServiceAddress(context, recipient), UnidentifiedAccessUtil.getAccessFor(context, recipient), callMessage);
process((s, p) -> p.handleMessageSentSuccess(s, remotePeer.getCallId()));
} catch (UntrustedIdentityException e) {
RetrieveProfileJob.enqueue(remotePeer.getId());
processSendMessageFailureWithChangeDetection(remotePeer, (s, p) -> p.handleMessageSentError(s, remotePeer.getCallId(), UNTRUSTED_IDENTITY, Optional.fromNullable(e.getIdentityKey())));
} catch (IOException e) {
processSendMessageFailureWithChangeDetection(remotePeer, (s, p) -> p.handleMessageSentError(s, remotePeer.getCallId(), e instanceof UnregisteredUserException ? NO_SUCH_USER : NETWORK_FAILURE, Optional.absent()));
}
});
}
use of org.thoughtcrime.securesms.ringrtc.RemotePeer in project Signal-Android by WhisperSystems.
the class SignalCallManager method onSendHangup.
@Override
public void onSendHangup(@NonNull CallId callId, @Nullable Remote remote, @NonNull Integer remoteDevice, @NonNull Boolean broadcast, @NonNull CallManager.HangupType hangupType, @NonNull Integer deviceId) {
if (!(remote instanceof RemotePeer)) {
return;
}
RemotePeer remotePeer = (RemotePeer) remote;
Log.i(TAG, "onSendHangup: id: " + remotePeer.getCallId().format(remoteDevice) + " type: " + hangupType.name());
WebRtcData.CallMetadata callMetadata = new WebRtcData.CallMetadata(remotePeer, remoteDevice);
WebRtcData.HangupMetadata hangupMetadata = new WebRtcData.HangupMetadata(WebRtcUtil.getHangupTypeFromCallHangupType(hangupType), false, deviceId);
process((s, p) -> p.handleSendHangup(s, callMetadata, hangupMetadata, broadcast));
}
use of org.thoughtcrime.securesms.ringrtc.RemotePeer in project Signal-Android by WhisperSystems.
the class SignalCallManager method onGroupCallRingUpdate.
@Override
public void onGroupCallRingUpdate(@NonNull byte[] groupIdBytes, long ringId, @NonNull UUID uuid, @NonNull CallManager.RingUpdate ringUpdate) {
try {
GroupId.V2 groupId = GroupId.v2(new GroupIdentifier(groupIdBytes));
Optional<GroupDatabase.GroupRecord> group = SignalDatabase.groups().getGroup(groupId);
if (group.isPresent()) {
process((s, p) -> p.handleGroupCallRingUpdate(s, new RemotePeer(group.get().getRecipientId()), groupId, ringId, uuid, ringUpdate));
} else {
Log.w(TAG, "Unable to ring unknown group.");
}
} catch (InvalidInputException e) {
Log.w(TAG, "Unable to ring group due to invalid group id", e);
}
}
use of org.thoughtcrime.securesms.ringrtc.RemotePeer 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.thoughtcrime.securesms.ringrtc.RemotePeer in project Signal-Android by WhisperSystems.
the class ActiveCallActionProcessorDelegate method handleScreenSharingEnable.
@Override
@NonNull
protected WebRtcServiceState handleScreenSharingEnable(@NonNull WebRtcServiceState currentState, boolean enable) {
RemotePeer activePeer = currentState.getCallInfoState().requireActivePeer();
Log.i(tag, "handleScreenSharingEnable(): call_id: " + activePeer.getCallId() + " enable: " + enable);
CallParticipant oldParticipant = Objects.requireNonNull(currentState.getCallInfoState().getRemoteCallParticipant(activePeer.getRecipient()));
CallParticipant newParticipant = oldParticipant.withScreenSharingEnabled(enable);
return currentState.builder().changeCallInfoState().putParticipant(activePeer.getRecipient(), newParticipant).build();
}
Aggregations