Package javax.servlet.sip

Examples of javax.servlet.sip.Rel100Exception


  {
    if (isCommitted())
      throw new IllegalStateException("Already committed");
   
    if (!SipMethods.INVITE.equalsIgnoreCase(getMethod()))
      throw new Rel100Exception(Rel100Exception.NOT_INVITE);
   
    if (_status > 100 && _status < 200)
        {
            long rseq = getRSeq();
            if (!isReliable1xx())
            throw new Rel100Exception(Rel100Exception.NOT_100rel);
         
            SipRequest request = (SipRequest) _session.createRequest(SipMethods.PRACK); // TODO do not use API method
            request.getFields().setString(SipHeaders.RACK_BUFFER, rseq + " " + getCSeq());
            setCommitted(true);
            return request;
        }
    else
            throw new Rel100Exception(Rel100Exception.NOT_1XX);
  }
View Full Code Here


   */
  public void sendReliably() throws Rel100Exception
    {
      SipRequest request = (SipRequest) getRequest();
        if (!request.isInvite())
            throw new Rel100Exception(Rel100Exception.NOT_INVITE);
        if (_status < 101 || _status > 199)
            throw new Rel100Exception(Rel100Exception.NOT_1XX);
   
        Iterator<String> it = _request.getHeaders(SipHeaders.SUPPORTED);
        boolean supports100rel = false;
       
        while (it.hasNext() && !supports100rel)
        {
            String s = it.next();
            if (s.equals(SipParams.REL_100))
                supports100rel = true;
        }
       
        if (!supports100rel)
        {
            it = _request.getHeaders(SipHeaders.REQUIRE);
            while (it.hasNext() && !supports100rel)
            {
                String s = (String) it.next();
                if (s.equals(SipParams.REL_100))
                    supports100rel = true;
            }
        }
       
        if (!supports100rel)
            throw new Rel100Exception(Rel100Exception.NO_REQ_SUPPORT);
       
        try
        {
            send(true);
        }
View Full Code Here

    public SipServletRequest createPrack() throws Rel100Exception {
        if (_currentRequest.getMethod().equals("INVITE") &&
                ((_statusCode > 100) && (_statusCode < 200)) &&
                !_isAlreadyPRACKGenerated && !isLocallyCreated()) {
            if (getHeader(Header.RSEQ) == null) {
                throw new Rel100Exception(Rel100Exception.NOT_1XX);
            }

            // Indicate that we are to send an PRACK.
            _isAlreadyPRACKGenerated = true;

            return getSession().createRequest("PRACK");
        } else if ((_statusCode < 101) || (_statusCode > 199)) {
            throw new Rel100Exception(Rel100Exception.NOT_1XX);
        }

        if (!_currentRequest.getMethod().equals("INVITE")) {
            throw new Rel100Exception(Rel100Exception.NOT_INVITE);
        }

        throw new IllegalStateException(
            "Not allowed to create an PRACK at this transaction state.");
    }
View Full Code Here

TOP

Related Classes of javax.servlet.sip.Rel100Exception

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.