01: package examples.tls;
02:
03: import javax.sip.*;
04: import javax.sip.address.*;
05: import javax.sip.message.*;
06:
07: import java.util.*;
08:
09: public class MyRouter implements Router {
10: protected SipStack myStack;
11: protected HopImpl defaultRoute;
12:
13: public MyRouter(SipStack sipStack, String nextHop) {
14:
15: this .myStack = sipStack;
16: this .defaultRoute = new HopImpl(nextHop);
17: }
18:
19: /** Always send requests to the default route location.
20: */
21: public ListIterator getNextHops(Request sipRequest) {
22: LinkedList ll = null;
23: if (defaultRoute != null) {
24: if (ll == null)
25: ll = new LinkedList();
26: ll.add(defaultRoute);
27: return ll.listIterator();
28: } else
29: return null;
30: }
31:
32: public Hop getOutboundProxy() {
33: return this .defaultRoute;
34: }
35:
36: public Hop getNextHop(Request request) throws SipException {
37: return this.defaultRoute;
38: }
39:
40: }
|