Package javax.sip.address

Examples of javax.sip.address.SipURI


                String toSipAddress = "there.com";
                String toUser = "LittleGuy";
                String toDisplayName = "The Little Blister";

                // create >From Header
                SipURI fromAddress = addressFactory.createSipURI(fromName,
                        fromSipAddress);

                Address fromNameAddress = addressFactory
                        .createAddress(fromAddress);
                fromNameAddress.setDisplayName(fromDisplayName);
                FromHeader fromHeader = headerFactory.createFromHeader(
                        fromNameAddress, "12345");

                // create To Header
                SipURI toAddress = addressFactory.createSipURI(toUser,
                        toSipAddress);
                Address toNameAddress = addressFactory.createAddress(toAddress);
                toNameAddress.setDisplayName(toDisplayName);
                ToHeader toHeader = headerFactory.createToHeader(toNameAddress,
                        null);

                // create Request URI
                SipURI requestURI = addressFactory.createSipURI(toUser,
                        peerHostPort);

                // Create ViaHeaders

                ArrayList viaHeaders = new ArrayList();
                String ipAddress = udpListeningPoint.getIPAddress();
                ViaHeader viaHeader = headerFactory.createViaHeader(ipAddress,
                        sipProvider.getListeningPoint(transport).getPort(),
                        transport, null);

                // add via headers
                viaHeaders.add(viaHeader);

                // Create ContentTypeHeader
                ContentTypeHeader contentTypeHeader = headerFactory
                        .createContentTypeHeader("application", "sdp");

                // Create a new CallId header
                CallIdHeader callIdHeader = sipProvider.getNewCallId();

                // Create a new Cseq header
                CSeqHeader cSeqHeader = headerFactory.createCSeqHeader(1L,
                        Request.INVITE);

                // Create a new MaxForwardsHeader
                MaxForwardsHeader maxForwards = headerFactory
                        .createMaxForwardsHeader(70);

                // Create the request.
                Request request = messageFactory.createRequest(requestURI,
                        Request.INVITE, callIdHeader, cSeqHeader, fromHeader,
                        toHeader, viaHeaders, maxForwards);
                // Create contact headers
                String host = "127.0.0.1";

                SipURI contactUrl = addressFactory.createSipURI(fromName, host);
                contactUrl.setPort(udpListeningPoint.getPort());
                contactUrl.setLrParam();

                // Create the contact name address.
                SipURI contactURI = addressFactory.createSipURI(fromName, host);
                contactURI.setPort(sipProvider.getListeningPoint(transport)
                        .getPort());

                Address contactAddress = addressFactory
                        .createAddress(contactURI);
View Full Code Here


        String toSipAddress = "there.com";
        String toUser = "LittleGuy";
        String toDisplayName = "The Little Blister";

        // create >From Header
        SipURI fromAddress = protocolObjects.addressFactory.createSipURI(
            fromName, fromSipAddress);

        Address fromNameAddress = protocolObjects.addressFactory
            .createAddress(fromAddress);
        fromNameAddress.setDisplayName(fromDisplayName);
        FromHeader fromHeader = protocolObjects.headerFactory
            .createFromHeader(fromNameAddress, new Integer((int) (Math
                .random() * Integer.MAX_VALUE)).toString());

        // create To Header
        SipURI toAddress = protocolObjects.addressFactory.createSipURI(
            toUser, toSipAddress);
        Address toNameAddress = protocolObjects.addressFactory
            .createAddress(toAddress);
        toNameAddress.setDisplayName(toDisplayName);
        ToHeader toHeader = protocolObjects.headerFactory.createToHeader(
            toNameAddress, null);

        // create Request URI
        SipURI requestURI = protocolObjects.addressFactory.createSipURI(
            toUser, peerHostPort);

        // Create ViaHeaders

        ArrayList viaHeaders = new ArrayList();
        int port = provider.getListeningPoint(protocolObjects.transport)
            .getPort();

        ViaHeader viaHeader = protocolObjects.headerFactory
            .createViaHeader(myAddress, port,
                protocolObjects.transport, null);

        // add via headers
        viaHeaders.add(viaHeader);

        // Create ContentTypeHeader
        ContentTypeHeader contentTypeHeader = protocolObjects.headerFactory
            .createContentTypeHeader("application", "sdp");

        // Create a new CallId header
        CallIdHeader callIdHeader = provider.getNewCallId();
        // JvB: Make sure that the implementation matches the messagefactory
        callIdHeader = protocolObjects.headerFactory.createCallIdHeader( callIdHeader.getCallId() );


        // Create a new Cseq header
        CSeqHeader cSeqHeader = protocolObjects.headerFactory
            .createCSeqHeader(1L, Request.INVITE);

        // Create a new MaxForwardsHeader
        MaxForwardsHeader maxForwards = protocolObjects.headerFactory
            .createMaxForwardsHeader(70);

        // Create the request.
        Request request = protocolObjects.messageFactory.createRequest(
            requestURI, Request.INVITE, callIdHeader, cSeqHeader,
            fromHeader, toHeader, viaHeaders, maxForwards);
        // Create contact headers

        // Create the contact name address.
        SipURI contactURI = protocolObjects.addressFactory.createSipURI(
            fromName, myAddress);
        contactURI.setPort(provider.getListeningPoint(
            protocolObjects.transport).getPort());

        Address contactAddress = protocolObjects.addressFactory
            .createAddress(contactURI);

