String topVia = li.next();
if ((topVia != null) && resp.getMethod().equals("INVITE")) {
// An INVITE response need to save the topVia, which is used
// by CANCEL to find it's way to the correct transaction...
Header viaOfCancel = new MultiLineHeader(Header.VIA, true);
ViaImpl v = new ViaImpl(topVia);
viaOfCancel.setValue(v.toString(), true);
resp.setCancelVia(viaOfCancel);
}
// TODO could match to see that it's the right host'n port
li.remove();