Package org.cipango.server

Examples of org.cipango.server.SipMessage


           
            try
            {
              parser.parse();
             
              SipMessage message = handler.getMessage();
              message.setConnection(new UdpConnection(udpBuffer._address, udpBuffer._port));
             
              /*
              message.set5uple(getTransportOrdinal(), getAddr(), getPort(), p.getAddress(), p.getPort());
           
              if (message.isRequest())
View Full Code Here


    for (int i = 0; i < testFiles.length; i++)
    {
      // System.out.println(testFiles[i]);
      try
      {
        SipMessage message = getMessage(testFiles[i]);

        assertTrue("Failed on SipTorture test " + testFiles[i] + ":\n" + message,
            new ConnectorManager().preValidateMessage(message));
        if (message instanceof SipRequest)
        {
View Full Code Here

    System.out.println("Test " + testFiles.length + " SipTorture tests (invalid)");
    for (int i = 0; i < testFiles.length; i++)
    {
      try
      {
        SipMessage message = getMessage(testFiles[i]);
        assertFalse("Failed on SipTorture test " + testFiles[i] + ":\n" + message,
            new ConnectorManager().preValidateMessage(message));
        /* } catch (ServletParseException e) { */

      }
 
View Full Code Here

  @Test
  public void testTortuousInvite() throws Exception
  {
   
    File msgFile = new File(TORTURE_VALID_DIR, "wsinv2.dat");
    SipMessage message = getMessage(msgFile);
    Address contact = message.getAddressHeader("contact");
    assertEquals("Quoted string \"\"", contact.getDisplayName());
    assertEquals("newvalue", contact.getParameter("newparam"));
    assertEquals("", message.getHeader("subject"));
    // Test multiline
    assertEquals("newfangled value continued newfangled value",  message.getHeader("NewFangledHeader"));
    Via via = message.getTopVia();
    assertEquals("390skdjuw", via.getBranch());
    assertEquals("192.0.2.2", via.getHost());
    assertEquals("UDP", via.getTransport());
    message.getFrom();
    message.getTo();
    //System.out.println(message);
    //System.out.println(message.getTo().toString() + message.getFrom());
  }
View Full Code Here

   
    try
    {
      parser.parse();
     
      SipMessage message = handler.getMessage();
      message.setConnection(new UdpConnection(p.getAddress(), p.getPort()));
     
      /*
      message.set5uple(getTransportOrdinal(), getAddr(), getPort(), p.getAddress(), p.getPort());
   
      if (message.isRequest())
View Full Code Here

      try
      {
        connectionOpened(this);
       
        SipMessage message = null;
       
        while (isStarted() && !isClosed())
        {
          int size = DEFAULT_TCP_MESSAGE;
          boolean overflow = false;
           
          do
          {
            overflow = false;
            try
            {
              parser.parse();
              size = DEFAULT_TCP_MESSAGE;
              parser.setBuffer(newBuffer(size));
            }
            catch (BufferOverflowException e)
            {
              //System.out.println("Overflow");
              overflow = true;
              size = size * 2;
              if (size > MAX_TCP_MESSAGE)
                throw new IOException("Message too large");
              Buffer extended = newBuffer(size);
              parser.setBuffer(extended, true);
            }
          }
          while (overflow);
         
          message = handler.getMessage();
          message.setConnection(this);

          /*message.set5uple(
              getTransportOrdinal(),
              getLocalAddress(),
              getLocalPort(),
View Full Code Here

    return ID.getCallSessionId(message.getCallId());
  }
 
  public void handle(SipServletMessage message) throws IOException, ServletException
  {
    SipMessage baseMessage = (SipMessage) message;
 
    String id = getCallSessionId(baseMessage);
   
    if (Log.isDebugEnabled())
      Log.debug("handling message {} for call session: {}", baseMessage.getRequestLine(), id);
     
    Queue queue = null;
    synchronized (_queues)
    {
      queue = _queues.get(id);
View Full Code Here

   
    public synchronized SipMessage poll()
    {
      if (LazyList.size(_messages) == 0)
        return null;
      SipMessage message = (SipMessage) LazyList.get(_messages, 0);
      _messages = LazyList.remove(_messages, 0);
      return message;
    }
View Full Code Here

            try { Thread.sleep(20); } catch (InterruptedException e) { } // TODO
        }
       
        try
        {
          SipMessage message = null;
       
          while ((message = poll()) != null)
          {
            try
            {
              message.setCallSession(callSession);
              ((SipHandler) getHandler()).handle(message);
            }
            catch (Exception e)
            {
              Log.ignore(e);
View Full Code Here

  public void handle(SipServletMessage message) throws IOException, ServletException
    {
    if (!isStarted())
      return;
 
    SipMessage baseMessage = (SipMessage) message;
    Session session = baseMessage.session();
   
    SipServletHolder holder = session.getHandler();
 
    if (holder == null)
      throw new IllegalStateException("No holder for session " + session);
   
    /*
    if (holder == null)
    {
      holder = findHolder((SipServletRequest) baseMessage);
      if (Log.isDebugEnabled())
        Log.debug("sipservlet holder: {}", holder);
     
      if (holder != null)
      {
        session.setHandler(holder);
                ((AppSession) session.getApplicationSession()).setContext(_context);
      }
    }
    */

    if (baseMessage.isRequest())
      holder.handle((ServletRequest) baseMessage, null);
    else
      holder.handle(null, (ServletResponse) baseMessage);
  }
View Full Code Here

TOP

Related Classes of org.cipango.server.SipMessage

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.