View Full Code Here

        String toSipAddress = "there.com";
        String toDisplayName = "The Little Blister";

        // create >From Header
        SipURI fromAddress = addressFactory.createSipURI(fromName,
            fromSipAddress);

        Address fromNameAddress = addressFactory.createAddress(fromAddress);
        fromNameAddress.setDisplayName(fromDisplayName);
        FromHeader fromHeader = headerFactory.createFromHeader(
            fromNameAddress, "12345");

        // create To Header
        SipURI toAddress = addressFactory
            .createSipURI(toUser, toSipAddress);
        Address toNameAddress = addressFactory.createAddress(toAddress);
        toNameAddress.setDisplayName(toDisplayName);
        ToHeader toHeader = headerFactory.createToHeader(toNameAddress,
            null);

        // create Request URI
        SipURI requestURI = addressFactory.createSipURI(toUser,
            "127.0.0.1:" + Shootme.myPort);

        // Create ViaHeaders

        ArrayList viaHeaders = new ArrayList();
        ViaHeader viaHeader = headerFactory.createViaHeader("127.0.0.1",
            sipProvider.getListeningPoint(transport).getPort(),
            transport, null);

        // add via headers
        viaHeaders.add(viaHeader);

        // Create ContentTypeHeader
        ContentTypeHeader contentTypeHeader = headerFactory
            .createContentTypeHeader("application", "sdp");

        // Create a new CallId header
        CallIdHeader callIdHeader = sipProvider.getNewCallId();
        // JvB: Make sure that the implementation matches the messagefactory
        callIdHeader = headerFactory.createCallIdHeader( callIdHeader.getCallId() );


        // Create a new Cseq header
        CSeqHeader cSeqHeader = headerFactory.createCSeqHeader(1L,
            Request.INVITE);

        // Create a new MaxForwardsHeader
        MaxForwardsHeader maxForwards = headerFactory
            .createMaxForwardsHeader(70);

        // Create the request.
        Request request = messageFactory.createRequest(requestURI,
            Request.INVITE, callIdHeader, cSeqHeader, fromHeader,
            toHeader, viaHeaders, maxForwards);
        // Create contact headers
        String host = "127.0.0.1";

        SipURI contactUrl = addressFactory.createSipURI(fromName, host);
        ListeningPoint lp = sipProvider.getListeningPoint(transport);
        contactUrl.setPort(lp.getPort());

        // Create the contact name address.
        SipURI contactURI = addressFactory.createSipURI(fromName, host);
        contactURI.setPort(sipProvider.getListeningPoint(transport)
            .getPort());

        Address contactAddress = addressFactory.createAddress(contactURI);

        // Add the contact address.
