Search in sources :

Example 6 with IceUpdateMessage

use of org.whispersystems.signalservice.api.messages.calls.IceUpdateMessage in project Signal-Android by signalapp.

the class MessageContentProcessor method handleCallIceUpdateMessage.

private void handleCallIceUpdateMessage(@NonNull SignalServiceContent content, @NonNull List<IceUpdateMessage> messages, @NonNull Recipient senderRecipient) {
    log(String.valueOf(content), "handleCallIceUpdateMessage... " + messages.size());
    List<byte[]> iceCandidates = new ArrayList<>(messages.size());
    long callId = -1;
    for (IceUpdateMessage iceMessage : messages) {
        iceCandidates.add(iceMessage.getOpaque());
        callId = iceMessage.getId();
    }
    RemotePeer remotePeer = new RemotePeer(senderRecipient.getId(), new CallId(callId));
    ApplicationDependencies.getSignalCallManager().receivedIceCandidates(new WebRtcData.CallMetadata(remotePeer, content.getSenderDevice()), iceCandidates);
}
Also used : IceUpdateMessage(org.whispersystems.signalservice.api.messages.calls.IceUpdateMessage) CallId(org.signal.ringrtc.CallId) ArrayList(java.util.ArrayList) RemotePeer(org.thoughtcrime.securesms.ringrtc.RemotePeer) WebRtcData(org.thoughtcrime.securesms.service.webrtc.WebRtcData)

Example 7 with IceUpdateMessage

use of org.whispersystems.signalservice.api.messages.calls.IceUpdateMessage in project Signal-Android by WhisperSystems.

the class WebRtcCallService method handleLocalIceCandidate.

private void handleLocalIceCandidate(Intent intent) {
    if (callState == CallState.STATE_IDLE || !Util.isEquals(this.callId, getCallId(intent))) {
        Log.w(TAG, "State is now idle, ignoring ice candidate...");
    }
    if (recipient == null || callId == null) {
        throw new AssertionError("assert: " + callState + ", " + callId);
    }
    IceUpdateMessage iceUpdateMessage = new IceUpdateMessage(this.callId, intent.getStringExtra(EXTRA_ICE_SDP_MID), intent.getIntExtra(EXTRA_ICE_SDP_LINE_INDEX, 0), intent.getStringExtra(EXTRA_ICE_SDP));
    if (pendingIceUpdates != null) {
        this.pendingIceUpdates.add(iceUpdateMessage);
        return;
    }
    ListenableFutureTask<Boolean> listenableFutureTask = sendMessage(recipient, SignalServiceCallMessage.forIceUpdate(iceUpdateMessage));
    listenableFutureTask.addListener(new FailureListener<Boolean>(callState, callId) {

        @Override
        public void onFailureContinue(Throwable error) {
            Log.w(TAG, error);
            sendMessage(WebRtcViewModel.State.NETWORK_FAILURE, recipient, localVideoEnabled, remoteVideoEnabled, bluetoothAvailable, microphoneEnabled);
            terminate();
        }
    });
}
Also used : IceUpdateMessage(org.whispersystems.signalservice.api.messages.calls.IceUpdateMessage)

Example 8 with IceUpdateMessage

use of org.whispersystems.signalservice.api.messages.calls.IceUpdateMessage in project Signal-Android by signalapp.

the class WebRtcCallService method handleLocalIceCandidate.

private void handleLocalIceCandidate(Intent intent) {
    if (callState == CallState.STATE_IDLE || !Util.isEquals(this.callId, getCallId(intent))) {
        Log.w(TAG, "State is now idle, ignoring ice candidate...");
        return;
    }
    if (recipient == null || callId == null) {
        throw new AssertionError("assert: " + callState + ", " + callId);
    }
    IceUpdateMessage iceUpdateMessage = new IceUpdateMessage(this.callId, intent.getStringExtra(EXTRA_ICE_SDP_MID), intent.getIntExtra(EXTRA_ICE_SDP_LINE_INDEX, 0), intent.getStringExtra(EXTRA_ICE_SDP));
    if (pendingOutgoingIceUpdates != null) {
        Log.w(TAG, "Adding to pending ice candidates...");
        this.pendingOutgoingIceUpdates.add(iceUpdateMessage);
        return;
    }
    ListenableFutureTask<Boolean> listenableFutureTask = sendMessage(recipient, SignalServiceCallMessage.forIceUpdate(iceUpdateMessage));
    listenableFutureTask.addListener(new FailureListener<Boolean>(callState, callId) {

        @Override
        public void onFailureContinue(Throwable error) {
            Log.w(TAG, error);
            sendMessage(WebRtcViewModel.State.NETWORK_FAILURE, recipient, localVideoEnabled, remoteVideoEnabled, bluetoothAvailable, microphoneEnabled);
            terminate();
        }
    });
}
Also used : IceUpdateMessage(org.whispersystems.signalservice.api.messages.calls.IceUpdateMessage)

