All Downloads are FREE. Search and download functionalities are using the official Maven repository.

examples.tls.MyRouter Maven / Gradle / Ivy

There is a newer version: 1.3.0-91
Show newest version
package examples.tls;
import javax.sip.*;
import javax.sip.address.*;
import javax.sip.message.*;

import java.util.*;

public class MyRouter implements Router {
    protected SipStack myStack;
    protected HopImpl defaultRoute;

    public MyRouter(SipStack sipStack, String nextHop) {

        this.myStack = sipStack;
        this.defaultRoute = new HopImpl(nextHop);
    }

    /** Always send requests to the default route location.
    */
    public ListIterator getNextHops(Request sipRequest) {
        LinkedList ll = null;
        if (defaultRoute != null) {
            if (ll == null)
                ll = new LinkedList();
            ll.add(defaultRoute);
            return ll.listIterator();
        } else
            return null;
    }

    public Hop getOutboundProxy() {
        return this.defaultRoute;
    }

    public Hop getNextHop(Request request) throws SipException {
        return this.defaultRoute;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy