SipPhone: revise hangup() in SipCall and SipConnection.

Make them DISCONNECTED immediately. Don't enter DISCONNECTING state and wait
until SipSession ends the session. SipSession will get timed out eventually
but PhoneApp/user don't need to know this detail and wait.

This should fix the bug:
http://b/issue?id=3027719

Change-Id: Ida5a1bd09d08b9d591721384b4978127619aab51
This commit is contained in:
Hung-ying Tyan
2010-09-28 13:27:07 +08:00
parent 71e2486209
commit 421c34c162

View File

@@ -444,6 +444,7 @@ public class SipPhone extends SipPhoneBase {
if (state.isAlive()) {
Log.d(LOG_TAG, "hang up call: " + getState() + ": " + this
+ " on phone " + getPhone());
setState(State.DISCONNECTING);
CallStateException excp = null;
for (Connection c : connections) {
try {
@@ -453,7 +454,6 @@ public class SipPhone extends SipPhoneBase {
}
}
if (excp != null) throw excp;
setState(State.DISCONNECTING);
} else {
Log.d(LOG_TAG, "hang up dead call: " + getState() + ": "
+ this + " on phone " + getPhone());
@@ -630,13 +630,20 @@ public class SipPhone extends SipPhoneBase {
}
synchronized (SipPhone.class) {
setState(Call.State.DISCONNECTED);
mSipAudioCall.close();
mOwner.onConnectionEnded(SipConnection.this);
Log.v(LOG_TAG, "-------- connection ended: "
+ mPeer.getUriString() + ": "
+ mSipAudioCall.getState() + ", cause: "
+ getDisconnectCause() + ", on phone "
SipAudioCall sipAudioCall = mSipAudioCall;
mSipAudioCall = null;
String sessionState = (sipAudioCall == null)
? ""
: (sipAudioCall.getState() + ", ");
Log.v(LOG_TAG, "--- connection ended: "
+ mPeer.getUriString() + ": " + sessionState
+ "cause: " + getDisconnectCause() + ", on phone "
+ getPhone());
if (sipAudioCall != null) {
sipAudioCall.setListener(null);
sipAudioCall.close();
}
mOwner.onConnectionEnded(SipConnection.this);
}
}
@@ -790,14 +797,17 @@ public class SipPhone extends SipPhoneBase {
synchronized (SipPhone.class) {
Log.v(LOG_TAG, "hangup conn: " + mPeer.getUriString() + ": "
+ mState + ": on phone " + getPhone().getPhoneName());
if (!mState.isAlive()) return;
try {
if (mState.isAlive()) {
if (mSipAudioCall != null) mSipAudioCall.endCall();
setState(Call.State.DISCONNECTING);
setDisconnectCause(DisconnectCause.LOCAL);
SipAudioCall sipAudioCall = mSipAudioCall;
if (sipAudioCall != null) {
sipAudioCall.setListener(null);
sipAudioCall.endCall();
}
} catch (SipException e) {
throw new CallStateException("hangup(): " + e);
} finally {
mAdapter.onCallEnded(DisconnectCause.LOCAL);
}
}
}