@Override public void hangup() throws CallStateException { synchronized (SipPhone.class) { if (SCN_DBG) log( "hangup: conn=" + mPeer.getUriString() + ": " + mState + ": on phone " + getPhone().getPhoneName()); if (!mState.isAlive()) return; try { SipAudioCall sipAudioCall = mSipAudioCall; if (sipAudioCall != null) { sipAudioCall.setListener(null); sipAudioCall.endCall(); } } catch (SipException e) { throw new CallStateException("hangup(): " + e); } finally { mAdapter.onCallEnded( ((mState == Call.State.INCOMING) || (mState == Call.State.WAITING)) ? DisconnectCause.INCOMING_REJECTED : DisconnectCause.LOCAL); } } }
@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); } }
void dial() throws SipException { setState(Call.State.DIALING); mSipAudioCall = mSipManager.makeAudioCall(mProfile, mPeer, null, TIMEOUT_MAKE_CALL); mSipAudioCall.setListener(mAdapter); }
void initIncomingCall(SipAudioCall sipAudioCall, Call.State newState) { setState(newState); mSipAudioCall = sipAudioCall; sipAudioCall.setListener(mAdapter); // call back to set state mIncoming = true; }