private TargetTuple selectTTToUse(SipServletRequestImpl msg) {
// check for the JSR 289 outbound interface in the message
// if not found use the external address in sip-container
TargetTuple outtt = null;
OutboundInterface oi = msg.getOutboundInterface();
SipBindingCtx sipBindingCtx = SipBindingResolver.instance().
getActiveExternalContext();
for (TargetTuple tt : sipBindingCtx.getTargetTuples()) {
if (msg.getTransport().equalsIgnoreCase(tt.getProtocol().name())) {
outtt = tt;
break;
}
}
if (oi == null) {
return outtt;
} else {
int port = oi.getPort() == 0 ? outtt.getPort() : oi.getPort();
return new TargetTuple(outtt.getProtocol(), oi.getHost(), port);
}
}