Merge "Handle SIP authentication response for BYE."
This commit is contained in:
@@ -63,6 +63,9 @@ public final class SipSession {
|
||||
/** When an OPTIONS request is sent. */
|
||||
public static final int PINGING = 9;
|
||||
|
||||
/** When ending a call. @hide */
|
||||
public static final int ENDING_CALL = 10;
|
||||
|
||||
/** Not defined. */
|
||||
public static final int NOT_DEFINED = 101;
|
||||
|
||||
|
||||
@@ -98,6 +98,7 @@ class SipSessionGroup implements SipListener {
|
||||
private static final String THREAD_POOL_SIZE = "1";
|
||||
private static final int EXPIRY_TIME = 3600; // in seconds
|
||||
private static final int CANCEL_CALL_TIMER = 3; // in seconds
|
||||
private static final int END_CALL_TIMER = 3; // in seconds
|
||||
private static final int KEEPALIVE_TIMEOUT = 3; // in seconds
|
||||
private static final int INCALL_KEEPALIVE_INTERVAL = 10; // in seconds
|
||||
private static final long WAKE_LOCK_HOLDING_TIME = 500; // in milliseconds
|
||||
@@ -756,6 +757,9 @@ class SipSessionGroup implements SipListener {
|
||||
case SipSession.State.IN_CALL:
|
||||
processed = inCall(evt);
|
||||
break;
|
||||
case SipSession.State.ENDING_CALL:
|
||||
processed = endingCall(evt);
|
||||
break;
|
||||
default:
|
||||
processed = false;
|
||||
}
|
||||
@@ -1230,8 +1234,10 @@ class SipSessionGroup implements SipListener {
|
||||
// OK retransmission is handled in SipStack
|
||||
if (END_CALL == evt) {
|
||||
// rfc3261#section-15.1.1
|
||||
mState = SipSession.State.ENDING_CALL;
|
||||
mSipHelper.sendBye(mDialog);
|
||||
endCallNormally();
|
||||
mProxy.onCallEnded(this);
|
||||
startSessionTimer(END_CALL_TIMER);
|
||||
return true;
|
||||
} else if (isRequestEvent(Request.INVITE, evt)) {
|
||||
// got Re-INVITE
|
||||
@@ -1260,6 +1266,28 @@ class SipSessionGroup implements SipListener {
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean endingCall(EventObject evt) throws SipException {
|
||||
if (expectResponse(Request.BYE, evt)) {
|
||||
ResponseEvent event = (ResponseEvent) evt;
|
||||
Response response = event.getResponse();
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
switch (statusCode) {
|
||||
case Response.UNAUTHORIZED:
|
||||
case Response.PROXY_AUTHENTICATION_REQUIRED:
|
||||
if (handleAuthentication(event)) {
|
||||
return true;
|
||||
} else {
|
||||
// can't authenticate; pass through to end session
|
||||
}
|
||||
}
|
||||
cancelSessionTimer();
|
||||
reset();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// timeout in seconds
|
||||
private void startSessionTimer(int timeout) {
|
||||
if (timeout > 0) {
|
||||
|
||||
Reference in New Issue
Block a user