diff --git a/src/main/java/eu/siacs/conversations/Config.java b/src/main/java/eu/siacs/conversations/Config.java index 97df197fe..b33beacff 100644 --- a/src/main/java/eu/siacs/conversations/Config.java +++ b/src/main/java/eu/siacs/conversations/Config.java @@ -154,6 +154,8 @@ public final class Config { public static final boolean DISABLE_PROXY_LOOKUP = false; //disables STUN/TURN and Proxy65 look up (useful to debug IBB fallback) public static final boolean USE_DIRECT_JINGLE_CANDIDATES = true; public static final boolean USE_JINGLE_MESSAGE_INIT = true; + + public static final boolean JINGLE_MESSAGE_INIT_STRICT_OFFLINE_CHECK = false; public static final boolean DISABLE_HTTP_UPLOAD = false; public static final boolean EXTENDED_SM_LOGGING = false; // log stanza counts public static final boolean BACKGROUND_STANZA_LOGGING = false; //log all stanzas that were received while the app is in background diff --git a/src/main/java/eu/siacs/conversations/entities/Presences.java b/src/main/java/eu/siacs/conversations/entities/Presences.java index a0855d171..934f4c943 100644 --- a/src/main/java/eu/siacs/conversations/entities/Presences.java +++ b/src/main/java/eu/siacs/conversations/entities/Presences.java @@ -102,6 +102,12 @@ public class Presences { } } + public boolean isEmpty() { + synchronized (this.presences) { + return this.presences.isEmpty(); + } + } + public String[] toResourceArray() { synchronized (this.presences) { final String[] presencesArray = new String[presences.size()]; diff --git a/src/main/java/eu/siacs/conversations/services/CallIntegration.java b/src/main/java/eu/siacs/conversations/services/CallIntegration.java index 489d71256..f07ebe28d 100644 --- a/src/main/java/eu/siacs/conversations/services/CallIntegration.java +++ b/src/main/java/eu/siacs/conversations/services/CallIntegration.java @@ -303,6 +303,7 @@ public class CallIntegration extends Connection { @Override public void onStateChanged(final int state) { Log.d(Config.LOGTAG, "onStateChanged(" + state + ")"); + // TODO devices before selfManaged() will likely have to play their own ringback sound if (state == STATE_ACTIVE) { playConnectedSound(); } else if (state == STATE_DISCONNECTED) { diff --git a/src/main/java/eu/siacs/conversations/services/CallIntegrationConnectionService.java b/src/main/java/eu/siacs/conversations/services/CallIntegrationConnectionService.java index 99f565ff1..de39abb51 100644 --- a/src/main/java/eu/siacs/conversations/services/CallIntegrationConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/CallIntegrationConnectionService.java @@ -97,15 +97,26 @@ public class CallIntegrationConnectionService extends ConnectionService { intent.putExtra(RtpSessionActivity.EXTRA_WITH, with.toEscapedString()); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); - final CallIntegration callIntegration; + final Connection callIntegration; if (with.isBareJid()) { - final var proposal = - service.getJingleConnectionManager() - .proposeJingleRtpSession(account, with, media); - - intent.putExtra( - RtpSessionActivity.EXTRA_LAST_REPORTED_STATE, - RtpEndUserState.FINDING_DEVICE.toString()); + final var contact = account.getRoster().getContact(with); + if (Config.JINGLE_MESSAGE_INIT_STRICT_OFFLINE_CHECK + && contact.getPresences().isEmpty()) { + intent.putExtra( + RtpSessionActivity.EXTRA_LAST_REPORTED_STATE, + RtpEndUserState.CONTACT_OFFLINE.toString()); + callIntegration = + Connection.createFailedConnection( + new DisconnectCause(DisconnectCause.ERROR, "contact is offline")); + } else { + final var proposal = + service.getJingleConnectionManager() + .proposeJingleRtpSession(account, with, media); + intent.putExtra( + RtpSessionActivity.EXTRA_LAST_REPORTED_STATE, + RtpEndUserState.FINDING_DEVICE.toString()); + callIntegration = proposal.getCallIntegration(); + } if (Media.audioOnly(media)) { intent.putExtra( RtpSessionActivity.EXTRA_LAST_ACTION, @@ -115,7 +126,6 @@ public class CallIntegrationConnectionService extends ConnectionService { RtpSessionActivity.EXTRA_LAST_ACTION, RtpSessionActivity.ACTION_MAKE_VIDEO_CALL); } - callIntegration = proposal.getCallIntegration(); } else { final JingleRtpConnection jingleRtpConnection = service.getJingleConnectionManager().initializeRtpSession(account, with, media); diff --git a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java index d50fc7f4c..6fecb3c71 100644 --- a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java @@ -1,10 +1,10 @@ package eu.siacs.conversations.ui; -import static java.util.Arrays.asList; import static eu.siacs.conversations.utils.PermissionUtils.getFirstDenied; +import static java.util.Arrays.asList; + import android.Manifest; -import org.jetbrains.annotations.NotNull; import android.annotation.SuppressLint; import android.app.Activity; import android.app.PictureInPictureParams; @@ -42,17 +42,6 @@ import com.google.common.collect.ImmutableSet; import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.Futures; -import org.jetbrains.annotations.NotNull; -import org.webrtc.RendererCommon; -import org.webrtc.SurfaceViewRenderer; -import org.webrtc.VideoTrack; - -import java.lang.ref.WeakReference; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Set; - import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.databinding.ActivityRtpSessionBinding; @@ -68,7 +57,6 @@ import eu.siacs.conversations.ui.util.MainThreadExecutor; import eu.siacs.conversations.ui.util.Rationals; import eu.siacs.conversations.utils.PermissionUtils; import eu.siacs.conversations.utils.TimeFrameUtils; -import eu.siacs.conversations.xml.Namespace; import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.jingle.AbstractJingleConnection; import eu.siacs.conversations.xmpp.jingle.ContentAddition; @@ -77,11 +65,16 @@ import eu.siacs.conversations.xmpp.jingle.JingleRtpConnection; import eu.siacs.conversations.xmpp.jingle.Media; import eu.siacs.conversations.xmpp.jingle.RtpCapability; import eu.siacs.conversations.xmpp.jingle.RtpEndUserState; -import p32929.easypasscodelock.Utils.EasyLock; -import static eu.siacs.conversations.utils.PermissionUtils.getFirstDenied; -import static java.util.Arrays.asList; +import org.webrtc.RendererCommon; +import org.webrtc.SurfaceViewRenderer; +import org.webrtc.VideoTrack; +import java.lang.ref.WeakReference; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Set; public class RtpSessionActivity extends XmppActivity implements XmppConnectionService.OnJingleRtpConnectionUpdate, @@ -97,10 +90,12 @@ public class RtpSessionActivity extends XmppActivity private static final int CALL_DURATION_UPDATE_INTERVAL = 333; - public static final List END_CARD = Arrays.asList( + private static final List END_CARD = + Arrays.asList( RtpEndUserState.APPLICATION_ERROR, RtpEndUserState.SECURITY_ERROR, RtpEndUserState.DECLINED_OR_BUSY, + RtpEndUserState.CONTACT_OFFLINE, RtpEndUserState.CONNECTIVITY_ERROR, RtpEndUserState.CONNECTIVITY_LOST_ERROR, RtpEndUserState.RETRACTED); @@ -116,9 +111,7 @@ public class RtpSessionActivity extends XmppActivity RtpEndUserState.RECONNECTING, RtpEndUserState.INCOMING_CONTENT_ADD); private static final List STATES_CONSIDERED_CONNECTED = - Arrays.asList( - RtpEndUserState.CONNECTED, - RtpEndUserState.RECONNECTING); + Arrays.asList(RtpEndUserState.CONNECTED, RtpEndUserState.RECONNECTING); private static final List STATES_SHOWING_PIP_PLACEHOLDER = Arrays.asList( RtpEndUserState.ACCEPTING_CALL, @@ -165,49 +158,26 @@ public class RtpSessionActivity extends XmppActivity @Override public void onCreate(Bundle savedInstanceState) { - // Check if lock is set - if (getBooleanPreference("app_lock_enabled", R.bool.app_lock_enabled)) { - EasyLock.setBackgroundColor(getColor(R.color.primary_black)); - EasyLock.checkPassword(this); - EasyLock.forgotPassword(new View.OnClickListener() { - @Override - public void onClick(View view) { - Toast.makeText(RtpSessionActivity.this, R.string.app_lock_forgot_password, Toast.LENGTH_LONG).show(); - } - }); - } super.onCreate(savedInstanceState); - getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON - | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD - | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED - | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); + getWindow() + .addFlags( + WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON + | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD + | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED + | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); this.binding = DataBindingUtil.setContentView(this, R.layout.activity_rtp_session); setSupportActionBar(binding.toolbar); - - binding.dialpad.setClickConsumer(tag -> { - final JingleRtpConnection connection = - this.rtpConnectionReference != null ? this.rtpConnectionReference.get() : null; - if (connection != null) connection.applyDtmfTone(tag); - }); - - if (savedInstanceState != null) { - boolean dialpadVisible = savedInstanceState.getBoolean("dialpad_visible"); - binding.dialpad.setVisibility(dialpadVisible ? View.VISIBLE : View.GONE); - } } - @Override public boolean onCreateOptionsMenu(final Menu menu) { getMenuInflater().inflate(R.menu.activity_rtp_session, menu); final MenuItem help = menu.findItem(R.id.action_help); final MenuItem gotoChat = menu.findItem(R.id.action_goto_chat); final MenuItem switchToVideo = menu.findItem(R.id.action_switch_to_video); - final MenuItem dialpad = menu.findItem(R.id.action_dialpad); help.setVisible(Config.HELP != null && isHelpButtonVisible()); gotoChat.setVisible(isSwitchToConversationVisible()); switchToVideo.setVisible(isSwitchToVideoVisible()); - dialpad.setVisible(isAudioOnlyConversation()); return super.onCreateOptionsMenu(menu); } @@ -238,14 +208,6 @@ public class RtpSessionActivity extends XmppActivity } } - private boolean isAudioOnlyConversation() { - final JingleRtpConnection connection = - this.rtpConnectionReference != null ? this.rtpConnectionReference.get() : null; - - return connection != null && !connection.getMedia().contains(Media.VIDEO); - } - - private boolean isSwitchToConversationVisible() { final JingleRtpConnection connection = this.rtpConnectionReference != null ? this.rtpConnectionReference.get() : null; @@ -270,32 +232,20 @@ public class RtpSessionActivity extends XmppActivity switchToConversation(conversation); } - private void toggleDialpadVisibility() { - if (binding.dialpad.getVisibility() == View.VISIBLE) { - binding.dialpad.setVisibility(View.GONE); - } - else { - binding.dialpad.setVisibility(View.VISIBLE); - } - } - - public boolean onOptionsItemSelected(final MenuItem item) { - switch (item.getItemId()) { - case R.id.action_help: - launchHelpInBrowser(); - return true; - case R.id.action_goto_chat: - switchToConversation(); - return true; - case R.id.action_switch_to_video: - requestPermissionAndSwitchToVideo(); - return true; - case R.id.action_dialpad: - toggleDialpadVisibility(); - break; + final var itemItem = item.getItemId(); + if (itemItem == R.id.action_help) { + launchHelpInBrowser(); + return true; + } else if (itemItem == R.id.action_goto_chat) { + switchToConversation(); + return true; + } else if (itemItem == R.id.action_switch_to_video) { + requestPermissionAndSwitchToVideo(); + return true; + } else { + return super.onOptionsItemSelected(item); } - return super.onOptionsItemSelected(item); } private void launchHelpInBrowser() { @@ -372,8 +322,9 @@ public class RtpSessionActivity extends XmppActivity } private void acceptContentAdd(final ContentAddition contentAddition) { - if (contentAddition == null || contentAddition.direction != ContentAddition.Direction.INCOMING) { - Log.d(Config.LOGTAG,"ignore press on content-accept button"); + if (contentAddition == null + || contentAddition.direction != ContentAddition.Direction.INCOMING) { + Log.d(Config.LOGTAG, "ignore press on content-accept button"); return; } requestPermissionAndAcceptContentAdd(contentAddition); @@ -382,7 +333,11 @@ public class RtpSessionActivity extends XmppActivity private void requestPermissionAndAcceptContentAdd(final ContentAddition contentAddition) { final List permissions = permissions(contentAddition.media()); if (PermissionUtils.hasPermission(this, permissions, REQUEST_ACCEPT_CONTENT)) { - requireRtpConnection().acceptContentAdd(contentAddition.summary); + try { + requireRtpConnection().acceptContentAdd(contentAddition.summary); + } catch (final IllegalStateException e) { + Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show(); + } } } @@ -625,7 +580,7 @@ public class RtpSessionActivity extends XmppActivity } } - public void proposeJingleRtpSession( + private void proposeJingleRtpSession( final Account account, final Jid with, final Set media) { checkMicrophoneAvailabilityAsync(); if (with.isBareJid()) { @@ -671,13 +626,6 @@ public class RtpSessionActivity extends XmppActivity .show(); } } - @Override - protected void onSaveInstanceState(@NonNull @NotNull Bundle outState) { - super.onSaveInstanceState(outState); - int visibility = findViewById(R.id.dialpad).getVisibility(); - outState.putInt("dialpad_visibility", visibility); - } - @Override public void onStart() { @@ -741,8 +689,10 @@ public class RtpSessionActivity extends XmppActivity private boolean isConnected() { final JingleRtpConnection connection = this.rtpConnectionReference != null ? this.rtpConnectionReference.get() : null; - final RtpEndUserState endUserState = connection == null ? null : connection.getEndUserState(); - return STATES_CONSIDERED_CONNECTED.contains(endUserState) || endUserState == RtpEndUserState.INCOMING_CONTENT_ADD; + final RtpEndUserState endUserState = + connection == null ? null : connection.getEndUserState(); + return STATES_CONSIDERED_CONNECTED.contains(endUserState) + || endUserState == RtpEndUserState.INCOMING_CONTENT_ADD; } private boolean switchToPictureInPicture() { @@ -820,9 +770,8 @@ public class RtpSessionActivity extends XmppActivity .getJingleConnectionManager() .getTerminalSessionState(with, sessionId); if (terminatedRtpSession == null) { - Log.e(Config.LOGTAG, "failed to initialize activity with running rtp session. session not found"); - finish(); - return true; + throw new IllegalStateException( + "failed to initialize activity with running rtp session. session not found"); } initializeWithTerminatedSessionState(account, with, terminatedRtpSession); return true; @@ -905,68 +854,44 @@ public class RtpSessionActivity extends XmppActivity updateStateDisplay(state, Collections.emptySet(), null); } - private void updateStateDisplay(final RtpEndUserState state, final Set media, final ContentAddition contentAddition) { + private void updateStateDisplay( + final RtpEndUserState state, + final Set media, + final ContentAddition contentAddition) { switch (state) { - case INCOMING_CALL: + case INCOMING_CALL -> { Preconditions.checkArgument(media.size() > 0, "Media must not be empty"); if (media.contains(Media.VIDEO)) { setTitle(R.string.rtp_state_incoming_video_call); } else { setTitle(R.string.rtp_state_incoming_call); } - break; - case INCOMING_CONTENT_ADD: + } + case INCOMING_CONTENT_ADD -> { if (contentAddition != null && contentAddition.media().contains(Media.VIDEO)) { setTitle(R.string.rtp_state_content_add_video); } else { setTitle(R.string.rtp_state_content_add); } - break; - case CONNECTING: - setTitle(R.string.rtp_state_connecting); - break; - case CONNECTED: - setTitle(R.string.rtp_state_connected); - break; - case RECONNECTING: - setTitle(R.string.rtp_state_reconnecting); - break; - case ACCEPTING_CALL: - setTitle(R.string.rtp_state_accepting_call); - break; - case ENDING_CALL: - setTitle(R.string.rtp_state_ending_call); - break; - case FINDING_DEVICE: - setTitle(R.string.rtp_state_finding_device); - break; - case RINGING: - setTitle(R.string.rtp_state_ringing); - break; - case DECLINED_OR_BUSY: - setTitle(R.string.rtp_state_declined_or_busy); - break; - case CONNECTIVITY_ERROR: - setTitle(R.string.rtp_state_connectivity_error); - break; - case CONNECTIVITY_LOST_ERROR: - setTitle(R.string.rtp_state_connectivity_lost_error); - break; - case RETRACTED: - setTitle(R.string.rtp_state_retracted); - break; - case APPLICATION_ERROR: - setTitle(R.string.rtp_state_application_failure); - break; - case SECURITY_ERROR: - setTitle(R.string.rtp_state_security_error); - break; - case ENDED: - throw new IllegalStateException( - "Activity should have called finishAndReleaseWakeLock();"); - default: - throw new IllegalStateException( - String.format("State %s has not been handled in UI", state)); + } + case CONNECTING -> setTitle(R.string.rtp_state_connecting); + case CONNECTED -> setTitle(R.string.rtp_state_connected); + case RECONNECTING -> setTitle(R.string.rtp_state_reconnecting); + case ACCEPTING_CALL -> setTitle(R.string.rtp_state_accepting_call); + case ENDING_CALL -> setTitle(R.string.rtp_state_ending_call); + case FINDING_DEVICE -> setTitle(R.string.rtp_state_finding_device); + case RINGING -> setTitle(R.string.rtp_state_ringing); + case DECLINED_OR_BUSY -> setTitle(R.string.rtp_state_declined_or_busy); + case CONTACT_OFFLINE -> setTitle(R.string.rtp_state_contact_offline); + case CONNECTIVITY_ERROR -> setTitle(R.string.rtp_state_connectivity_error); + case CONNECTIVITY_LOST_ERROR -> setTitle(R.string.rtp_state_connectivity_lost_error); + case RETRACTED -> setTitle(R.string.rtp_state_retracted); + case APPLICATION_ERROR -> setTitle(R.string.rtp_state_application_failure); + case SECURITY_ERROR -> setTitle(R.string.rtp_state_security_error); + case ENDED -> throw new IllegalStateException( + "Activity should have called finishAndReleaseWakeLock();"); + default -> throw new IllegalStateException( + String.format("State %s has not been handled in UI", state)); } } @@ -1022,7 +947,10 @@ public class RtpSessionActivity extends XmppActivity } @SuppressLint("RestrictedApi") - private void updateButtonConfiguration(final RtpEndUserState state, final Set media, final ContentAddition contentAddition) { + private void updateButtonConfiguration( + final RtpEndUserState state, + final Set media, + final ContentAddition contentAddition) { if (state == RtpEndUserState.ENDING_CALL || isPictureInPicture()) { this.binding.rejectCall.setVisibility(View.INVISIBLE); this.binding.endCall.setVisibility(View.INVISIBLE); @@ -1038,7 +966,8 @@ public class RtpSessionActivity extends XmppActivity this.binding.acceptCall.setImageResource(R.drawable.ic_call_white_48dp); this.binding.acceptCall.setVisibility(View.VISIBLE); } else if (state == RtpEndUserState.INCOMING_CONTENT_ADD) { - this.binding.rejectCall.setContentDescription(getString(R.string.reject_switch_to_video)); + this.binding.rejectCall.setContentDescription( + getString(R.string.reject_switch_to_video)); this.binding.rejectCall.setOnClickListener(this::rejectContentAdd); this.binding.rejectCall.setImageResource(R.drawable.ic_clear_white_48dp); this.binding.rejectCall.setVisibility(View.VISIBLE); @@ -1047,7 +976,8 @@ public class RtpSessionActivity extends XmppActivity this.binding.acceptCall.setOnClickListener((v -> acceptContentAdd(contentAddition))); this.binding.acceptCall.setImageResource(R.drawable.ic_baseline_check_24); this.binding.acceptCall.setVisibility(View.VISIBLE); - } else if (state == RtpEndUserState.DECLINED_OR_BUSY) { + } else if (asList(RtpEndUserState.DECLINED_OR_BUSY, RtpEndUserState.CONTACT_OFFLINE) + .contains(state)) { this.binding.rejectCall.setContentDescription(getString(R.string.exit)); this.binding.rejectCall.setOnClickListener(this::exit); this.binding.rejectCall.setImageResource(R.drawable.ic_clear_white_48dp); @@ -1130,7 +1060,7 @@ public class RtpSessionActivity extends XmppActivity private void updateInCallButtonConfigurationSpeaker( final CallIntegration.AudioDevice selectedAudioDevice, final int numberOfChoices) { switch (selectedAudioDevice) { - case EARPIECE: + case EARPIECE -> { this.binding.inCallActionRight.setImageResource( R.drawable.ic_volume_off_black_24dp); if (numberOfChoices >= 2) { @@ -1139,13 +1069,13 @@ public class RtpSessionActivity extends XmppActivity this.binding.inCallActionRight.setOnClickListener(null); this.binding.inCallActionRight.setClickable(false); } - break; - case WIRED_HEADSET: + } + case WIRED_HEADSET -> { this.binding.inCallActionRight.setImageResource(R.drawable.ic_headset_black_24dp); this.binding.inCallActionRight.setOnClickListener(null); this.binding.inCallActionRight.setClickable(false); - break; - case SPEAKER_PHONE: + } + case SPEAKER_PHONE -> { this.binding.inCallActionRight.setImageResource(R.drawable.ic_volume_up_black_24dp); if (numberOfChoices >= 2) { this.binding.inCallActionRight.setOnClickListener(this::switchToEarpiece); @@ -1153,13 +1083,13 @@ public class RtpSessionActivity extends XmppActivity this.binding.inCallActionRight.setOnClickListener(null); this.binding.inCallActionRight.setClickable(false); } - break; - case BLUETOOTH: + } + case BLUETOOTH -> { this.binding.inCallActionRight.setImageResource( R.drawable.ic_bluetooth_audio_black_24dp); this.binding.inCallActionRight.setOnClickListener(null); this.binding.inCallActionRight.setClickable(false); - break; + } } this.binding.inCallActionRight.setVisibility(View.VISIBLE); } @@ -1188,10 +1118,10 @@ public class RtpSessionActivity extends XmppActivity private void switchCamera(final View view) { Futures.addCallback( requireRtpConnection().switchCamera(), - new FutureCallback() { + new FutureCallback<>() { @Override public void onSuccess(@Nullable Boolean isFrontCamera) { - binding.localVideo.setMirror(isFrontCamera); + binding.localVideo.setMirror(Boolean.TRUE.equals(isFrontCamera)); } @Override @@ -1550,8 +1480,7 @@ public class RtpSessionActivity extends XmppActivity final Account account, Jid with, final RtpEndUserState state, final Set media) { final Intent intent = new Intent(Intent.ACTION_VIEW); intent.putExtra(EXTRA_ACCOUNT, account.getJid().toEscapedString()); - if (RtpCapability.jmiSupport(account.getRoster() - .getContact(with))) { + if (RtpCapability.jmiSupport(account.getRoster().getContact(with))) { intent.putExtra(EXTRA_WITH, with.asBareJid().toEscapedString()); } else { intent.putExtra(EXTRA_WITH, with.toEscapedString()); diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/RtpEndUserState.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/RtpEndUserState.java index 885820460..fff82031a 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/RtpEndUserState.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/RtpEndUserState.java @@ -1,20 +1,23 @@ package eu.siacs.conversations.xmpp.jingle; public enum RtpEndUserState { - INCOMING_CALL, //received a 'propose' message - CONNECTING, //session-initiate or session-accepted but no webrtc peer connection yet - CONNECTED, //session-accepted and webrtc peer connection is connected - RECONNECTING, //session-accepted and webrtc peer connection was connected once but is currently disconnected or failed - INCOMING_CONTENT_ADD, //session-accepted with a pending, incoming content-add - FINDING_DEVICE, //'propose' has been sent out; no 184 ack yet - RINGING, //'propose' has been sent out and it has been 184 acked - ACCEPTING_CALL, //'proceed' message has been sent; but no session-initiate has been received - ENDING_CALL, //libwebrt says 'closed' but session-terminate has not gone through - ENDED, //close UI - DECLINED_OR_BUSY, //other party declined; no retry button - CONNECTIVITY_ERROR, //network error; retry button - CONNECTIVITY_LOST_ERROR, //network error but for call duration > 0 - RETRACTED, //user pressed home or power button during 'ringing' - shows retry button - APPLICATION_ERROR, //something rather bad happened; libwebrtc failed or we got in IQ-error - SECURITY_ERROR //problem with DTLS (missing) or verification + INCOMING_CALL, // received a 'propose' message + CONNECTING, // session-initiate or session-accepted but no webrtc peer connection yet + CONNECTED, // session-accepted and webrtc peer connection is connected + RECONNECTING, // session-accepted and webrtc peer connection was connected once but is currently + // disconnected or failed + INCOMING_CONTENT_ADD, // session-accepted with a pending, incoming content-add + FINDING_DEVICE, // 'propose' has been sent out; no 184 ack yet + RINGING, // 'propose' has been sent out and it has been 184 acked + ACCEPTING_CALL, // 'proceed' message has been sent; but no session-initiate has been received + ENDING_CALL, // libwebrt says 'closed' but session-terminate has not gone through + ENDED, // close UI + DECLINED_OR_BUSY, // other party declined; no retry button + CONTACT_OFFLINE, // when `JINGLE_MESSAGE_INIT_STRICT_OFFLINE_CHECK` is true this shows up when + // the contact is offline, generally similar to BUSY + CONNECTIVITY_ERROR, // network error; retry button + CONNECTIVITY_LOST_ERROR, // network error but for call duration > 0 + RETRACTED, // user pressed home or power button during 'ringing' - shows retry button + APPLICATION_ERROR, // something rather bad happened; libwebrtc failed or we got in IQ-error + SECURITY_ERROR // problem with DTLS (missing) or verification }