Package javax.servlet.sip

Examples of javax.servlet.sip.Address


                errorResponse.popDispatcher().dispatch(errorResponse);
            }
            return;
        }
        if(routeIterator != null && routeIterator.hasNext()){
            Address topRoute = routeIterator.next();
            String feParam = topRoute.getURI().getParameter(CLBConstants.FE_LB_PARAM);
            if(feParam != null){
                //remove topmost route
                boolean readOnly = routeHeader.isReadOnly();
                routeHeader.setReadOnly(false);
                routeIterator.remove();
View Full Code Here


       
        // If routing directive is NEW, we should treat this as a new request
        // i.e. reset the Application Router state.
        if (SipApplicationRoutingDirective.NEW.equals(
            request.getRoutingDirective())){
            Address initialPoppedRoute = request.getInitialPoppedRoute();
            if (initialPoppedRoute != null && initialPoppedRoute.getParameter(AR_STATE) != null) {
               try {
                       ApplicationRouterSelector.getInstance().setRouterContext();
                       ArInfo restoredArInfo = ArInfo.fromString(initialPoppedRoute.getParameter(AR_STATE));
                       newStateInfo = restoredArInfo.getStateInfo();
                       region = restoredArInfo.getRegion();
                       request.setInternalRoutingDirective(SipApplicationRoutingDirective.CONTINUE, null);
               } finally {
                       ApplicationRouterSelector.getInstance().resetRouterContext();
View Full Code Here

        request.setRemoteHop(remoteHop);
    }

    private boolean popTopRoute(SipServletRequestImpl request) {
        if (request.isLocalRoute()) {
            Address popped = request.popRouteHeader();
            request.setPoppedRoute(popped);
            if (popped != null) {
                return true;
            }
        } else
View Full Code Here

                    return true;
                } else if (isInternal(routes[0])) {
                    // internal route indicated. Push this
                    // TODO or setInitialPoppedRoute???
                   
                    Address popRoute = SipFactoryImpl.getInstance().createAddress(routes[0]);
                    request.setPoppedRoute(popRoute);
                    if (m_logger.isLoggable(Level.FINEST)) {
                        m_logger.log(Level.FINEST, "AR returned internal route {0}. Setting popped route. Continuing.", new Object[] {popRoute});
                    }
                    return false;
                } else {
                    // External routes indicated; push in reversed order
                    pushRoutesReversed(request,routes);
                    if (m_logger.isLoggable(Level.FINEST)) {
                        m_logger.log(Level.FINEST, "AR returned external routes {0}. Routing externally", new Object[] {routes});
                    }
                    return true;
                }
            case ROUTE_BACK:
                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);
View Full Code Here

    }

    private boolean isValidContact(Header header) {
        // Verify the address spec is correct.
        try {
            Address adr = header.getAddressValue();
            adr.toString();
        } catch (ServletParseException e) {
            return false;
        }

        return true;
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)) {
View Full Code Here

                       
        if (df != null && matchTag(df.getFrom(), this.getDelegate())) {       
          df.setFrom(this.getDelegate());         
        }       
       
        Address to = session.getPFieldTo();
        if (matchTag(to, this.getDelegate())) {
          session.setPFieldTo(this.getDelegate());
        }       
      }
    }
View Full Code Here

    public Address createAddress(URI uri) {
        return new AddressImpl(uri);
    }

    public Address createAddress(URI uri, String displayName) {
        Address result = new AddressImpl(uri);
        result.setDisplayName(displayName);

        return result;
    }
View Full Code Here

    public SipServletRequestImpl createRequestImpl(
        SipApplicationSessionImpl appSession, String method, Address from,
        Address to, boolean sameCallID, SipServletRequestImpl origRequest) {
        if (!method.equals("ACK") && !method.equals("CANCEL")) {
            Address fromCopy = (Address) from.clone();
            Address toCopy = (Address) to.clone();

            // Remove protection, lock up
            ((AddressImpl) fromCopy).setReadOnly(false);
            ((AddressImpl) toCopy).setReadOnly(false);
            fromCopy.setParameter(AddressImpl.TAG_PARAM, createTag());
            toCopy.removeParameter(AddressImpl.TAG_PARAM);


            SipServletRequestImpl req = null;
            String defaultHandler = null;

            if (origRequest == null) {
                URI requestURI = (URI) toCopy.getURI().clone();
                if ("REGISTER".equals(method) && requestURI.isSipURI()) {
                    ((SipURI)requestURI).setUser(null);
                }
                req = new SipServletRequestImpl(method, requestURI,
                        SipFactoryImpl.PROTOCOL_LINE);
               req.setInternalRoutingDirective(
                        SipApplicationRoutingDirective.NEW, null);
               req.setBeKey(appSession.getBeKey());
            } else {
                req = (SipServletRequestImpl) origRequest.clone();
                req.setInternalRoutingDirective(
                        SipApplicationRoutingDirective.CONTINUE, origRequest);
                // copy region in case of CONTINUE as well
                req.setRegion(origRequest.getRegion());
                req.clearApplicationDispatchers();
                // The clone will copy the session-case. For the new request
                // the session-case should be internal.
                req.setSessionCase(SessionCase.INTERNAL);
                req.removeSystemHeaders();
                req.removeRemoteSettings();
                defaultHandler = origRequest.getSessionImpl().getHandler();
            }

            // set CallID
            Header callIDHeader = new SingleLineHeader(Header.CALL_ID, true);

            if ((origRequest == null) || !sameCallID) {
                callIDHeader.setValue(createCallID(), false);
            } else {
                callIDHeader.setValue(origRequest.getCallId(), false);
            }

            req.setHeader(callIDHeader);

            URI fromURI = cleanupFromOrToURI(fromCopy.getURI().clone());
            fromCopy.setURI(fromURI);
            URI toURI = cleanupFromOrToURI(toCopy.getURI().clone());
            toCopy.setURI(toURI);

            // Put protection, lock again
            ((AddressImpl) fromCopy).setReadOnly(true);
            ((AddressImpl) toCopy).setReadOnly(true);
        
View Full Code Here

        return false;
    }
   
    private byte[] createDigestData(SipServletMessage message, MessageDigest md, boolean toCreate) throws MessagingException, IOException, ServletParseException {

        Address from = message.getFrom();
        Address to = message.getTo();
        String callId = message.getCallId();
        String cseq = getCSeq(message);
        String date = message.getHeader(DATE_HEADER);
        Address ahContact = message.getAddressHeader(CONTACT_HEADER);
        String contact = null;
        if (ahContact != null) {
            contact = ahContact.getURI().toString();
        }
        if (date == null || date.length() == 0) {
            if (toCreate) {
                date = addDate(message);
            } else {
View Full Code Here

TOP

Related Classes of javax.servlet.sip.Address

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.