Ejemplo n.º 1
0
 /**
  * Create a client transaction from a raw channel.
  *
  * @param transaction is the transport channel to encapsulate.
  */
 public MessageChannel createMessageChannel(SIPTransaction transaction) {
   synchronized (clientTransactions) {
     // New client transaction to return
     SIPTransaction returnChannel = createClientTransaction(transaction.getMessageChannel());
     clientTransactions.add(0, (SIPClientTransaction) returnChannel);
     ((SIPClientTransaction) returnChannel).setViaPort(transaction.getViaPort());
     ((SIPClientTransaction) returnChannel).setViaHost(transaction.getViaHost());
     // Add the transaction timer for the state machine.
     returnChannel.startTransactionTimer();
     return returnChannel;
   }
 }
Ejemplo n.º 2
0
  /**
   * Creates a client transaction to handle a new request. Gets the real message channel from the
   * superclass, and then creates a new client transaction wrapped around this channel.
   *
   * @param nextHop Hop to create a channel to contact.
   */
  public MessageChannel createMessageChannel(int sourcePort, Hop nextHop)
      throws UnknownHostException {
    synchronized (clientTransactions) {
      // New client transaction to return
      SIPTransaction returnChannel;

      // Create a new client transaction around the
      // superclass' message channel
      MessageChannel mc = super.createMessageChannel(sourcePort, nextHop);

      // Superclass will return null if no message processor
      // available for the transport.
      if (mc == null) return null;

      returnChannel = createClientTransaction(mc);
      clientTransactions.add(0, (SIPClientTransaction) returnChannel);
      ((SIPClientTransaction) returnChannel).setViaPort(nextHop.getPort());
      ((SIPClientTransaction) returnChannel).setViaHost(nextHop.getHost());
      // Add the transaction timer for the state machine.
      returnChannel.startTransactionTimer();
      return returnChannel;
    }
  }