am 316e72cb: am 5dde95b8: Merge "Fix the bug of authentication in an outgoing call." into gingerbread
Merge commit '316e72cb05637735c67ae02911dd0dbe096c71f5'
* commit '316e72cb05637735c67ae02911dd0dbe096c71f5':
Fix the bug of authentication in an outgoing call.
diff --git a/services/java/com/android/server/sip/SipSessionGroup.java b/services/java/com/android/server/sip/SipSessionGroup.java
index 94769d8..e720274 100644
--- a/services/java/com/android/server/sip/SipSessionGroup.java
+++ b/services/java/com/android/server/sip/SipSessionGroup.java
@@ -19,6 +19,7 @@
import gov.nist.javax.sip.clientauthutils.AccountManager;
import gov.nist.javax.sip.clientauthutils.UserCredentials;
import gov.nist.javax.sip.header.SIPHeaderNames;
+import gov.nist.javax.sip.header.ProxyAuthenticate;
import gov.nist.javax.sip.header.WWWAuthenticate;
import gov.nist.javax.sip.message.SIPMessage;
@@ -731,7 +732,8 @@
Response response = event.getResponse();
String nonce = getNonceFromResponse(response);
if (((nonce != null) && nonce.equals(mLastNonce)) ||
- (nonce == mLastNonce)) {
+ (nonce == null)) {
+ mLastNonce = nonce;
return false;
} else {
mClientTransaction = mSipHelper.handleChallenge(
@@ -764,9 +766,12 @@
}
private String getNonceFromResponse(Response response) {
- WWWAuthenticate authHeader = (WWWAuthenticate)(response.getHeader(
- SIPHeaderNames.WWW_AUTHENTICATE));
- return (authHeader == null) ? null : authHeader.getNonce();
+ WWWAuthenticate wwwAuth = (WWWAuthenticate)response.getHeader(
+ SIPHeaderNames.WWW_AUTHENTICATE);
+ if (wwwAuth != null) return wwwAuth.getNonce();
+ ProxyAuthenticate proxyAuth = (ProxyAuthenticate)response.getHeader(
+ SIPHeaderNames.PROXY_AUTHENTICATE);
+ return (proxyAuth == null) ? null : proxyAuth.getNonce();
}
private boolean readyForCall(EventObject evt) throws SipException {