View Full Code Here

        } finally {
            if (sipStack.getStackLogger().isLoggingEnabled()) {
                Iterator it = routeList.iterator();

                while (it.hasNext()) {
                    SipURI sipUri = (SipURI) (((Route) it.next()).getAddress().getURI());
                    if (!sipUri.hasLrParam()) {                    
                      if (sipStack.isLoggingEnabled()) {
                        sipStack.getStackLogger().logWarning(
                                "NON LR route in Route set detected for dialog : " + this);
                          sipStack.getStackLogger().logStackTrace();
                     
View Full Code Here

        try {

            // JvB: Transport from first entry in route set, or remote Contact
            // if none
            // Only used to find correct LP & create correct Via
            SipURI uri4transport = null;

            if (this.routeList != null && !this.routeList.isEmpty()) {
                Route r = (Route) this.routeList.getFirst();
                uri4transport = ((SipURI) r.getAddress().getURI());
            } else { // should be !=null, checked above
                uri4transport = ((SipURI) this.remoteTarget.getURI());
            }

            String transport = uri4transport.getTransportParam();
            if (transport == null) {
                // JvB fix: also support TLS
                transport = uri4transport.isSecure() ? ListeningPoint.TLS : ListeningPoint.UDP;
            }
            ListeningPointImpl lp = (ListeningPointImpl) sipProvider.getListeningPoint(transport);
            if (lp == null) {
              if (sipStack.isLoggingEnabled()) {
                sipStack.getStackLogger().logError(
View Full Code Here

                    // as per draft-ietf-sip-domain-certs-04
                    for (List< ? > altName : subjAltNames) {
                        // 0th position is the alt name type
                        // 1st position is the alt name data
                        if (altName.get(0).equals(uriNameType)) {
                            SipURI altNameUri;
                            try {
                                altNameUri = new AddressFactoryImpl().createSipURI((String) altName.get(1));
                                String altHostName = altNameUri.getHost();
                                if (sipStack.isLoggingEnabled()) {
                                    sipStack.getStackLogger().logDebug(
                                        "found uri " + altName.get(1) + ", hostName " + altHostName);
                                }
                                certIdentities.add(altHostName);
View Full Code Here

    public ContactHeader createContactHeader() {
        try {
            String ipAddress = this.getIPAddress();
            int port = this.getPort();
            SipURI sipURI = new SipUri();
            sipURI.setHost(ipAddress);
            sipURI.setPort(port);
            sipURI.setTransportParam(this.transport);
            Contact contact = new Contact();
            AddressImpl address = new AddressImpl();
            address.setURI(sipURI);
            contact.setAddress(address);
           
View Full Code Here

                String toSipAddress = "there.com";
                String toUser = "LittleGuy";
                String toDisplayName = "The Little Blister";

                // create >From Header
                SipURI fromAddress = protocolObjects.addressFactory.createSipURI(
                        fromName, fromSipAddress);

                Address fromNameAddress = protocolObjects.addressFactory
                        .createAddress(fromAddress);
                fromNameAddress.setDisplayName(fromDisplayName);
                FromHeader fromHeader = protocolObjects.headerFactory
                        .createFromHeader(fromNameAddress, new Integer((int) (Math
                                .random() * Integer.MAX_VALUE)).toString());

                // create To Header
                SipURI toAddress = protocolObjects.addressFactory.createSipURI(
                        toUser, toSipAddress);
                Address toNameAddress = protocolObjects.addressFactory
                        .createAddress(toAddress);
                toNameAddress.setDisplayName(toDisplayName);
                ToHeader toHeader = protocolObjects.headerFactory.createToHeader(
                        toNameAddress, null);

                // create Request URI addressed to me
                SipURI requestURI = protocolObjects.addressFactory.createSipURI(
                        toUser, Shootme.myAddress + ":" + Shootme.myPort);

                // Create ViaHeaders

                ArrayList viaHeaders = new ArrayList();
                int port = provider.getListeningPoint(protocolObjects.transport)
                        .getPort();

                ViaHeader viaHeader = protocolObjects.headerFactory
                        .createViaHeader(myAddress, port,
                                protocolObjects.transport, null);

                // add via headers
                viaHeaders.add(viaHeader);

                // Create ContentTypeHeader
                ContentTypeHeader contentTypeHeader = protocolObjects.headerFactory
                        .createContentTypeHeader("application", "sdp");

                // Create a new CallId header
                CallIdHeader callIdHeader = provider.getNewCallId();
                // JvB: Make sure that the implementation matches the messagefactory
                callIdHeader = protocolObjects.headerFactory.createCallIdHeader(callIdHeader.getCallId());


                // Create a new Cseq header
                CSeqHeader cSeqHeader = protocolObjects.headerFactory
                        .createCSeqHeader(1L, Request.INVITE);

                // Create a new MaxForwardsHeader
                MaxForwardsHeader maxForwards = protocolObjects.headerFactory
                        .createMaxForwardsHeader(70);

                // Create the request.
                Request request = protocolObjects.messageFactory.createRequest(
                        requestURI, Request.INVITE, callIdHeader, cSeqHeader,
                        fromHeader, toHeader, viaHeaders, maxForwards);
                // Create contact headers

                // Create the contact name address.
                SipURI contactURI = protocolObjects.addressFactory.createSipURI(
                        fromName, myAddress);
                contactURI.setPort(provider.getListeningPoint(
                        protocolObjects.transport).getPort());

                Address contactAddress = protocolObjects.addressFactory
                        .createAddress(contactURI);

View Full Code Here

    }

   
    public void testEqual() throws Exception {
        for (int i = 0; i < equal.length; i++) {
            SipURI uri1 = sipUri(equal[i][0]);
            SipURI uri2 = sipUri(equal[i][1]);
            assertTrue(uri1 + " is different than " + uri2, uri1.equals(uri2));
            assertTrue(uri2 + " is different than " + uri1, uri2.equals(uri1));
        }
    }
View Full Code Here

        }
    }

    public void testDifferent() throws Exception {
        for (int i = 0; i < different.length; i++) {
            SipURI uri1 = sipUri(different[i][0]);
            SipURI uri2 = sipUri(different[i][1]);
            assertFalse(uri1 + " is the same as " + uri2, uri1.equals(uri2));
            assertFalse(uri2 + " is the same as " + uri1, uri2.equals(uri1));
        }
    }
View Full Code Here

TOP

Related Classes of javax.sip.address.SipURI

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.