public void errResponseReceived(SipResponse sipResponse) {
int statusCode = sipResponse.getStatusCode();
if (statusCode == RFC3261.CODE_401_UNAUTHORIZED
|| statusCode == RFC3261.CODE_407_PROXY_AUTHENTICATION_REQUIRED
&& !challenged) {
NonInviteClientTransaction nonInviteClientTransaction =
(NonInviteClientTransaction)
transactionManager.getClientTransaction(sipResponse);
SipRequest sipRequest = nonInviteClientTransaction.getRequest();
String password = userAgent.getConfig().getPassword();
if (password != null && !"".equals(password.trim())) {
challengeManager.handleChallenge(sipRequest,
sipResponse);
}