org.whispersystems.signalservice.api.messages.calls.IceUpdateMessage Java Examples
The following examples show how to use
org.whispersystems.signalservice.api.messages.calls.IceUpdateMessage.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WebRtcCallService.java From mollyim-android with GNU General Public License v3.0 | 6 votes |
private void handleSendIceCandidates(Intent intent) { RemotePeer remotePeer = getRemotePeer(intent); CallId callId = getCallId(intent); Integer remoteDevice = intent.getIntExtra(EXTRA_REMOTE_DEVICE, -1); boolean broadcast = intent.getBooleanExtra(EXTRA_BROADCAST, false); ArrayList<IceCandidateParcel> iceCandidates = intent.getParcelableArrayListExtra(EXTRA_ICE_CANDIDATES); Log.i(TAG, "handleSendIceCandidates: id: " + callId.format(remoteDevice)); LinkedList<IceUpdateMessage> iceUpdateMessages = new LinkedList(); for (IceCandidateParcel parcel : iceCandidates) { iceUpdateMessages.add(parcel.getIceUpdateMessage(callId)); } Integer destinationDeviceId = broadcast ? null : remoteDevice; SignalServiceCallMessage callMessage = SignalServiceCallMessage.forIceUpdates(iceUpdateMessages, true, destinationDeviceId); sendCallMessage(remotePeer, callMessage); }
Example #2
Source File: PushProcessMessageJob.java From mollyim-android with GNU General Public License v3.0 | 6 votes |
private void handleCallIceUpdateMessage(@NonNull SignalServiceContent content, @NonNull List<IceUpdateMessage> messages) { Log.i(TAG, "handleCallIceUpdateMessage... " + messages.size()); ArrayList<IceCandidateParcel> iceCandidates = new ArrayList<>(messages.size()); long callId = -1; for (IceUpdateMessage iceMessage : messages) { iceCandidates.add(new IceCandidateParcel(iceMessage)); callId = iceMessage.getId(); } Intent intent = new Intent(context, WebRtcCallService.class); RemotePeer remotePeer = new RemotePeer(Recipient.externalPush(context, content.getSender()).getId()); intent.setAction(WebRtcCallService.ACTION_RECEIVE_ICE_CANDIDATES) .putExtra(WebRtcCallService.EXTRA_CALL_ID, callId) .putExtra(WebRtcCallService.EXTRA_REMOTE_PEER, remotePeer) .putExtra(WebRtcCallService.EXTRA_REMOTE_DEVICE, content.getSenderDevice()) .putParcelableArrayListExtra(WebRtcCallService.EXTRA_ICE_CANDIDATES, iceCandidates); context.startService(intent); }
Example #3
Source File: PushDecryptJob.java From bcm-android with GNU General Public License v3.0 | 6 votes |
private void handleCallIceUpdateMessage(@NonNull SignalServiceProtos.Envelope envelope, @NonNull List<IceUpdateMessage> messages) { ALog.i(TAG, "handleCallIceUpdateMessage... " + messages.size()); for (IceUpdateMessage message : messages) { try { 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.from(accountContext, 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()); intent.putExtra(ARouterConstants.PARAM.PARAM_ACCOUNT_CONTEXT, accountContext); AppUtilKotlinKt.startForegroundServiceCompat(context, intent); } catch (Exception ex) { ALog.e(TAG, "handleCallIceUpdateMessage error", ex); } } }
Example #4
Source File: SignalServiceCipher.java From libsignal-service-java with GNU General Public License v3.0 | 6 votes |
private SignalServiceCallMessage createCallMessage(CallMessage content) { if (content.hasOffer()) { CallMessage.Offer offerContent = content.getOffer(); return SignalServiceCallMessage.forOffer(new OfferMessage(offerContent.getId(), offerContent.getDescription())); } else if (content.hasAnswer()) { CallMessage.Answer answerContent = content.getAnswer(); return SignalServiceCallMessage.forAnswer(new AnswerMessage(answerContent.getId(), answerContent.getDescription())); } else if (content.getIceUpdateCount() > 0) { List<IceUpdateMessage> iceUpdates = new LinkedList<>(); for (CallMessage.IceUpdate iceUpdate : content.getIceUpdateList()) { iceUpdates.add(new IceUpdateMessage(iceUpdate.getId(), iceUpdate.getSdpMid(), iceUpdate.getSdpMLineIndex(), iceUpdate.getSdp())); } return SignalServiceCallMessage.forIceUpdates(iceUpdates); } else if (content.hasHangup()) { CallMessage.Hangup hangup = content.getHangup(); return SignalServiceCallMessage.forHangup(new HangupMessage(hangup.getId())); } else if (content.hasBusy()) { CallMessage.Busy busy = content.getBusy(); return SignalServiceCallMessage.forBusy(new BusyMessage(busy.getId())); } return SignalServiceCallMessage.empty(); }
Example #5
Source File: SignalServiceCipher.java From bcm-android with GNU General Public License v3.0 | 5 votes |
private SignalServiceCallMessage createCallMessage(CallMessage content) { if (content.hasOffer()) { CallMessage.Offer offerContent = content.getOffer(); CallMessage.Offer.CallType callType = CallMessage.Offer.CallType.AUDIO; if (offerContent.hasType()) { callType = offerContent.getType(); } return SignalServiceCallMessage.forOffer(new OfferMessage(offerContent.getId(), offerContent.getDescription(), callType)); } else if (content.hasAnswer()) { CallMessage.Answer answerContent = content.getAnswer(); return SignalServiceCallMessage.forAnswer(new AnswerMessage(answerContent.getId(), answerContent.getDescription())); } else if (content.getIceUpdateCount() > 0) { List<IceUpdateMessage> iceUpdates = new LinkedList<>(); for (CallMessage.IceUpdate iceUpdate : content.getIceUpdateList()) { iceUpdates.add(new IceUpdateMessage(iceUpdate.getId(), iceUpdate.getSdpMid(), iceUpdate.getSdpMLineIndex(), iceUpdate.getSdp())); } return SignalServiceCallMessage.forIceUpdates(iceUpdates); } else if (content.hasHangup()) { CallMessage.Hangup hangup = content.getHangup(); return SignalServiceCallMessage.forHangup(new HangupMessage(hangup.getId())); } else if (content.hasBusy()) { CallMessage.Busy busy = content.getBusy(); return SignalServiceCallMessage.forBusy(new BusyMessage(busy.getId())); } return SignalServiceCallMessage.empty(); }
Example #6
Source File: SignalServiceMessageSender.java From libsignal-service-java with GNU General Public License v3.0 | 5 votes |
private byte[] createCallContent(SignalServiceCallMessage callMessage) { Content.Builder container = Content.newBuilder(); CallMessage.Builder builder = CallMessage.newBuilder(); if (callMessage.getOfferMessage().isPresent()) { OfferMessage offer = callMessage.getOfferMessage().get(); builder.setOffer(CallMessage.Offer.newBuilder() .setId(offer.getId()) .setDescription(offer.getDescription())); } else if (callMessage.getAnswerMessage().isPresent()) { AnswerMessage answer = callMessage.getAnswerMessage().get(); builder.setAnswer(CallMessage.Answer.newBuilder() .setId(answer.getId()) .setDescription(answer.getDescription())); } else if (callMessage.getIceUpdateMessages().isPresent()) { List<IceUpdateMessage> updates = callMessage.getIceUpdateMessages().get(); for (IceUpdateMessage update : updates) { builder.addIceUpdate(CallMessage.IceUpdate.newBuilder() .setId(update.getId()) .setSdp(update.getSdp()) .setSdpMid(update.getSdpMid()) .setSdpMLineIndex(update.getSdpMLineIndex())); } } else if (callMessage.getHangupMessage().isPresent()) { builder.setHangup(CallMessage.Hangup.newBuilder().setId(callMessage.getHangupMessage().get().getId())); } else if (callMessage.getBusyMessage().isPresent()) { builder.setBusy(CallMessage.Busy.newBuilder().setId(callMessage.getBusyMessage().get().getId())); } container.setCallMessage(builder); return container.build().toByteArray(); }
Example #7
Source File: SignalServiceMessageSender.java From mollyim-android with GNU General Public License v3.0 | 4 votes |
private byte[] createCallContent(SignalServiceCallMessage callMessage) { Content.Builder container = Content.newBuilder(); CallMessage.Builder builder = CallMessage.newBuilder(); if (callMessage.getOfferMessage().isPresent()) { OfferMessage offer = callMessage.getOfferMessage().get(); builder.setOffer(CallMessage.Offer.newBuilder() .setId(offer.getId()) .setDescription(offer.getDescription()) .setType(offer.getType().getProtoType())); } else if (callMessage.getAnswerMessage().isPresent()) { AnswerMessage answer = callMessage.getAnswerMessage().get(); builder.setAnswer(CallMessage.Answer.newBuilder() .setId(answer.getId()) .setDescription(answer.getDescription())); } else if (callMessage.getIceUpdateMessages().isPresent()) { List<IceUpdateMessage> updates = callMessage.getIceUpdateMessages().get(); for (IceUpdateMessage update : updates) { builder.addIceUpdate(CallMessage.IceUpdate.newBuilder() .setId(update.getId()) .setSdp(update.getSdp()) .setSdpMid(update.getSdpMid()) .setSdpMLineIndex(update.getSdpMLineIndex())); } } else if (callMessage.getHangupMessage().isPresent()) { CallMessage.Hangup.Type protoType = callMessage.getHangupMessage().get().getType().getProtoType(); CallMessage.Hangup.Builder builderForHangup = CallMessage.Hangup.newBuilder() .setType(protoType) .setId(callMessage.getHangupMessage().get().getId()); if (protoType != CallMessage.Hangup.Type.HANGUP_NORMAL) { builderForHangup.setDeviceId(callMessage.getHangupMessage().get().getDeviceId()); } if (callMessage.getHangupMessage().get().isLegacy()) { builder.setLegacyHangup(builderForHangup); } else { builder.setHangup(builderForHangup); } } else if (callMessage.getBusyMessage().isPresent()) { builder.setBusy(CallMessage.Busy.newBuilder().setId(callMessage.getBusyMessage().get().getId())); } builder.setMultiRing(callMessage.isMultiRing()); if (callMessage.getDestinationDeviceId().isPresent()) { builder.setDestinationDeviceId(callMessage.getDestinationDeviceId().get()); } container.setCallMessage(builder); return container.build().toByteArray(); }
Example #8
Source File: IceCandidateParcel.java From mollyim-android with GNU General Public License v3.0 | 4 votes |
public IceCandidateParcel(@NonNull IceUpdateMessage iceUpdateMessage) { this.iceCandidate = new IceCandidate(iceUpdateMessage.getSdpMid(), iceUpdateMessage.getSdpMLineIndex(), iceUpdateMessage.getSdp()); }
Example #9
Source File: IceCandidateParcel.java From mollyim-android with GNU General Public License v3.0 | 4 votes |
public @NonNull IceUpdateMessage getIceUpdateMessage(@NonNull CallId callId) { return new IceUpdateMessage(callId.longValue(), iceCandidate.sdpMid, iceCandidate.sdpMLineIndex, iceCandidate.sdp); }
Example #10
Source File: WebRtcCallService.java From bcm-android with GNU General Public License v3.0 | 4 votes |
private void handleLocalIceCandidate(Intent intent) { CallState currentState = this.callState.get(); if (currentState == CallState.STATE_IDLE || !Util.isEquals(this.callId, getCallId(intent))) { ALog.w(TAG, "State is now idle, ignoring ice candidate..."); return; } if (recipient == null || callId == -1L) { ALog.i(TAG, "handleLocalIceCandidate fail, recipient is null or callId is null"); terminate(); return; } 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)); ALog.d(TAG, "handleLocalIceCandidate " + new Gson().toJson(iceUpdateMessage)); if (pendingOutgoingIceUpdates != null) { ALog.i(TAG, "Adding to pending ice candidates..."); this.pendingOutgoingIceUpdates.add(iceUpdateMessage); return; } ListenableFutureTask<Boolean> listenableFutureTask = sendMessage(WebRtcCallService.accountContext, recipient, SignalServiceCallMessage.forIceUpdate(iceUpdateMessage)); if (listenableFutureTask != null) { listenableFutureTask.addListener(new FailureListener<Boolean>(currentState, callId) { @Override public void onFailureContinue(Throwable error) { ALog.e(TAG, "sendMessage", error); sendMessage(WebRtcViewModel.State.NETWORK_FAILURE, recipient, localCameraState, remoteVideoEnabled, bluetoothAvailable, microphoneEnabled); IMetricsModule metricsModule = AmeModuleCenter.INSTANCE.metric(WebRtcCallService.accountContext); if (metricsModule != null) { metricsModule.addCustomCounterReportData(currentMetric, MetricsConstKt.CALL_FAILED, true); metricsModule.addCustomCounterReportData(currentMetric, MetricsConstKt.CALL_SUCCESS, false); } terminate(); } }); } }