Example #1
0
  public SIPServerTransaction findPendingTransaction(SIPRequest requestReceived) {
    SIPServerTransaction currentTransaction;
    Iterator<SIPServerTransaction> transactionIterator;
    synchronized (pendingTransactions) {
      transactionIterator = pendingTransactions.iterator();
      currentTransaction = null;
      while (transactionIterator.hasNext() && currentTransaction == null) {

        SIPServerTransaction nextTransaction = (SIPServerTransaction) transactionIterator.next();

        // If this transaction should handle this request,
        if (nextTransaction.isMessagePartOfTransaction(requestReceived)) {
          // Mark this transaction as the one
          // to handle this message
          currentTransaction = nextTransaction;
        }
      }
    }
    return currentTransaction;
  }