}
} else { // not 401 nor 407
SipHeaders sipHeaders = sipResponse.getSipHeaders();
SipHeaderFieldName viaName = new SipHeaderFieldName(
RFC3261.HDR_VIA);
SipHeaderFieldValue via = sipHeaders.get(viaName);
SipHeaderParamName receivedName = new SipHeaderParamName(
RFC3261.PARAM_RECEIVED);
String viaValue = via.getValue();
int pos = viaValue.indexOf(" ");
if (pos > -1) {
viaValue = viaValue.substring(pos + 1);
pos = viaValue.indexOf(RFC3261.TRANSPORT_PORT_SEP);
if (pos > -1) {
viaValue = viaValue.substring(0, pos);
} else {
pos = viaValue.indexOf(RFC3261.PARAM_SEPARATOR);
if (pos > -1) {
viaValue = viaValue.substring(0, pos);
}
}
}
String received = via.getParam(receivedName);
if (received != null && !"".equals(received.trim())) {
if (viaValue.equals(received)) {
notifyListener(sipResponse);
} else { // received != via ip address
try {