use of org.whispersystems.signalservice.api.messages.calls.SignalServiceCallMessage in project Signal-Android by WhisperSystems.
the class SignalCallManager method onSendCallMessageToGroup.
@Override
public void onSendCallMessageToGroup(@NonNull byte[] groupIdBytes, @NonNull byte[] message, @NonNull CallManager.CallMessageUrgency urgency) {
Log.i(TAG, "onSendCallMessageToGroup():");
networkExecutor.execute(() -> {
try {
GroupId groupId = GroupId.v2(new GroupIdentifier(groupIdBytes));
List<Recipient> recipients = SignalDatabase.groups().getGroupMembers(groupId, GroupDatabase.MemberSet.FULL_MEMBERS_EXCLUDING_SELF);
recipients = RecipientUtil.getEligibleForSending((recipients.stream().map(Recipient::resolve).filter(r -> !r.isBlocked()).collect(Collectors.toList())));
OpaqueMessage opaqueMessage = new OpaqueMessage(message, getUrgencyFromCallUrgency(urgency));
SignalServiceCallMessage callMessage = SignalServiceCallMessage.forOutgoingGroupOpaque(groupId.getDecodedId(), System.currentTimeMillis(), opaqueMessage, true, null);
RecipientAccessList accessList = new RecipientAccessList(recipients);
List<SendMessageResult> results = GroupSendUtil.sendCallMessage(context, groupId.requireV2(), recipients, callMessage);
Set<RecipientId> identifyFailureRecipientIds = results.stream().filter(result -> result.getIdentityFailure() != null).map(result -> accessList.requireIdByAddress(result.getAddress())).collect(Collectors.toSet());
if (Util.hasItems(identifyFailureRecipientIds)) {
process((s, p) -> p.handleGroupMessageSentError(s, identifyFailureRecipientIds, UNTRUSTED_IDENTITY));
RetrieveProfileJob.enqueue(identifyFailureRecipientIds);
}
} catch (UntrustedIdentityException | IOException | InvalidInputException e) {
Log.w(TAG, "onSendCallMessageToGroup failed", e);
}
});
}
use of org.whispersystems.signalservice.api.messages.calls.SignalServiceCallMessage in project Signal-Android by WhisperSystems.
the class SignalCallManager method onSendCallMessage.
@Override
public void onSendCallMessage(@NonNull UUID uuid, @NonNull byte[] bytes, @NonNull CallManager.CallMessageUrgency urgency) {
Log.i(TAG, "onSendCallMessage():");
OpaqueMessage opaqueMessage = new OpaqueMessage(bytes, getUrgencyFromCallUrgency(urgency));
SignalServiceCallMessage callMessage = SignalServiceCallMessage.forOpaque(opaqueMessage, true, null);
networkExecutor.execute(() -> {
Recipient recipient = Recipient.resolved(RecipientId.from(ACI.from(uuid), null));
if (recipient.isBlocked()) {
return;
}
try {
messageSender.sendCallMessage(RecipientUtil.toSignalServiceAddress(context, recipient), recipient.isSelf() ? Optional.absent() : UnidentifiedAccessUtil.getAccessFor(context, recipient), callMessage);
} catch (UntrustedIdentityException e) {
Log.i(TAG, "sendOpaqueCallMessage onFailure: ", e);
RetrieveProfileJob.enqueue(recipient.getId());
process((s, p) -> p.handleGroupMessageSentError(s, Collections.singletonList(recipient.getId()), UNTRUSTED_IDENTITY));
} catch (IOException e) {
Log.i(TAG, "sendOpaqueCallMessage onFailure: ", e);
process((s, p) -> p.handleGroupMessageSentError(s, Collections.singletonList(recipient.getId()), NETWORK_FAILURE));
}
});
}
use of org.whispersystems.signalservice.api.messages.calls.SignalServiceCallMessage in project Signal-Android by WhisperSystems.
the class WebRtcActionProcessor method handleSendIceCandidates.
// endregion Active call
// region Call setup
@NonNull
protected final WebRtcServiceState handleSendIceCandidates(@NonNull WebRtcServiceState currentState, @NonNull CallMetadata callMetadata, boolean broadcast, @NonNull List<byte[]> iceCandidates) {
Log.i(tag, "handleSendIceCandidates(): id: " + callMetadata.getCallId().format(callMetadata.getRemoteDevice()));
List<IceUpdateMessage> iceUpdateMessages = Stream.of(iceCandidates).map(c -> new IceUpdateMessage(callMetadata.getCallId().longValue(), c, null)).toList();
Integer destinationDeviceId = broadcast ? null : callMetadata.getRemoteDevice();
SignalServiceCallMessage callMessage = SignalServiceCallMessage.forIceUpdates(iceUpdateMessages, true, destinationDeviceId);
webRtcInteractor.sendCallMessage(callMetadata.getRemotePeer(), callMessage);
return currentState;
}
use of org.whispersystems.signalservice.api.messages.calls.SignalServiceCallMessage in project Signal-Android by WhisperSystems.
the class WebRtcActionProcessor method handleSendOffer.
@NonNull
protected final WebRtcServiceState handleSendOffer(@NonNull WebRtcServiceState currentState, @NonNull CallMetadata callMetadata, @NonNull OfferMetadata offerMetadata, boolean broadcast) {
Log.i(tag, "handleSendOffer(): id: " + callMetadata.getCallId().format(callMetadata.getRemoteDevice()));
OfferMessage offerMessage = new OfferMessage(callMetadata.getCallId().longValue(), offerMetadata.getSdp(), offerMetadata.getOfferType(), offerMetadata.getOpaque());
Integer destinationDeviceId = broadcast ? null : callMetadata.getRemoteDevice();
SignalServiceCallMessage callMessage = SignalServiceCallMessage.forOffer(offerMessage, true, destinationDeviceId);
Recipient callRecipient = currentState.getCallInfoState().getCallRecipient();
RecipientUtil.shareProfileIfFirstSecureMessage(context, callRecipient);
webRtcInteractor.sendCallMessage(callMetadata.getRemotePeer(), callMessage);
return currentState;
}
use of org.whispersystems.signalservice.api.messages.calls.SignalServiceCallMessage in project Signal-Android by WhisperSystems.
the class WebRtcActionProcessor method handleSendAnswer.
@NonNull
protected final WebRtcServiceState handleSendAnswer(@NonNull WebRtcServiceState currentState, @NonNull CallMetadata callMetadata, @NonNull AnswerMetadata answerMetadata, boolean broadcast) {
Log.i(tag, "handleSendAnswer(): id: " + callMetadata.getCallId().format(callMetadata.getRemoteDevice()));
AnswerMessage answerMessage = new AnswerMessage(callMetadata.getCallId().longValue(), answerMetadata.getSdp(), answerMetadata.getOpaque());
Integer destinationDeviceId = broadcast ? null : callMetadata.getRemoteDevice();
SignalServiceCallMessage callMessage = SignalServiceCallMessage.forAnswer(answerMessage, true, destinationDeviceId);
webRtcInteractor.sendCallMessage(callMetadata.getRemotePeer(), callMessage);
return currentState;
}
Aggregations