Methods Summary |
---|
private Hop | createHop(URI requestUri, java.lang.String transport)Creates new Hop for given uri and transport
Hop hop = null;
if (requestUri.isSipURI()) {
SipURI sipUri = (SipURI)requestUri;
int port = sipUri.getPort();
if (port == -1) { // default port
port = SIPConstants.DEFAULT_NONTLS_PORT;
}
hop = new Hop(sipUri.getHost(), port,
transport);
}
return hop;
|
public java.util.Enumeration | getNextHops(Request sipRequest, boolean isDialog)Return a linked list of addresses corresponding to a requestURI.
This is called for sending out outbound messages for which we do
not directly have the request URI. The implementaion function
is expected to return a linked list of addresses to which the
request is forwarded. The implementation may use this method
to perform location searches etc.
Vector hopList = new Vector();
if (defaultRoute != null) {
hopList.addElement(defaultRoute);
} else {
URI requestUri = null;
String transport = null;
RouteList rl = sipRequest.getRouteHeaders();
// When request has no route list,
// it's destination URI is same as out of dialog
if (rl == null || rl.isEmpty()) {
isDialog = false;
}
Hop hop;
// out of dialog - get destination URI from request URI
if (!isDialog) {
requestUri = sipRequest.getRequestURI();
SipURI requestLineUri =
(SipURI)sipRequest.getRequestLine().getUri();
if (requestLineUri.hasTransport()) {
transport = requestLineUri.getTransportParam();
} else {
transport = sipStack.getDefaultTransport();
}
hop = createHop(requestUri, transport);
hopList.addElement(hop);
} else { // inside dialog - get destination URI from first route
Enumeration el = rl.getElements();
RouteHeader route;
while (el.hasMoreElements()) {
route = (RouteHeader) el.nextElement();
requestUri = route.getAddress().getURI();
transport = route.getAddress().
getParameter(SIPConstants.GENERAL_TRANSPORT);
hop = createHop(requestUri, transport);
hopList.addElement(hop);
}
}
}
return hopList.elements();
|
public Hop | getOutboundProxy()Gets the default hop. return this.defaultRoute;
|
public void | setNextHop(java.lang.String hopString)Sets the next hop address.
defaultRoute = new Hop(hopString);
defaultRoute.setDefaultRouteFlag();
|
public void | setOutboundProxy(java.lang.String outboundProxy)Sets the outbound proxy.
this.defaultRoute = new Hop(outboundProxy);
|
public void | setSipStack(SipStack sipStack)Sets the SIP stack context.
this.sipStack = sipStack;
|