|
NIST-SIP: The Reference Implementation for JAIN-SIP 1.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgov.nist.javax.sip.stack.DefaultRouter
public class DefaultRouter
This is the default router. When the implementation wants to forward a request and had run out of othe options, then it calls this method to figure out where to send the request. The default router implements a simple "default routing algorithm" which just forwards to the configured proxy address.
When javax.sip.USE_ROUTER_FOR_ALL_URIS
is set to
false
, the next hop is determined according to the following
algorithm:
javax.sip.OUTBOUND_PROXY
is set,
use its value as the next hop
Router.getNextHop(Request)
provided
by the application.
(*)Note that in case the topmost Route header contains no 'lr' parameter (which means the next hop is a strict router), the implementation will perform 'Route Information Postprocessing' as described in RFC3261 section 16.6 step 6 (also known as "Route header popping"). That is, the following modifications will be made to the request:
Constructor Summary | |
---|---|
DefaultRouter(SipStack sipStack,
String defaultRoute)
Constructor. |
Method Summary | |
---|---|
void |
fixStrictRouting(SIPRequest req)
Performs strict router fix according to RFC3261 section 16.6 step 6 pre: top route header in request has no 'lr' parameter in URI post: request-URI added as last route header, new req-URI = top-route-URI |
Hop |
getNextHop(Request request)
Return addresses for default proxy to forward the request to. |
ListIterator |
getNextHops(Request request)
Gets the ListIterator of the hops of the default Route. |
Hop |
getOutboundProxy()
Get the default hop. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultRouter(SipStack sipStack, String defaultRoute)
Method Detail |
---|
public Hop getNextHop(Request request) throws SipException
RouteHeader firstRoute = (RouteHeader) req.getHeader( RouteHeader.NAME );
if (firstRoute!=null) {
URI uri = firstRoute.getAddress().getURI();
if (uri.isSIPUri()) {
SipURI nextHop = (SipURI) uri;
if ( nextHop.hasLrParam() ) {
// OK, use it
} else {
nextHop = fixStrictRouting( req ); <--- Here, make the modifications as per RFC3261
}
} else {
// error: non-SIP URI not allowed in Route headers
throw new SipException( "Request has Route header with non-SIP URI" );
}
} else if (outboundProxy!=null) {
// use outbound proxy for nextHop
} else if ( req.getRequestURI().isSipURI() ) {
// use request URI for nextHop
}
getNextHop
in interface Router
request
- is the sip request to route.
SipException
- when there is something wrong with the requestHop
public void fixStrictRouting(SIPRequest req)
public Hop getOutboundProxy()
getOutboundProxy
in interface Router
Hop
public ListIterator getNextHops(Request request)
Router
getNextHops
in interface Router
|
NIST-SIP: The Reference Implementation for JAIN-SIP 1.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |