org.whispersystems.signalservice.api.messages.calls.BusyMessage Java Examples
The following examples show how to use
org.whispersystems.signalservice.api.messages.calls.BusyMessage.
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: 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 #2
Source File: WebRtcCallService.java From mollyim-android with GNU General Public License v3.0 | 5 votes |
private void handleSendBusy(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); Log.i(TAG, "handleSendBusy: id: " + callId.format(remoteDevice)); BusyMessage busyMessage = new BusyMessage(callId.longValue()); Integer destinationDeviceId = broadcast ? null : remoteDevice; SignalServiceCallMessage callMessage = SignalServiceCallMessage.forBusy(busyMessage, true, destinationDeviceId); sendCallMessage(remotePeer, callMessage); }
Example #3
Source File: PushProcessMessageJob.java From mollyim-android with GNU General Public License v3.0 | 5 votes |
private void handleCallBusyMessage(@NonNull SignalServiceContent content, @NonNull BusyMessage message) { Log.i(TAG, "handleCallBusyMessage"); Intent intent = new Intent(context, WebRtcCallService.class); RemotePeer remotePeer = new RemotePeer(Recipient.externalPush(context, content.getSender()).getId()); intent.setAction(WebRtcCallService.ACTION_RECEIVE_BUSY) .putExtra(WebRtcCallService.EXTRA_CALL_ID, message.getId()) .putExtra(WebRtcCallService.EXTRA_REMOTE_PEER, remotePeer) .putExtra(WebRtcCallService.EXTRA_REMOTE_DEVICE, content.getSenderDevice()); context.startService(intent); }
Example #4
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 #5
Source File: PushDecryptJob.java From bcm-android with GNU General Public License v3.0 | 5 votes |
private void handleCallBusyMessage(@NonNull SignalServiceProtos.Envelope envelope, @NonNull BusyMessage message) { ALog.i(TAG, "handleCallBusyMessage"); try { Intent intent = new Intent(context, WebRtcCallService.class); intent.setAction(WebRtcCallService.ACTION_REMOTE_BUSY); intent.putExtra(WebRtcCallService.EXTRA_CALL_ID, message.getId()); intent.putExtra(WebRtcCallService.EXTRA_REMOTE_ADDRESS, Address.from(accountContext, envelope.getSource())); intent.putExtra(ARouterConstants.PARAM.PARAM_ACCOUNT_CONTEXT, accountContext); AppUtilKotlinKt.startForegroundServiceCompat(context, intent); } catch (Exception ex) { ALog.e(TAG, "handleCallBusyMessage error", ex); } }
Example #6
Source File: WebRtcCallService.java From bcm-android with GNU General Public License v3.0 | 5 votes |
/** * @param intent */ private void handleBusyCall(Intent intent) throws Exception { ALog.w(TAG, "handleBusyCall"); this.mIncoming.set(true); Recipient recipient = getRemoteRecipient(intent); long callId = getCallId(intent); AccountContext accountContext = getAccountContextFromIntent(intent); sendMessage(accountContext, recipient, SignalServiceCallMessage.forBusy(new BusyMessage(callId))); }
Example #7
Source File: WebRtcCallService.java From bcm-android with GNU General Public License v3.0 | 5 votes |
private ListenableFutureTask<Boolean> sendMessage(@NonNull AccountContext accountContext, @NonNull final Recipient recipient, @NonNull final SignalServiceCallMessage callMessage) { ALog.i(TAG, "Send message"); if (recipient.getAddress().toString().equals(accountContext.getUid())) { // Don't send call message to major ALog.w(TAG, "Recipient is not the same"); return null; } ListenableFutureTask<Boolean> listenableFutureTask = new ListenableFutureTask<>(() -> { ThreadRepo threadRepo = Repository.getInstance(accountContext).getThreadRepo(); long threadId = threadRepo.getThreadIdIfExist(recipient); BcmChatCore.INSTANCE.sendCallMessage(accountContext, threadId, new SignalServiceAddress(recipient.getAddress().serialize()), callMessage); return true; }, null, serviceExecutor); Optional<BusyMessage> busyMessageOptional = callMessage.getBusyMessage(); if (busyMessageOptional.isPresent()) { insertMissedCall(accountContext, recipient, NOTIFICATION_SIMPLY); } Optional<HangupMessage> hangupMessageOptional = callMessage.getHangupMessage(); if (hangupMessageOptional.isPresent()) { EventBus.getDefault().postSticky(new WebRtcViewModel(WebRtcViewModel.State.CALL_DISCONNECTED, videoCall, recipient, localCameraState, localRenderer, remoteRenderer, remoteVideoEnabled, bluetoothAvailable, microphoneEnabled)); } networkExecutor.execute(listenableFutureTask); return listenableFutureTask; }