Package com.ericsson.ssa.sip

Examples of com.ericsson.ssa.sip.URIImpl


                SipURIImpl routebackUri = (SipURIImpl) DialogManager.getInstance().getVipSipUri();
                routebackUri.setLrParam(true);
                Address routeBackAddress = SipFactoryImpl.getInstance().createAddress(routebackUri);
                routeBackAddress.setParameter(AR_STATE, new ArInfo(info.getStateInfo(), region).toString());
                String hashKey = request.getBeKeyFromSession();
                URIImpl uriImpl = (URIImpl) routeBackAddress.getURI();
                if(uriImpl != null){
                    uriImpl.encodeBeKey(hashKey);
                }
                request.pushRoute(routeBackAddress);
                pushRoutesReversed(request, routes);
                if (m_logger.isLoggable(Level.FINEST)) {
                    m_logger.log(Level.FINEST, "AR indicated routeback with external routes {0}. Routing externally", new Object[] {routes});
View Full Code Here


                return null;
            }

            if (routeIterator.hasNext()) {
                Address topRoute = routeIterator.next();
                URIImpl uriImpl = (URIImpl) topRoute.getURI();
                if (uriImpl != null) {
                    bekey = uriImpl.decodeBeKey();
                }
               
                if (bekey == null) {
                  return null;
                }
                else {
                    if (logger.isLoggable(Level.FINER)) {
                        logger.log(Level.FINER,
                            "The bekey: " + bekey +
                            " was found in the topmost Route: " + topRoute);
                    }
                  return bekey;
                }
            }
        }

       
        // is there a bekey in request-URI?
        URIImpl uriImpl = (URIImpl) request.getRequestURI();
        if (uriImpl != null) {
            bekey = uriImpl.decodeBeKey();
        }

        if (bekey != null) {
            if (logger.isLoggable(Level.FINER)) {
                    logger.log(Level.FINER,
                        "bekey: " + bekey + " was found in the request-URI");
            }
            return bekey;
        }

        // last resort:
        // is there a bekey in to Header? (may only happen on ACK's)
        if ("ACK".equalsIgnoreCase(request.getMethod())) {
          // (Only) if the request is an ACK there may exist an bekey on the To header
            // Try to extract BEKey To-header
            Address toHeader;
            try {
               
                // Use getAddressHeaderImpl to retrieve the AddressImpl.
                // getAddressHeader returns a wrapper around the Address.               
                SipServletRequestImpl requestImpl = (SipServletRequestImpl) request;

                toHeader = requestImpl.getAddressHeaderImpl(Header.TO);
            } catch (ServletParseException e) {
                if (logger.isLoggable(Level.FINE)) {
                    logger.log(Level.FINE, "Exception when extracting the To-header", e);
                }
               
                toHeader = null;
            }
           
            if (toHeader != null) {
                URIImpl toUriImpl = (URIImpl) toHeader.getURI();
                if (toUriImpl != null) {
                    bekey = toUriImpl.decodeBeKey();
                }
        if (bekey != null) {
          if (logger.isLoggable(Level.FINER)) {
            logger.log(Level.FINER, "bekey: " + bekey
                + " was found in the To-header");
View Full Code Here

                    if (addressValue != null) {
                        // Fetch current read-only status
                        boolean readOnly = addressValue.isReadOnly();
                        // Allow writes on Address object
                        addressValue.setReadOnly(false);
                        URIImpl uriImpl = (URIImpl) addressValue.getURI();
                        if(uriImpl != null){
                            uriImpl.encodeBeKey(hashkey);
                        }
                        // Reset read-only status
                        addressValue.setReadOnly(readOnly);
                    }
                } catch (ServletParseException e) {
                    throw new SipRoutingException("Malformed Contact", e);
                }
            }

            replaceTopVia(request, via);

            if (logger.isLoggable(Level.FINER)) {
                logger.log(Level.FINER,
                        "The request originates from this instance, altered request: " + request);
            }

            return null;
        } else if (request.isRecordRouteIndicated()) {
            // This request was proxied, save ID of incoming connection.
            String encodedConnection;
            if ((encodedConnection=getEncondedConnection(request)) == null) {
                throw new SipRoutingException("Could not find connection information in a proxied request, shall never happen!");
            } else {
                via.setParameter(CLBConstants.CONNID_PARAM, encodedConnection);
            }


            Header rrHeader = request.getRawHeader(Header.RECORD_ROUTE);
            AddressImpl rrAddr;
            try {
                rrAddr = (AddressImpl) rrHeader.getAddressValue();
            } catch (ServletParseException e) {
                throw new SipRoutingException("Malformed record-Route", e);
            }

            // The R-R was added by the application, thus we shall set 'bekey'
            // Fetch current read-only status
            boolean readOnly = rrAddr.isReadOnly();
            // Allow writes on Address object
            rrAddr.setReadOnly(false);
            URIImpl uriImpl = (URIImpl) rrAddr.getURI();
            if (uriImpl != null) {
                uriImpl.encodeBeKey(hashkey);
            }
            // Reset read-only status
            rrAddr.setReadOnly(readOnly);

            replaceTopVia(request, via);
View Full Code Here

                        contactAddress = (AddressImpl) (contactHeader.getAddressValue());
                    } catch (ServletParseException e) {
                        throw new SipRoutingException("Malformed Contact", e);
                    }

                    URIImpl contactUri = ((URIImpl) contactAddress.getURI());

                    contactAddress = ((AddressImpl) contactAddress.clone(true, true));
                    contactUri = (URIImpl) contactUri.clone();
                    contactUri.encodeBeKey(hashkey);
                    // Allow writes on cloned Address object
                    contactAddress.setReadOnly(false);
                    contactAddress.setURI(contactUri);
                    contactHeader.setReadOnly(false);
                    contactHeader.removeValues();
                    contactHeader.setValue(contactAddress.toString(), true);
                    contactHeader.setReadOnly(true);
                }
            } else if (response.getMethod().equalsIgnoreCase("INVITE") && response.getStatus() >= 300){
                // This is a non-2xx response to an INVITE, set bekey in the To-header
                Header toHeader = response.getRawHeader(Header.TO);

                if (toHeader != null) {
                    AddressImpl toAddress;

                    try {
                        toAddress = (AddressImpl) (toHeader.getAddressValue());
                    } catch (ServletParseException e) {
                        throw new SipRoutingException("Malformed To-header", e);
                    }

                    URIImpl toUri = ((URIImpl) toAddress.getURI());

                    toAddress = ((AddressImpl) toAddress.clone(true, true));
                    toUri = (URIImpl) toUri.clone();
                    toUri.encodeBeKey(hashkey);
                    // Allow writes on cloned Address object
                    toAddress.setReadOnly(false);
                    toAddress.setURI(toUri);
                    toHeader.setReadOnly(false);
                    toHeader.removeValues();
View Full Code Here

                return;
            }

            Address a = it_a.next();
            URIImpl uri = (URIImpl) a.getURI();

            // Session Case handling
            // TODO move constants
            final String CALL_PARAM = "call";
            final String CALL_PARAM_ORIG = "orig";
            final String CALL_PARAM_TERMINATING = "term_registered";
            final String CALL_PARAM_TERMINATING_UNREG = "term_unregistered";

            String callParam = uri.getParameter(CALL_PARAM);

            // if(callParam == null) callParam = uri.getParameter(CALL_PARAM);
            if (callParam == null) {
                req.setSessionCase(SessionCase.EXTERNAL);
            } else {
                if (callParam.equals(CALL_PARAM_ORIG)) {
                    req.setSessionCase(SessionCase.ORIGINATING);
                } else if (callParam.equals(CALL_PARAM_TERMINATING)) {
                    req.setSessionCase(SessionCase.TERMINATING);
                } else if (callParam.equals(CALL_PARAM_TERMINATING_UNREG)) {
                    req.setSessionCase(SessionCase.TERMINATING_UNREGISTERED);
                } else {
                    req.setSessionCase(SessionCase.EXTERNAL);
                    logger.log(Level.WARNING,
                        "Assigned SessionCase external due to unknown value of " +
                        CALL_PARAM + " :" + callParam);
                }
            }

            // end Session Case handling
            if (uri.getLrParam()) {
                // Before removing the Route header extract the fragment-id.
                // This code needs BASIC TESTING in an extended
                // spiraling scenario, such as
                //
                // UAC/EAS --> proxy/external --> proxy/EAS --> UAS/external
View Full Code Here

TOP

Related Classes of com.ericsson.ssa.sip.URIImpl

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.