Package com.ericsson.ssa.sip

Examples of com.ericsson.ssa.sip.SipServletRequestImpl


                return request.getHeader(elements[1]);
            }

            // Use getAddressHeaderImpl to retrieve the AddressImpl.
            // getAddressHeader returns a wrapper around the Address.
            SipServletRequestImpl requestImpl = (SipServletRequestImpl) request;

            // request.<header>.uri
            if ((elements.length > 2) && "uri".equals(elements[2])) {
                try {
                    URI canonicalizedHeaderUri = dcrUtils.canonicalize(requestImpl.getAddressHeaderImpl(
                                elements[1]).getURI());

                    // check if the mapping ends with uri
                    if ((elements.length < 4) && "uri".equals(elements[2])) {
                        return (canonicalizedHeaderUri != null)
                        ? dcrUtils.normalize(canonicalizedHeaderUri).toString()
                        : null;
                    }

                    // Handle request.<header>.uri.scheme
                    if ("scheme".equals(elements[3])) {
                        return canonicalizedHeaderUri.getScheme();
                    }

                    // request.<header>.uri.display-name
                    if ("display-name".equals(elements[3])) {
                        return requestImpl.getAddressHeaderImpl(elements[1])
                                          .getDisplayName();
                    }

                    // Handle request.<header>.uri.user
                    if ("user".equals(elements[3])) {
View Full Code Here


                // requests.... or To be more accurate: sailfin is always transaction
                // stateful but may be dialog stateless in case no application matched
                // the invite request
                if (cancelPendingTrigger.getCancelVia() != null) {
                    // create new cancel from the Invite
                    SipServletRequestImpl newCancel = getRequest().createCancelImpl();

                    // lets answer incoming cancel with 200 OK
                    SipServletResponseImpl resp = cancel.createTerminatingResponse(200);
                    resp.setRemote(cancel.getRemote());
                    resp.popDispatcher().dispatch(resp);

                    // forward the Cancel
                    // assign via from saved top via of provisional response
                    // (i.e. the cancelTrigger)
                    // resolve it and send it out on the network
                    newCancel.setHeader(cancelPendingTrigger.getCancelVia());
                    newCancel.pushApplicationDispatcher(ResolverManager.getInstance());
                    newCancel.popDispatcher().dispatch(newCancel);
                } else {
                    // This should never happen since InviteST protection
                    // mechanism is now fixed and back in place
                    if (_log.isLoggable(Level.WARNING)) {
                        _log.log(Level.WARNING, "dialog reference is null in:" + cancel);
View Full Code Here

            }
        }
    }

    private void handleCancelTrigger(SipServletResponseImpl pendingTrigger) {
        SipServletRequestImpl cancel = getPendingCancel();

        if (cancel != null) {
            handleCancel(cancel, pendingTrigger);
        } else {
            // save cancel trigger response to enable cancel
View Full Code Here

            setPendingCancelTrigger(pendingTrigger);
        }
    }

    void handleCancel(ServerTransaction st) {
        SipServletRequestImpl cancel = st.getRequest();

        if (_state != PROCEEDING) {
            SipServletResponseImpl resp = cancel.createTerminatingResponse(481);
            resp.setRemote(cancel.getRemote());
            resp.popDispatcher().dispatch(resp);

            return;
        }
       
View Full Code Here

        Header via = getRequest().getRawHeader(Header.VIA);
        ListIterator<String> li = via.getValues();
        String topVia = li.next();

        if (topVia != null) {
            SipServletRequestImpl cancel = getRequest().createCancelImpl();

            // set top via of original request to CANCEL
            Header viaOfCancel = new MultiLineHeader(Header.VIA, true);
            ViaImpl v = new ViaImpl(topVia);
            viaOfCancel.setValue(v.toString(), true);
            cancel.setHeader(viaOfCancel);

            return cancel;
        } else {
            _log.log(Level.SEVERE,
                "Can not send CANCEL because INVITE does not have via: " +
View Full Code Here

        SipServletResponseImpl resp = getRequest().createTerminatingResponse(408);

        popVia(resp);

        // set session...
        SipServletRequestImpl req = getRequest().getTransactionRequest();

        //    TR HH52078
        if ((req != null) && (resp != null)) {
            resp.setRequest(req);
            resp.setSession(req.getSessionImpl());
        }

        return resp;
    }
View Full Code Here

            }
        }
    }
   
    private void associateTransactionWithDialog(Transaction t) {
        SipServletRequestImpl req = t.getRequest();
        if (req == null) return;
        DialogFragment dialog = req.getDialog();
        if (dialog == null) return;
        dialog.getDialogLifeCycle().associateTransaction(t.getTransactionId());
    }
View Full Code Here

        return isStop; // Continue up the chain?
    }

    public void timeout(GeneralTimer timer) {
        TransactionTimer tt = (TransactionTimer) timer.getInfo();
        SipServletRequestImpl req = null;
        Dispatcher d = null;

        switch (tt) {
        case TimerE:

            synchronized (this) {
                if ((_state == TRYING) || (_state == PROCEEDING)) {
                    long delay = T2; // default to PROCEEDING delay

                    if (_state == TRYING) {
                        // Have to dirty cast in order not to reimplement hole
                        // structure
                        delay = ((GeneralTimerImpl) timer).getDelay();
                        // calculate next timer*2 but less then T2 (4sec)
                        delay = ((delay * 2) <= T2) ? (delay * 2) : T2;
                    }

                    if (_timerE != null) {
                        _timerE.cancel();
                    }

                    // schedule new timer
                    _timerE = _timerService.createTimer(this, delay,
                            TimerE);

                    // resend the request
                    getRequest().restoreRetransmissionApplicationStack();
                    req = (SipServletRequestImpl) getRequest().clone();
                }
            }

            // dispatch after synch block...
            if (req != null) {
                d = req.popDispatcher();

                if (d != null) {
                    d.dispatch(req);
                }

View Full Code Here

        super("ContainerTransaction",TransactionState.TRYING,req);
        _timerService.createTimer(this, 64 * T1, null);
    }
   
    public void timeout(GeneralTimer timer) {
        SipServletRequestImpl req = this.getRequest();
        if(!req.isSentResponse()) {
            try {
                SipServletResponse resp = req.createResponse(408);
                resp.send();
                if (_log.isLoggable(Level.FINE)) {
                    _log.log(Level.FINE, "Sending 408, no action on requesr : "+req.toString());
                }
            } catch (IOException ex) {
                if (_log.isLoggable(Level.FINE)) {
                    _log.log(Level.FINE, "Could not send 408 from ContainerTransaction.");
                }
View Full Code Here

    public void timeout(GeneralTimer timer) {
        TransactionTimer tt = (TransactionTimer) timer.getInfo();
        Dispatcher d = null;
        SipServletResponseImpl resp = null;
        SipServletRequestImpl req = null;

        switch (tt) {
        case TimerA:

            synchronized (this) {
                if (_state == CALLING) {
                    // Have to dirty cast in order not to reimplement hole
                    // structure
                    long delay = ((GeneralTimerBase) timer).getDelay();
                    // calculate next timer*2
                    delay *= 2;
                    // schedule new timer
                    _timerA = _timerService.createTimer(this, delay, TimerA);
                    // resend the request
                    getRequest().restoreRetransmissionApplicationStack();
                    req = (SipServletRequestImpl) getRequest().clone();
                }
            }

            if (req != null) {
                // dispatch after synch block...
                d = req.popDispatcher();

                if (d != null) {
                    d.dispatch(req);
                }

                if (SipMonitoring.isEnabled(SipMonitoring.TRANSACTION_MANAGER)) {
                    updateLastAccessTimestamp();
                }
            }

            break;

        case TimerB:

            if (_log.isLoggable(Level.FINE)) {
                _log.log(Level.FINE, "Timer B fired - terminating()");
            }

            synchronized (this) {
                resp = getRequest().createTerminatingResponse(408);
                popVia(resp);
                resp.setInternalTransportFailure(true);
                terminate(false);
            }
           
            // NEW: act as if received from the network (but skip the transaction manager layer)
            // better to start a new thread???
            final SipServletResponseImpl respToSend = resp;
            SipContainerThreadPool.getInstance().execute(new Callable() {
                public Object call() throws Exception {
                    try {
                      // UOW will be set by the Replication manager
                      TransactionManager.getInstance().invokeNextLayer(respToSend);
                    } finally {
                        ReplicationUnitOfWork.clearThreadLocal();
                    }
                    return null;
                }
            });

            cleanup();

            break; // Time to do some GC

        case TimerC:

            if (_log.isLoggable(Level.FINE)) {
                _log.log(Level.FINE, "Timer C fired - terminating()");
            }

            boolean isRequestProxied = !getRequest()
                                            .isContactIndicated();

            synchronized (this) {
                if ((_state == CALLING) || (_state == PROCEEDING)) {
                    if (_has101To199Response && isRequestProxied && !getRequest().isNoCancel()) {
                        req = sendCancel();
                    } else {
                        resp = sendRequestTimeout();
                        terminate(false);
                    }
                }
            }

            // dispatch after synch block...Only send CANCEL if proxy         
            // lets CANCEL this branch...
            if (req != null) {
                //Pending state handles the case when no final response is recived even after the CANCEL is sent.
                toPending();

                d = req.popDispatcher();

                if (d != null) {
                    dispatchInUOW(d, req);
                }
            } else if (resp != null) {
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.