diff --git a/src/cheogram/java/com/cheogram/android/ConnectionService.java b/src/cheogram/java/com/cheogram/android/ConnectionService.java index c66889a47..c46560caa 100644 --- a/src/cheogram/java/com/cheogram/android/ConnectionService.java +++ b/src/cheogram/java/com/cheogram/android/ConnectionService.java @@ -290,6 +290,17 @@ public class ConnectionService extends android.telecom.ConnectionService { }); } + @Override + public void onStateChanged(int state) { + if (state == STATE_DISCONNECTED) { + mHandler.post(() -> { + destroy(); + xmppConnectionService.setDiallerIntegrationActive(false); + xmppConnectionService.removeRtpConnectionUpdateListener(this); + }); + } + } + @Override public void onDisconnect() { mHandler.post(() -> { @@ -298,11 +309,8 @@ public class ConnectionService extends android.telecom.ConnectionService { } else { rtpConnection.get().endCall(); } - destroy(); - xmppConnectionService.setDiallerIntegrationActive(false); - xmppConnectionService.removeRtpConnectionUpdateListener( - (XmppConnectionService.OnJingleRtpConnectionUpdate) this - ); + + setDisconnected(new DisconnectCause(DisconnectCause.LOCAL)); }); }