Package org.cipango.sip

Examples of org.cipango.sip.Via


      int port = target.getPort();
      if (port == -1)
        port = SipConnectors.getDefaultPort(transport);
   

      Via via = new Via(SipVersions.SIP_2_0, null, null);
      via.setBranch(getBranch());
      customizeVia(via);
      _request.pushVia(via);
     
      SipConnection connection = getServer().getConnectorManager().sendRequest(
          _request,
View Full Code Here


        }
    }
 
  public Via removeTopVia()
  {
    Via via = _fields.getVia();
    _fields.removeFirst(SipHeaders.VIA_BUFFER);
    return via;
  }
View Full Code Here

       
        if (preValidateMessage((SipMessage) message))
    {
          if (msg.isRequest())
            {
                Via via = msg.getTopVia();
                String remoteAddr = msg.getRemoteAddr();
               
                String host = via.getHost();
                if (host.indexOf('[') != -1)
                {
                  // As there is multiple presentation of an IPv6 address, normalize it.
                  host = InetAddress.getByName(host).getHostAddress();
                }
               
                if (!host.equals(remoteAddr))
                    via.setReceived(remoteAddr);

                if (via.getRport() != null)
                    via.setRport(Integer.toString(message.getRemotePort()));
            }

            getServer().handle(msg);
    }
    else
View Full Code Here

   
    public SipConnection sendRequest(SipRequest request, int transport, InetAddress address, int port) throws IOException
    {  
      SipConnector connector = findConnector(transport, address);
     
        Via via = request.getTopVia();
       
        via.setTransport(connector.getTransport());
        via.setHost(connector.getSipUri().getHost());
        via.setPort(connector.getSipUri().getPort());
               
        // TODO mtu

        SipConnection connection = connector.getConnection(address, port);
        send(request, connection);
View Full Code Here

   
    public void sendResponse(SipResponse response, SipConnection connection) throws IOException
    {
      if (connection == null || !connection.getConnector().isReliable() || !connection.isOpen())
      {
        Via via = response.getTopVia();
       
        SipConnector connector = null;
        InetAddress address = null;
       
        if (connection != null)
        {
          connector = connection.getConnector();
          address = connection.getRemoteAddress();
        }
        else
        {
          int transport = SipConnectors.getOrdinal(via.getTransport());
          address = InetAddress.getByName(via.getHost());
         
          connector = findConnector(transport, address);
        }
       
      int port = -1;
     
      String srport = via.getRport();
          if (srport != null)
          {
              port = Integer.parseInt(srport);
          }
          else
          {
              port = via.getPort();
              if (port == -1)
                  port = connection.getConnector().getDefaultPort();
          }
          connection = connector.getConnection(address, port);
      }
View Full Code Here

TOP

Related Classes of org.cipango.sip.Via

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.