Package javax.sip.address

Examples of javax.sip.address.SipURI


        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.getRemoteTarget().getURI());
            }

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


            String fromName = "Referee";
            String fromSipAddress = "here.com";
            String fromDisplayName = "The Master Blaster";

            // 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
            ToHeader toHeader = headerFactory.createToHeader( to.getAddress(),
                    null);

            // get Request URI
            SipURI requestURI = (SipURI) to.getAddress().getURI();

            ListeningPoint lp = mySipProvider.getListeningPoint(transport);

            // Create ViaHeaders

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

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

            // Create a new CallId header
            CallIdHeader callIdHeader = mySipProvider.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. (TODO should read request type from Refer-To)
            Request request = messageFactory.createRequest(requestURI,
                    Request.INVITE, callIdHeader, cSeqHeader, fromHeader,
                    toHeader, viaHeaders, maxForwards);
            // Create contact headers
            String host = lp.getIPAddress();

            SipURI contactURI = addressFactory.createSipURI(fromName, host);
            contactURI.setPort(lp.getPort());
            contactURI.setTransportParam( transport );

            Address contactAddress = addressFactory.createAddress(contactURI);

            // Add the contact address.
            contactAddress.setDisplayName(fromName);
View Full Code Here

            /* Resolve this to the next hop based on the previous lookup. If we are not using
             * lose routing (RFC2543) then just attach hop as a maddr param.
             */
            if ( challengedRequest.getRouteHeaders() == null ) {
                Hop hop   = ((SIPClientTransaction) challengedTransaction).getNextHop();
                SipURI sipUri = (SipURI) reoriginatedRequest.getRequestURI();
                sipUri.setMAddrParam(hop.getHost());
                if ( hop.getPort() != -1 ) sipUri.setPort(hop.getPort());
            }
            ClientTransaction retryTran = transactionCreator
            .getNewClientTransaction(reoriginatedRequest);

            WWWAuthenticateHeader authHeader = null;
            SipURI requestUri = (SipURI) challengedTransaction.getRequest().getRequestURI();
            while (authHeaders.hasNext()) {
                authHeader = (WWWAuthenticateHeader) authHeaders.next();
                String realm = authHeader.getRealm();
                AuthorizationHeader authorization = null;
                String sipDomain;
View Full Code Here

    Request request = null;
    countId += 1;//increase it for new hash
    //Invite
    try
      // create From Header
      SipURI fromAddress = addressFactory.createSipURI(from, "send.com");
      Address fromNameAddress = addressFactory.createAddress(fromAddress);
      fromNameAddress.setDisplayName(from);
      FromHeader fromHeader = headerFactory.createFromHeader(fromNameAddress,"12345");

      // create To Header
      SipURI toAddress = addressFactory.createSipURI(to, "empf.com");
      Address toNameAddress = addressFactory.createAddress(toAddress);
      toNameAddress.setDisplayName(to);
      ToHeader toHeader = headerFactory.createToHeader(toNameAddress, null);

      // create Request URI
      SipURI requestURI = addressFactory.createSipURI(from, "127.0.0.1:5070");

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

      // Create a new CallId header
      CallIdHeader callIdHeader = callId;
      //callIdHeader.setCallId("1");
      // Create a new Cseq header
      CSeqHeader cSeqHeader = headerFactory.createCSeqHeader(countId, Request.INVITE);

      // Create a new MaxForwardsHeader
      MaxForwardsHeader maxForwards = headerFactory.createMaxForwardsHeader(70);
      // Create the 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(from, host);
      contactUrl.setPort(listeningPoint.getPort());

      // Create the contact name address.
      SipURI contactURI = addressFactory.createSipURI(from, host);
      contactURI.setPort(sipProvider.getListeningPoint(transport).getPort());
      contactURI.setTransportParam(transport);
      Address contactAddress = addressFactory.createAddress(contactURI);

      // Add the contact address.
      contactAddress.setDisplayName(from);
      contactHeader = headerFactory.createContactHeader(contactAddress);
View Full Code Here

    Request request = null;
    id += 1;//0 not allowed
    //Invite
    try
      // create From Header
      SipURI fromAddress = addressFactory.createSipURI(from, "send.com");
      Address fromNameAddress = addressFactory.createAddress(fromAddress);
      fromNameAddress.setDisplayName(from);
      FromHeader fromHeader = headerFactory.createFromHeader(fromNameAddress,"12345");

      // create To Header
      SipURI toAddress = addressFactory.createSipURI(to, "empf.com");
      Address toNameAddress = addressFactory.createAddress(toAddress);
      toNameAddress.setDisplayName(to);
      ToHeader toHeader = headerFactory.createToHeader(toNameAddress, null);

      // create Request URI
      SipURI requestURI = addressFactory.createSipURI(from, "127.0.0.1:5080");

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

      // Create a new CallId header
      CallIdHeader callIdHeader = sipProvider.getNewCallId();
      //callIdHeader.setCallId("1");
      // Create a new Cseq header
      CSeqHeader cSeqHeader = headerFactory.createCSeqHeader(id, Request.INVITE);

      // Create a new MaxForwardsHeader
      MaxForwardsHeader maxForwards = headerFactory.createMaxForwardsHeader(70);
      // Create the 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(from, host);
      contactUrl.setPort(listeningPoint.getPort());

      // Create the contact name address.
      SipURI contactURI = addressFactory.createSipURI(from, host);
      contactURI.setPort(sipProvider.getListeningPoint(transport).getPort());
      contactURI.setTransportParam(transport);
      Address contactAddress = addressFactory.createAddress(contactURI);

      // Add the contact address.
      contactAddress.setDisplayName(from);
      contactHeader = headerFactory.createContactHeader(contactAddress);
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.getRemoteTarget().getURI());
            }

            String transport = uri4transport.getTransportParam();
            ListeningPointImpl lp;
            if (transport != null) {
                lp = (ListeningPointImpl) sipProvider
                        .getListeningPoint(transport);
            } else {
                if (uri4transport.isSecure()) { // JvB fix: also support TLS
                    lp = (ListeningPointImpl) sipProvider
                            .getListeningPoint(ListeningPoint.TLS);
                } else {
                    lp = (ListeningPointImpl) sipProvider
                            .getListeningPoint(ListeningPoint.UDP);
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(LogWriter.TRACE_DEBUG)) {
                                    sipStack.getStackLogger().logDebug(
                                        "found uri " + altName.get(1) + ", hostName " + altHostName);
                                }
                                certIdentities.add(altHostName);
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, "12345");

            // 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
            String peerHostPort = peerHost + ":" + peerPort;
            SipURI requestURI = protocolObjects.addressFactory.createSipURI(toUser, peerHostPort);

            // Create ViaHeaders

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

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

            SipURI sipuri = protocolObjects.addressFactory.createSipURI(null, host);
            sipuri.setPort(peerPort);
            sipuri.setLrParam();

            RouteHeader routeHeader = protocolObjects.headerFactory
                    .createRouteHeader(protocolObjects.addressFactory.createAddress(sipuri));

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

            // Create a new CallId header
            CallIdHeader callIdHeader = sipProvider.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

            SipURI contactUrl = protocolObjects.addressFactory.createSipURI(fromName, host);
            contactUrl.setPort(listeningPoint.getPort());

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

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

            // Add the contact address.
            contactAddress.setDisplayName(fromName);
