// Sending out request UAC or Proxy
// Slightly special handling of ACK and CANCEL
String method = req.getMethod();
if (!method.equals("CANCEL")) {
Header via = req.getRawHeader(Header.VIA);
if (via == null) {
via = new MultiLineHeader(Header.VIA, true);
}
TargetTuple ttToUse = selectTTToUse(req);
if (log.isLoggable(Level.FINEST)) {
log.log(Level.FINEST, "Via header transport: " +
ttToUse.getIP()+":"+ttToUse.getPort()+" Transport="+
ttToUse.getProtocol().name());
}
ViaImpl v = new ViaImpl(req.getProtocol(),
req.getTransport().toUpperCase(), ttToUse.getIP(),
ttToUse.getPort());
String id = Transaction.generateBranch();
v.setParameter(ViaImpl.PARAM_BRANCH, id);
if (log.isLoggable(Level.FINE)) {
log.log(Level.FINE, "Adding via = " + v);
}
String string_via = v.toString();
if (req.getHeader("VIA_NEXTHOP_PARAMETERS") != null) {
// special handling for applications that wants to affect the future via
String via_nexthop_parameters = req.getHeader("VIA_NEXTHOP_PARAMETERS");
req.removeHeader("VIA_NEXTHOP_PARAMETERS"); // we should never keep this header when request is sent
string_via += ';'+ via_nexthop_parameters; // plain String concatenation, knowledge & responsiblity is of application
}
via.setValue(string_via, true);
req.setHeader(via);
if (!method.equals("ACK")) {
ClientTransaction ct = method.equals("INVITE")
? new InviteClientTransaction(id, req)