Package com.ericsson.ssa.sip

Examples of com.ericsson.ssa.sip.SipServletRequestImpl


            throws SipRoutingException {
        if (!reuseConnections) {
            return;
        }

        SipServletRequestImpl request = response.getRequestImpl();
        if (request == null) {
            if (logger.isLoggable(Level.FINER)) {
                logger.finer("There is no request associated with response");
            }
            return;
        }

        if (!request.getRemote().getProtocol().equals(SipTransports.TCP_PROT)) {
            if (logger.isLoggable(Level.FINER)) {
                logger.finer("Protocol used in not TCP");
            }
            return;
        }

        String method = request.getMethod();
        SipSession session = null;
        boolean isRegisterMethod = false;
        if (method.equals("REGISTER")) {
            isRegisterMethod = true;
        } else {
            //only consider dialog creating requests
            if (SipFactoryImpl.isDialogCreational(method)) {
                //Create mapping only if sip session exists
                session = request.getSession(false);
                if (session == null || !session.isValid()) {
                    if (logger.isLoggable(Level.FINER)) {
                        logger.finer("Session is null or invalid");
                    }
                    return;
                }
            }
        }

        Address contactAddress = null;
        try {
            contactAddress = request.getAddressHeader(Header.CONTACT);
        } catch (ServletParseException ex) {
            throw new SipRoutingException("Unable to get Contact header", ex);
        }

        if (isRegisterMethod && contactAddress.getExpires() == 0) {
            return;
        }

        String contact = null;
        if (contactAddress.getURI().isSipURI()) {
            contact = createContact((SipURI) contactAddress.getURI());
        } else {
            if (logger.isLoggable(Level.FINER)) {
                logger.finer("Contact address is not sip uri");
            }
            return;
        }
       
        Header viaHeader = request.getRawHeader(Header.VIA);
        ListIterator<String> viaHeaderIter = viaHeader.getValues();
        ViaImpl firstViaHeader = new ViaImpl(viaHeaderIter.next());
        String felbParam =
                firstViaHeader.getParameter(CLBConstants.FE_LB_PARAM);
        //Request is not proxied, there will be no Path header added by FE
        if (felbParam == null) {
            if (logger.isLoggable(Level.FINER)) {
                logger.finer("felb param is null");
            }
            return;
        }

        Address feAddress = createSipAddress(
                firstViaHeader.getHost(), firstViaHeader.getPort());

        int statusCode = response.getStatus();
        if ( statusCode >= 200 && statusCode < 300) {
            if (isRegisterMethod) {
                String expires = request.getHeader(Header.EXPIRES);
                if(expires == null) {
                    return;
               
                }
                storeFEAddrForRegisterReq(contact, feAddress,
View Full Code Here


        if (logger.isLoggable(Level.FINER)) {
            logger.log(Level.FINER,
                "Handle incoming request");
        }

        SipServletRequestImpl request = (SipServletRequestImpl) req.getSipRequest();
       
        if(clbMonitoringManager.isCLBMonitoringEnabled()){
            clbMonitoringManager.getCLBStatsUpdater().
                    incrementTotalIncomingSipRequestsFE();
        }
       
        ServerInstance serverInstance = router.selectInstance(req);
        if (serverInstance == null) {
            throw new SipRoutingException("Could not find a server");
        }

        String hashkey = req.getHashKey();

        request.setBeKey(hashkey);

        if (logger.isLoggable(Level.FINER)) {
            logger.log(Level.FINER,
                "Hash key: " + hashkey + "; server: " +
                serverInstance.getName()+"; isLocal: "+serverInstance.isLocalInstance());
View Full Code Here

     *
     * @param request The request object from which to obtain access log info
     */
    public void logRequestEntry(String header, SipServletRequest sreq) {
        String logString = null;
        SipServletRequestImpl request = (SipServletRequestImpl) sreq;
        CharBuffer charBuffer = CharBuffer.allocate(MIN_BUFFER_SIZE);
        for (int i=0; i<patternComponents.size(); i++) {
            String pc = patternComponents.get(i);
            if (CLIENT_NAME.equals(pc)) {
                appendClientName(charBuffer, request.getRemoteUser());
            } else if (AUTH_USER_NAME.equals(pc)) {
                appendAuthUserName(charBuffer, request.getRemoteHost());
            } else if (DATE_TIME.equals(pc)) {
                appendCurrentDate(charBuffer);      
            } else if (REQUEST.equals(pc)) {
                appendRequestInfo(charBuffer, request);
            } else if (RESPONSE_LENGTH.equals(pc)) {
                appendResponseLength(charBuffer, request.getContentLength());
            } else if (VIA.equals(pc)) {
                Header via = request.getRawHeader(Header.VIA);
                appendVia(charBuffer, via);
            } else if (CALL_ID.equals(pc)) {
                Header callId = request.getRawHeader(Header.CALL_ID);
                appendString(charBuffer, callId);
            } else if (TO.equals(pc)) {
                Header to = request.getRawHeader(Header.TO);
                appendString(charBuffer, to);
            } else if (FROM.equals(pc)) {
                Header from = request.getRawHeader(Header.FROM);
                appendString(charBuffer, from);
            } else if (CSEQ.equals(pc)) {
                Header cseq = request.getRawHeader(Header.CSEQ);
                appendString(charBuffer, cseq);
            } else if (MAX_FORWARDS.equals(pc)) {
                Header maxForwards = request.getRawHeader(Header.MAX_FORWARDS);
                appendString(charBuffer, maxForwards);
            } else if (CONTACT.equals(pc)) {
                Header contact = request.getRawHeader(Header.CONTACT);
                appendString(charBuffer, contact);
            } else if (CONTENT_TYPE.equals(pc)) {
                Header contentType = request.getRawHeader(Header.CONTENT_TYPE);
                appendString(charBuffer, contentType);
            }
            charBuffer.put(SPACE);
        }
        charBuffer.put("\n");
View Full Code Here

            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);
                }
               
View Full Code Here

            LayerHelper.next(req, this, _nextLayer);
        } else {
            req.pushTransactionDispatcher(this);
            req.pushApplicationDispatcher(this);

            final SipServletRequestImpl r = req;
            final Layer l = this;
            _threadPool.execute(new Runnable() {
                    public void run() {
                        try {
                            LayerHelper.next(r, l, _nextLayer);
View Full Code Here

    public Parameterable createParameterable(String s) throws ServletParseException {
        return m_ConcreteSipFactory.createParameterable(s);
    }

    public SipServletRequest createRequest(SipApplicationSession appSession, String method, Address from, Address to) {
        SipServletRequestImpl request = m_ConcreteSipFactory.createRequest(appSession, method, from, to);
        postCreateRequest(request);

        return request;
    }
View Full Code Here

        return request;
    }

    public SipServletRequest createRequest(SipApplicationSession appSession, String method, URI from, URI to) {
        SipServletRequestImpl request = m_ConcreteSipFactory.createRequest(appSession, method, from, to);
        postCreateRequest(request);

        return request;
    }
View Full Code Here

        return request;
    }

    public SipServletRequest createRequest(SipApplicationSession appSession, String method, String from, String to) throws ServletParseException {
        SipServletRequestImpl request = m_ConcreteSipFactory.createRequest(appSession, method, from, to);
        postCreateRequest(request);

        return request;
    }
View Full Code Here

        return request;
    }

    @Deprecated
    public SipServletRequest createRequest(SipServletRequest origRequest, boolean sameCallId) {
        SipServletRequestImpl request = m_ConcreteSipFactory.createRequest(origRequest, sameCallId);
        postCreateRequest(request);

        return request;
    }
View Full Code Here

        return as;
    }

    public SipServletRequestImpl createRequestImpl(SipApplicationSessionImpl appSession, String method, Address from, Address to, boolean sameCallID, SipServletRequestImpl origRequest) {
        SipServletRequestImpl request = m_ConcreteSipFactory.createRequestImpl(appSession, method, from, to, sameCallID, origRequest);
        postCreateRequest(request);

        return request;
    }
View Full Code Here

TOP

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

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.