View Full Code Here

                ServerTransaction st = null;
                if (requestEvent.getServerTransaction() == null) {
                    st = sipProvider.getNewServerTransaction(request);

                    Request newRequest = (Request) request.clone();
                    SipURI sipUri = protocolObjects.addressFactory.createSipURI("UA1",
                            "127.0.0.1");
                    sipUri.setPort(5080);
                    sipUri.setLrParam();
                    Address address = protocolObjects.addressFactory.createAddress("client1",
                            sipUri);
                    RouteHeader rheader = protocolObjects.headerFactory
                            .createRouteHeader(address);

                    newRequest.addFirst(rheader);
                    ViaHeader viaHeader = protocolObjects.headerFactory.createViaHeader(host,
                            port, protocolObjects.transport, null);
                    newRequest.addFirst(viaHeader);
                    ClientTransaction ct1 = sipProvider.getNewClientTransaction(newRequest);
                    sipUri = protocolObjects.addressFactory.createSipURI("proxy", "127.0.0.1");
                    address = protocolObjects.addressFactory.createAddress("proxy", sipUri);
                    sipUri.setPort(5080);
                    sipUri.setLrParam();
                    RecordRouteHeader recordRoute = protocolObjects.headerFactory
                            .createRecordRouteHeader(address);
                    newRequest.addHeader(recordRoute);
                    ct1.setApplicationData(st);
                    this.clientTxTable.add(ct1);

                    newRequest = (Request) request.clone();
                    sipUri = protocolObjects.addressFactory.createSipURI("UA2", "127.0.0.1");
                    sipUri.setLrParam();
                    sipUri.setPort(5080);
                    address = protocolObjects.addressFactory.createAddress("client2", sipUri);
                    rheader = protocolObjects.headerFactory.createRouteHeader(address);
                    newRequest.addFirst(rheader);
                    viaHeader = protocolObjects.headerFactory.createViaHeader(host, port,
                            protocolObjects.transport, null);
                    newRequest.addFirst(viaHeader);
                    sipUri = protocolObjects.addressFactory.createSipURI("proxy", "127.0.0.1");
                    sipUri.setPort(5080);
                    sipUri.setLrParam();
                    sipUri.setTransportParam(protocolObjects.transport);
                    address = protocolObjects.addressFactory.createAddress("proxy", sipUri);

                    recordRoute = protocolObjects.headerFactory.createRecordRouteHeader(address);

                    newRequest.addHeader(recordRoute);
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.