Example 9 with IceUpdateMessage

use of org.whispersystems.signalservice.api.messages.calls.IceUpdateMessage in project Signal-Android by signalapp.

the class PushDecryptJob method handleCallIceUpdateMessage.

private void handleCallIceUpdateMessage(@NonNull SignalServiceEnvelope envelope, @NonNull List<IceUpdateMessage> messages) {
    Log.w(TAG, "handleCallIceUpdateMessage... " + messages.size());
    for (IceUpdateMessage message : messages) {
        Intent intent = new Intent(context, WebRtcCallService.class);
        intent.setAction(WebRtcCallService.ACTION_ICE_MESSAGE);
        intent.putExtra(WebRtcCallService.EXTRA_CALL_ID, message.getId());
        intent.putExtra(WebRtcCallService.EXTRA_REMOTE_ADDRESS, Address.fromExternal(context, envelope.getSource()));
        intent.putExtra(WebRtcCallService.EXTRA_ICE_SDP, message.getSdp());
        intent.putExtra(WebRtcCallService.EXTRA_ICE_SDP_MID, message.getSdpMid());
        intent.putExtra(WebRtcCallService.EXTRA_ICE_SDP_LINE_INDEX, message.getSdpMLineIndex());
        context.startService(intent);
    }
}
Also used : IceUpdateMessage(org.whispersystems.signalservice.api.messages.calls.IceUpdateMessage) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent)

Example 10 with IceUpdateMessage

