@Override protected void onCallEnded(DisconnectCause cause) { if (getDisconnectCause() != DisconnectCause.LOCAL) { setDisconnectCause(cause); } synchronized (SipPhone.class) { setState(Call.State.DISCONNECTED); SipAudioCall sipAudioCall = mSipAudioCall; // FIXME: This goes null and is synchronized, but many uses aren't sync'd mSipAudioCall = null; String sessionState = (sipAudioCall == null) ? "" : (sipAudioCall.getState() + ", "); if (SCN_DBG) log( "[SipAudioCallAdapter] onCallEnded: " + mPeer.getUriString() + ": " + sessionState + "cause: " + getDisconnectCause() + ", on phone " + getPhone()); if (sipAudioCall != null) { sipAudioCall.setListener(null); sipAudioCall.close(); } mOwner.onConnectionEnded(SipConnection.this); } }