Package org.cipango.server

Examples of org.cipango.server.SipRequest$IteratorToEnum


    public void startRequest(Buffer method, Buffer uri, Buffer version) throws IOException
    {
      try
      {
        URI ruri = URIFactory.parseURI(uri.toString());
        SipRequest request = new SipRequest();
        request.setMethod(method.toString());
        request.setRequestURI(ruri);
        _message = request;
      }
      catch (Exception e)
      {
        throw new IOException("Parsing error: " + e.getMessage());
View Full Code Here


        assertTrue("Failed on SipTorture test " + testFiles[i] + ":\n" + message,
            new ConnectorManager().preValidateMessage(message));
        if (message instanceof SipRequest)
        {
          SipRequest request = (SipRequest) message;
          if (request.getMaxForwards() < 0 && request.getMaxForwards() != -1)
            fail("Failed on SipTorture test " + testFiles[i] + ":\n" + message);
        }
      }
      catch (Exception e)
      {
View Full Code Here

    return _listener;
  }
 
  private void ack(SipResponse response)
    {
    SipRequest ack = getRequest().createRequest(SipMethods.ACK);
   
    if (ack.to().getParameter("tag") == null)
        {
      String tag = response.to().getParameter("tag");
      if (tag != null)
        ack.to().setParameter("tag", tag);
    }
    try
        {
      getServer().getConnectorManager().send(ack, getConnection());
    }
View Full Code Here

public class SipHeaderTest
{
  @Test
  public void testAddress() throws Exception
  {
    SipRequest request = new SipRequest();
    Address address = new NameAddr("sip:foo");
    try
    {
      request.addAddressHeader("From", address, false);
      fail("system header");
    }
    catch (IllegalArgumentException e)
    {
    }
   
    try
    {
      request.addAddressHeader("Expires", address, false);
      fail("not address header");
    }
    catch (IllegalArgumentException e)
    {
    }
   
    request.addAddressHeader("foo", address, false);
    assertEquals("foo", ((SipURI) request.getAddressHeader("FOO").getURI()).getHost());
   
    request.addAddressHeader("bar", new ReadOnlyAddress(address), false);
    assertEquals("foo", ((SipURI) request.getAddressHeader("Bar").getURI()).getHost());
   
    request.setAddressHeader("bar", new ReadOnlyAddress(address));
    assertEquals("foo", ((SipURI) request.getAddressHeader("Bar").getURI()).getHost());
  }
View Full Code Here

            String cid = ID.newCallId(appSession.getCallSession().getId());
           
            Session session = appSession.createUacSession(cid, local, remote);
            session.setHandler(getSipServletHandler().getDefaultServlet());
           
            SipRequest request = (SipRequest) session.createRequest(method);
            request.setInitial(true);
            request.setRoutingDirective(SipApplicationRoutingDirective.NEW, null);
          
            return request;
        }
View Full Code Here

            return createRequest(appSession, method, createAddress(from), createAddress(to));
        }
       
        public SipServletRequest createRequest(SipServletRequest srcRequest, boolean sameCallId)
        {
          SipRequest origRequest = (SipRequest) srcRequest;
         
          NameAddr local = (NameAddr) origRequest.from().clone();
          local.setParameter(SipParams.TAG, ID.newTag());
         
          NameAddr remote = (NameAddr) origRequest.to().clone();
          remote.removeParameter(SipParams.TAG);
         
          String callId = null;
         
          if (sameCallId)
            callId = origRequest.getCallId();
          else
            callId = ID.newCallId(origRequest.getCallId());
         
            AppSession appSession = ((SipRequest) srcRequest).appSession();
           
            Session session = appSession.createUacSession(callId, local, remote);
            session.setHandler(getSipServletHandler().getDefaultServlet());

            SipRequest request = session.getUA().createRequest((SipRequest) srcRequest);
            request.setRoutingDirective(SipApplicationRoutingDirective.CONTINUE, srcRequest);
            request.setInitial(true);
           
            return request;
        }
View Full Code Here

      _localCSeq = other._localCSeq;
    }
   
    public SipRequest createRequest(SipRequest srcRequest)
    {
      SipRequest request = (SipRequest) srcRequest.clone();
           
            request.getFields().remove(SipHeaders.RECORD_ROUTE_BUFFER);
            request.getFields().remove(SipHeaders.VIA_BUFFER);
            request.getFields().remove(SipHeaders.CONTACT_BUFFER);
           
            setDialogHeaders(request, _localCSeq++);
               
      //request.setInitial(true);
      request.setSession(Session.this);
     
      return request;
    }
View Full Code Here

      return createRequest(SipMethods.ACK, _localCSeq);
    }
   
    public SipServletRequest createRequest(String method, long cseq)
    {
      SipRequest request = new SipRequest();
      request.setMethod(method.toUpperCase());
     
      setDialogHeaders(request, cseq);
     
      request.setSession(Session.this);
     
      if (_state == State.INITIAL)
        request.setInitial(true);
      return request;
    }
View Full Code Here

        tx.setListener(this);
      }
     
      updateState(response, false);
     
      SipRequest request = (SipRequest) response.getRequest();

      if (request.isInitial() && (response.to().getParameter(SipParams.TAG) == null))
      {
        String tag = _localParty.getParameter(SipParams.TAG);
        if (tag == null)
          tag = ID.newTag();
        response.to().setParameter(SipParams.TAG, tag);
      }
     
      if (request.isInvite() || request.isSubscribe())
        setRemoteTarget(request);
     
      if (request.isInvite())
      {
        int status = response.getStatus();
        long cseq = response.getCSeq().getNumber();
       
        if (200 <= status && (status < 300))
View Full Code Here

                        _localParty.setParameter(SipParams.TAG, tag);
                    }
                    response.to().setParameter(SipParams.TAG, tag);
                }*/
               
                SipRequest request = (SipRequest) response.getRequest();
         
        _remoteCSeq = request.getCSeq().getNumber();
        _secure = request.isSecure() && request.getRequestURI().getScheme().equals("sips");
       
        setRoute(request, false);
      }
    }
View Full Code Here

TOP

Related Classes of org.cipango.server.SipRequest$IteratorToEnum

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.