use of org.whispersystems.signalservice.api.messages.calls.IceUpdateMessage 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;
}
Also used : SignalStore(org.thoughtcrime.securesms.keyvalue.SignalStore) SignalAudioManager(org.thoughtcrime.securesms.webrtc.audio.SignalAudioManager) RingUpdate(org.signal.ringrtc.CallManager.RingUpdate) NonNull(androidx.annotation.NonNull) RecipientUtil(org.thoughtcrime.securesms.recipients.RecipientUtil) CallParticipant(org.thoughtcrime.securesms.events.CallParticipant) CallException(org.signal.ringrtc.CallException) CallManager(org.signal.ringrtc.CallManager) RecipientId(org.thoughtcrime.securesms.recipients.RecipientId) NotificationProfiles(org.thoughtcrime.securesms.notifications.profiles.NotificationProfiles) NetworkUtil(org.thoughtcrime.securesms.util.NetworkUtil) Recipient(org.thoughtcrime.securesms.recipients.Recipient) BusyMessage(org.whispersystems.signalservice.api.messages.calls.BusyMessage) IdentityKeyUtil(org.thoughtcrime.securesms.crypto.IdentityKeyUtil) ApplicationDependencies(org.thoughtcrime.securesms.dependencies.ApplicationDependencies) Collection(java.util.Collection) Set(java.util.Set) UUID(java.util.UUID) NotificationProfile(org.thoughtcrime.securesms.notifications.profiles.NotificationProfile) IdentityKey(org.whispersystems.libsignal.IdentityKey) GroupCall(org.signal.ringrtc.GroupCall) Objects(java.util.Objects) Log(org.signal.core.util.logging.Log) List(java.util.List) Nullable(androidx.annotation.Nullable) CallState(org.thoughtcrime.securesms.ringrtc.CallState) OfferMetadata(org.thoughtcrime.securesms.service.webrtc.WebRtcData.OfferMetadata) GroupId(org.thoughtcrime.securesms.groups.GroupId) CallId(org.signal.ringrtc.CallId) WebRtcServiceStateBuilder(org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceStateBuilder) AnswerMessage(org.whispersystems.signalservice.api.messages.calls.AnswerMessage) CallMetadata(org.thoughtcrime.securesms.service.webrtc.WebRtcData.CallMetadata) Context(android.content.Context) SignalDatabase(org.thoughtcrime.securesms.database.SignalDatabase) RemotePeer(org.thoughtcrime.securesms.ringrtc.RemotePeer) Stream(com.annimon.stream.Stream) ReceivedOfferMetadata(org.thoughtcrime.securesms.service.webrtc.WebRtcData.ReceivedOfferMetadata) InvalidKeyException(org.whispersystems.libsignal.InvalidKeyException) OfferMessage(org.whispersystems.signalservice.api.messages.calls.OfferMessage) EglBaseWrapper(org.thoughtcrime.securesms.components.webrtc.EglBaseWrapper) GroupCallSafetyNumberChangeNotificationUtil(org.thoughtcrime.securesms.components.webrtc.GroupCallSafetyNumberChangeNotificationUtil) LockManager(org.thoughtcrime.securesms.webrtc.locks.LockManager) CameraState(org.thoughtcrime.securesms.ringrtc.CameraState) HangupMessage(org.whispersystems.signalservice.api.messages.calls.HangupMessage) SignalServiceCallMessage(org.whispersystems.signalservice.api.messages.calls.SignalServiceCallMessage) Camera(org.thoughtcrime.securesms.ringrtc.Camera) WebRtcServiceState(org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceState) PeerConnection(org.webrtc.PeerConnection) WebRtcViewModel(org.thoughtcrime.securesms.events.WebRtcViewModel) BroadcastVideoSink(org.thoughtcrime.securesms.components.webrtc.BroadcastVideoSink) Orientation(org.thoughtcrime.securesms.components.sensors.Orientation) TelephonyUtil(org.thoughtcrime.securesms.util.TelephonyUtil) Optional(org.whispersystems.libsignal.util.guava.Optional) AnswerMetadata(org.thoughtcrime.securesms.service.webrtc.WebRtcData.AnswerMetadata) IceUpdateMessage(org.whispersystems.signalservice.api.messages.calls.IceUpdateMessage) HangupMetadata(org.thoughtcrime.securesms.service.webrtc.WebRtcData.HangupMetadata) ResultReceiver(android.os.ResultReceiver) ReceivedAnswerMetadata(org.thoughtcrime.securesms.service.webrtc.WebRtcData.ReceivedAnswerMetadata) IceUpdateMessage(org.whispersystems.signalservice.api.messages.calls.IceUpdateMessage) SignalServiceCallMessage(org.whispersystems.signalservice.api.messages.calls.SignalServiceCallMessage) NonNull(androidx.annotation.NonNull)

Aggregations

IceUpdateMessage (org.whispersystems.signalservice.api.messages.calls.IceUpdateMessage)13 AnswerMessage (org.whispersystems.signalservice.api.messages.calls.AnswerMessage)7 OfferMessage (org.whispersystems.signalservice.api.messages.calls.OfferMessage)7 SignalServiceCallMessage (org.whispersystems.signalservice.api.messages.calls.SignalServiceCallMessage)7 CallId (org.signal.ringrtc.CallId)4 BusyMessage (org.whispersystems.signalservice.api.messages.calls.BusyMessage)4 HangupMessage (org.whispersystems.signalservice.api.messages.calls.HangupMessage)4 RemotePeer (org.thoughtcrime.securesms.ringrtc.RemotePeer)3 OpaqueMessage (org.whispersystems.signalservice.api.messages.calls.OpaqueMessage)3 Context (android.content.Context)2 Intent (android.content.Intent)2 ResultReceiver (android.os.ResultReceiver)2 NonNull (androidx.annotation.NonNull)2 Nullable (androidx.annotation.Nullable)2 Stream (com.annimon.stream.Stream)2 ByteString (com.google.protobuf.ByteString)2 ArrayList (java.util.ArrayList)2 Collection (java.util.Collection)2 LinkedList (java.util.LinkedList)2 List (java.util.List)2