String[] routes = routerInfo.getRoutes();
try
{
if (SipRouteModifier.ROUTE == routerInfo.getRouteModifier() && routes != null)
{
Address topRoute = new NameAddr(routes[0]);
if (getConnectorManager().isLocalUri(topRoute.getURI()))
request.setPoppedRoute(topRoute);
else
{
for (int i = routes.length; i >= 0; --i)
request.pushRoute(new NameAddr(routes[i]));
request.send();
return true;
}
}
else if (SipRouteModifier.ROUTE_BACK == routerInfo.getRouteModifier() && routes != null)
{
SipConnector defaultConnector = getConnectorManager().getDefaultConnector();
SipURI ownRoute = new SipURIImpl(null, defaultConnector.getHost(), defaultConnector.getPort());
RouterInfoUtil.encode(ownRoute, routerInfo);
ownRoute.setLrParam(true);
request.pushRoute(ownRoute);
for (int i = routes.length; i >= 0; --i)
request.pushRoute(new NameAddr(routes[i]));
request.send();
return true;
}
else if (routes == null
&& (SipRouteModifier.ROUTE_BACK == routerInfo.getRouteModifier() || SipRouteModifier.ROUTE == routerInfo.getRouteModifier()))