Package javax.servlet.sip

Examples of javax.servlet.sip.SipURI


        if ("INVITE".equals(_method) || "REFER".equals(_method) ||
                "SUBSCRIBE".equals(_method)) {
            try {
                // Check if Response has Record-Route headers
                Address rrouteAddress = getAddressHeaderImpl(Header.RECORD_ROUTE);
                SipURI sipuri = null;

                if ((rrouteAddress != null) &&
                        rrouteAddress.getURI().isSipURI()) {
                    // 1. Use transport from top-most Record Route on the incoming Request
                    sipuri = (SipURI) rrouteAddress.getURI();
                } else {
                    // 2. Use transport from Contact
                    URI remoteTarget = getAddressHeaderImpl("Contact").getURI();

                    if (remoteTarget.isSipURI()) {
                        sipuri = (SipURI) remoteTarget;
                    }
                }

                if ((sipuri != null) && (sipuri.getTransportParam() != null)) {
                    String transport = sipuri.getTransportParam();
                    Address contactAddress = response.getAddressHeaderImpl(Header.CONTACT);

                    if ((contactAddress != null) &&
                            contactAddress.getURI().isSipURI()) {
                        ((SipURI) contactAddress.getURI()).setTransportParam(transport);
View Full Code Here


            AddressImpl contactAddress = (AddressImpl) contactHeader.getAddressValue();
            if (contactAddress != null &&
                    contactAddress.getURI() != null &&
                    contactAddress.getURI().isSipURI())
            {
                SipURI contactUri = (SipURI) contactAddress.getURI();

                contactUri.setPort(secure
                        ? dialogManager.getVipSipsUri().getPort()
                        : dialogManager.getVipSipUri().getPort());

                if (useSipsContact())
                {
                    // Use SIPS URI scheme
                    contactUri.setSecure(true);
                }
                else
                {
                    // Use SIP URI scheme
                    contactUri.setSecure(false);

                    if (secure)
                    {
                        contactUri.setTransportParam("tls");
                    }
                }
            }
        }
    }
View Full Code Here

     */
    private boolean isUriSecure(URI uri)
    {
        if (uri.isSipURI())
        {
            SipURI sipUri = (SipURI) uri;
            if (sipUri.isSecure() || (sipUri.getTransportParam() != null &&
                    sipUri.getTransportParam().equalsIgnoreCase("tls")))
            {
                return true;
            }
        }

View Full Code Here

     */
    private boolean isUriUsingSips(URI uri)
    {
        if (uri.isSipURI())
        {
            SipURI sipUri = (SipURI) uri;
            return sipUri.isSecure();
        }

        return false;
    }
View Full Code Here

    public boolean equals(Object o) {
        if (!(o instanceof SipURI)) {
            return false;
        }

        SipURI uri = (SipURI) o;

        if (_port != uri.getPort()) {
            return false;
        }

        if (_secure != uri.isSecure()) {
            return false;
        }

        if (((_user == null) && (uri.getUser() != null)) ||
                ((_user != null) && (uri.getUser() == null))) {
            return false;
        }

        if ((_user != null) && !getUser().equals(uri.getUser())) {
            return false;
        }

        if (((_password == null) && (uri.getUserPassword() != null)) ||
                ((_password != null) && (uri.getUserPassword() == null))) {
            return false;
        }

        if ((_password != null) &&
                !getUserPassword().equals(uri.getUserPassword())) {
            return false;
        }

        if (  ( (getHost() == null) && (uri.getHost() != null) ) ||
              ( (uri.getHost() == null) &&  (this.getHost() == null))   ) {
            return false;
        }
       
        if (getHost() != null && uri.getHost() != null && !getHost().equalsIgnoreCase(uri.getHost()) ) {
            return false;
        }

        // Compare headers
        HashMap<String,String> thisHeaders = new HashMap<String,String>();
        Iterator<String> thisHeaderIterator = getHeaderNames();
        while (thisHeaderIterator.hasNext()) {
            String key = (String) thisHeaderIterator.next();
            thisHeaders.put(key,this.getHeader(key));
        }
       
        HashMap<String,String> uriHeaders = new HashMap<String,String>();
        Iterator<String> uriHeaderIterator = uri.getHeaderNames();
        while (uriHeaderIterator.hasNext()) {
            String key = (String) uriHeaderIterator.next();
            uriHeaders.put(key, uri.getHeader(key));
        }
       
        if ( !thisHeaders.equals(uriHeaders) ) {
            return false;
        }
       
        // Compare parameters
        Map<String,String> thisParameters = new HashMap<String,String>(8);
        Iterator<String> thisParameterIterator = getParameterNames();
        while (thisParameterIterator.hasNext()) {
            String key = (String) thisParameterIterator.next();
            //adding keys lowercase and values as normal
            thisParameters.put(key.toLowerCase(), this.getParameter(key));
        }
       
        Map<String,String> uriParameters = new HashMap<String,String>(8);
        Iterator<String> uriParameterIterator = uri.getParameterNames();
        while (uriParameterIterator.hasNext()) {
            String key = (String) uriParameterIterator.next();
            //adding keys lowercase and values as normal
            uriParameters.put(key.toLowerCase(), uri.getParameter(key));
        }
       
        if (compareParameters(thisParameters, uriParameters)) {
            //swap and compare from the other collection point of view, since after iteration the second collection may contains special parameters, such as TTL
            return compareParameters(uriParameters, thisParameters);
View Full Code Here

        if (!this.isWildcard()) {
            URI uri = this.getURI();

            // Check if the URI contains one of the listeners.
            if (uri.isSipURI()) {
                SipURI sipUri = (SipURI) uri;
                String host = sipUri.getHost();
                int port = sipUri.getPort();
                for (String publiccontext : SipBindingResolver.instance().
                        getPublicContexts()) {
                    SipBindingCtx sipBindingCtx = SipBindingResolver.instance().
                            getPublicContext(publiccontext);
                    found = isAddressPresent(sipBindingCtx, host, port);
View Full Code Here

        if (!this.isWildcard()) {
            URI uri = this.getURI();

            // Check if the URI contains localhost or 127.0.0.1
            if (uri.isSipURI()) {
                SipURI sipUri = (SipURI) uri;
                String host = sipUri.getHost();

                if (host.equalsIgnoreCase(LOCALHOST) ||
                        host.equals(LOCALIP)) {
                    // Fetch port from request (use 5060 if port is missing)
                    int port = sipUri.getPort();

                    if (port != -1) {
                        // Fetch valid ports
                        SipBindingCtx sipBindingCtx = SipBindingResolver.instance()
                        .getActiveExternalContext();
View Full Code Here

TOP

Related Classes of javax.servlet.sip.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.