gov.nist.javax.sip.stack
Class SIPTransactionStack

java.lang.Object
  extended by gov.nist.javax.sip.stack.SIPTransactionStack
All Implemented Interfaces:
SIPDialogEventListener, SIPTransactionEventListener, EventListener
Direct Known Subclasses:
SipStackImpl

public abstract class SIPTransactionStack
extends Object
implements SIPTransactionEventListener, SIPDialogEventListener

This is the sip stack. It is essentially a management interface. It manages the resources for the JAIN-SIP implementation. This is the structure that is wrapped by the SipStackImpl.

Version:
1.2 $Revision: 1.180 $ $Date: 2010-12-02 22:04:15 $
Author:
M. Ranganathan
See Also:
SipStackImpl

Nested Class Summary
protected  class SIPTransactionStack.PingTimer
           
 
Field Summary
protected  AddressResolver addressResolver
           
protected  boolean aggressiveCleanup
           
static int BASE_TIMER_INTERVAL
           
protected  boolean cacheClientConnections
           
protected  boolean cacheServerConnections
           
protected  boolean cancelClientTransactionChecked
           
protected  boolean checkBranchId
           
protected  ClientAuthType clientAuth
           
protected  ConcurrentHashMap<String,SIPClientTransaction> clientTransactionTable
           
protected  int clientTransactionTableHiwaterMark
           
protected  int clientTransactionTableLowaterMark
           
static int CONNECTION_LINGER_TIME
           
protected  DefaultRouter defaultRouter
           
protected  boolean deliverRetransmittedAckToListener
           
protected static Set<String> dialogCreatingMethods
           
protected  ConcurrentHashMap<String,SIPDialog> dialogTable
           
protected  int dialogTimeoutFactor
           
protected  ConcurrentHashMap<String,SIPDialog> earlyDialogTable
           
protected  int earlyDialogTimeout
           
protected  HashSet<String> forkedEvents
           
protected  boolean generateTimeStampHeader
           
protected  IOHandler ioHandler
           
protected  boolean isAutomaticDialogErrorHandlingEnabled
           
protected  boolean isAutomaticDialogSupportEnabled
           
protected  boolean isBackToBackUserAgent
           
protected  boolean isDialogTerminatedEventDeliveredForNullDialog
           
protected  LogRecordFactory logRecordFactory
           
protected  boolean logStackTraceOnMessageSend
           
protected  int maxConnections
           
protected  int maxContentLength
           
protected  int maxForkTime
           
protected  int maxListenerResponseTime
           
protected  int maxMessageSize
           
protected  int maxTxLifetimeInvite
           
protected  int maxTxLifetimeNonInvite
           
 MessageParserFactory messageParserFactory
           
 MessageProcessorFactory messageProcessorFactory
           
protected  long minKeepAliveInterval
           
protected  boolean needsLogging
           
protected  NetworkLayer networkLayer
           
protected  String outboundProxy
           
protected  int readTimeout
           
protected  int receiveUdpBufferSize
           
protected  int reliableConnectionKeepAliveTimeout
          Keepalive support and cleanup for client-initiated connections as per RFC 5626.
protected  boolean remoteTagReassignmentAllowed
           
protected  ConcurrentHashMap<String,SIPServerTransaction> retransmissionAlertTransactions
           
protected  boolean rfc2543Supported
           
protected  Router router
           
protected  String routerPath
           
protected static Executor selfRoutingThreadpoolExecutor
           
protected  int sendUdpBufferSize
           
protected  ConcurrentHashMap<String,SIPDialog> serverDialogMergeTestTable
           
protected  ServerLogger serverLogger
           
protected  ConcurrentHashMap<String,SIPServerTransaction> serverTransactionTable
           
protected  int serverTransactionTableHighwaterMark
           
protected  int serverTransactionTableLowaterMark
           
 SIPEventInterceptor sipEventInterceptor
           
protected  StackMessageFactory sipMessageFactory
           
 SIPMessageValve sipMessageValve
           
protected  String stackAddress
           
protected  int stackCongenstionControlTimeout
           
protected  InetAddress stackInetAddress
           
protected  String stackName
           
protected  ThreadAuditor threadAuditor
           
protected  int threadPoolSize
           
protected  boolean toExit
           
protected  boolean unlimitedClientTransactionTableSize
           
protected  boolean unlimitedServerTransactionTableSize
           
protected  boolean useRouterForAll
           
 
Constructor Summary
protected SIPTransactionStack()
          Default constructor.
protected SIPTransactionStack(StackMessageFactory messageFactory)
          Construcor for the stack.
 
Method Summary
 void addExtensionMethod(String extensionMethod)
          Add an extension method.
 void addForkedClientTransaction(SIPClientTransaction clientTransaction)
           
protected  void addMessageProcessor(MessageProcessor newMessageProcessor)
          Adds a new MessageProcessor to the list of running processors for this SIPStack and starts it.
 void addTransaction(SIPClientTransaction clientTransaction)
          Add a new client transaction to the set of existing transactions.
 void addTransaction(SIPServerTransaction serverTransaction)
          Add a new server transaction to the set of existing transactions.
 void addTransactionPendingAck(SIPServerTransaction serverTransaction)
          Add entry to "Transaction Pending ACK" table.
 String auditStack(Set activeCallIDs, long leakedDialogTimer, long leakedTransactionTimer)
          Audits the SIP Stack for leaks
 boolean checkBranchId()
          Flag that reqests checking of branch IDs on responses.
 boolean closeReliableConnection(String myAddress, int myPort, String transport, String peerAddress, int peerPort)
          Find suitable MessageProcessor and calls it's MessageProcessor#closeReliableConnection(String, int) method passing peerAddress and peerPort as arguments.
 SIPClientTransaction createClientTransaction(SIPRequest sipRequest, MessageChannel encapsulatedMessageChannel)
          Creates a client transaction that encapsulates a MessageChannel.
 SIPDialog createDialog(SIPClientTransaction transaction, SIPResponse sipResponse)
          Create a Dialog given a client tx and response.
 SIPDialog createDialog(SipProviderImpl sipProvider, SIPResponse sipResponse)
          Create a Dialog given a sip provider and response.
 SIPDialog createDialog(SIPTransaction transaction)
          Create a dialog and add this transaction to it.
 MessageChannel createMessageChannel(SIPRequest request, MessageProcessor mp, Hop nextHop)
          Creates a client transaction to handle a new request.
protected  MessageProcessor createMessageProcessor(InetAddress ipAddress, int port, String transport)
          Creates the equivalent of a JAIN listening point and attaches to the stack.
 MessageChannel createRawMessageChannel(String sourceIpAddress, int sourcePort, Hop nextHop)
          Creates a new MessageChannel for a given Hop.
 SIPServerTransaction createServerTransaction(MessageChannel encapsulatedMessageChannel)
          Creates a server transaction that encapsulates a MessageChannel.
protected  void decrementActiveClientTransactionCount()
          This method is called when a client tx transitions to the Completed or Terminated state.
 void dialogErrorEvent(SIPDialogErrorEvent dialogErrorEvent)
          Invoked when an error has ocurred with a dialog.
 void disableLogging()
          For debugging -- allows you to disable logging or enable logging selectively.
 void enableLogging()
          Globally enable message logging ( for debugging)
 SIPTransaction findCancelTransaction(SIPRequest cancelRequest, boolean isServer)
          Get the transaction to cancel.
 boolean findMergedTransaction(SIPRequest sipRequest)
          See if there is a pending transaction with the same Merge ID as the Merge ID obtained from the SIP Request.
 SIPServerTransaction findPendingTransaction(String transactionId)
          Finds a pending server transaction.
 SIPClientTransaction findSubscribeTransaction(SIPRequest notifyMessage, ListeningPointImpl listeningPoint)
          Find a matching client SUBSCRIBE to the incoming notify.
 SIPTransaction findTransaction(SIPMessage sipMessage, boolean isServer)
          Find the transaction corresponding to a given request.
 SIPTransaction findTransaction(String transactionId, boolean isServer)
           
 SIPServerTransaction findTransactionPendingAck(SIPRequest ackMessage)
          Get entry in the server transaction pending ACK table corresponding to an ACK.
 int getAckTimeoutFactor()
          Get the dialog timeout counter.
 int getActiveClientTransactionCount()
          Get the count of client transactions that is not in the completed or terminated state.
 AddressResolver getAddressResolver()
          get the address resolver interface.
 ClientAuthType getClientAuth()
           
 int getClientTransactionTableSize()
          Get the size of the client transaction table.
 SIPDialog getDialog(String dialogId)
          Return the dialog for a given dialog ID.
 Collection<Dialog> getDialogs()
          This method is slated for addition to the next spec revision.
 Collection<Dialog> getDialogs(DialogState state)
           
 SIPDialog getEarlyDialog(String dialogId)
           
 int getEarlyDialogTimeout()
           
 SIPClientTransaction getForkedTransaction(String transactionId)
           
 String getHostAddress()
          Deprecated.  
 Dialog getJoinDialog(JoinHeader joinHeader)
          Get the Join Dialog from the stack.
 SocketAddress getLocalAddressForTcpDst(InetAddress dst, int dstPort, InetAddress localAddress, int localPort)
          Creates and binds, if necessary, a socket connected to the specified destination address and port and then returns its local address.
 SocketAddress getLocalAddressForTlsDst(InetAddress dst, int dstPort, InetAddress localAddress)
          Creates and binds, if necessary, a TCP SSL socket connected to the specified destination address and port and then returns its local address.
 int getMaxForkTime()
           
 int getMaxMessageSize()
          Maximum size of a single TCP message.
 int getMaxTxLifetimeInvite()
           
 int getMaxTxLifetimeNonInvite()
           
 MessageParserFactory getMessageParserFactory()
           
 MessageProcessorFactory getMessageProcessorFactory()
           
protected  MessageProcessor[] getMessageProcessors()
          Gets an array of running MessageProcessors on this SIPStack.
 long getMinKeepAliveInterval()
           
 NetworkLayer getNetworkLayer()
          Return the network layer (i.e.
 Hop getNextHop(SIPRequest sipRequest)
          Get the default route string.
 int getReceiveUdpBufferSize()
          Size of the receive UDP buffer.
 ExecutorService getReinviteExecutor()
          Executor used to optimize the ReinviteSender Runnable in the sendRequest of the SipDialog
 int getReliableConnectionKeepAliveTimeout()
           
 Dialog getReplacesDialog(ReplacesHeader replacesHeader)
          Get the Replaced Dialog from the stack.
 SIPServerTransaction getRetransmissionAlertTransaction(String dialogId)
          Retrieve a transaction from our table of transactions with pending retransmission alerts.
 Router getRouter()
           
 Router getRouter(SIPRequest request)
          Get the router algorithm.
 Executor getSelfRoutingThreadpoolExecutor()
           
 int getSendUdpBufferSize()
          Size of the send UDP buffer.
 ServerLogger getServerLogger()
          Server log is the place where we log messages for the signaling trace viewer.
 int getServerTransactionTableSize()
          Get the size of the server transaction table.
abstract  SipListener getSipListener()
           
 long getSslHandshakeTimeout()
           
 StackLogger getStackLogger()
          Deprecated. 
 int getTcpPostParsingThreadPoolSize()
          If all calls are occurring on a single TCP socket then the stack would process them in single thread.
 ThreadAuditor getThreadAuditor()
          get the thread auditor object
 int getThreadPriority()
           
 SipTimer getTimer()
           
 boolean isAggressiveCleanup()
           
 boolean isAlive()
          return the status of the toExit flag.
 boolean isCancelClientTransactionChecked()
           
 boolean isDeliverRetransmittedAckToListener()
          This is a testing interface.
 boolean isDeliverTerminatedEventForAck()
           
 boolean isDeliverUnsolicitedNotify()
           
static boolean isDialogCreated(String method)
          Return true if extension is supported.
 boolean isEventForked(String ename)
          Return true if a given event can result in a forked subscription.
 boolean isLoggingEnabled()
          Deprecated. 
 boolean isLoggingEnabled(int level)
          Deprecated. 
 boolean isLogStackTraceOnMessageSend()
           
 boolean isNon2XXAckPassedToListener()
           
 boolean isRemoteTagReassignmentAllowed()
           
 boolean isRfc2543Supported()
           
 boolean isTransactionPendingAck(SIPServerTransaction serverTransaction)
          Check if this entry exists in the "Transaction Pending ACK" table.
 void mapTransaction(SIPServerTransaction transaction)
          Map a Server transaction (possibly sending out a 100 if the server tx is an INVITE).
 ServerRequestInterface newSIPServerRequest(SIPRequest requestReceived, MessageChannel requestMessageChannel)
          Handles a new SIP request.
 ServerResponseInterface newSIPServerResponse(SIPResponse responseReceived, MessageChannel responseMessageChannel)
          Handles a new SIP response.
 void printDialogTable()
          Print the dialog table.
 SIPDialog putDialog(SIPDialog dialog)
          Put a dialog into the dialog table.
 void putInMergeTable(SIPServerTransaction sipTransaction, SIPRequest sipRequest)
          Put this into the merge request table.
protected  void putMergeDialog(SIPDialog sipDialog)
           
 void putPendingTransaction(SIPServerTransaction tr)
          Put a transaction in the pending transaction list.
protected  void reInit()
          Re Initialize the stack instance.
 void removeDialog(SIPDialog dialog)
          Remove the dialog from the dialog table.
 void removeDialog(String dialogId)
          Remove the dialog given its dialog id.
 void removeFromMergeTable(SIPServerTransaction tr)
          Remove a transaction from the merge table.
protected  void removeMergeDialog(String mergeId)
           
protected  void removeMessageProcessor(MessageProcessor oldMessageProcessor)
          Removes a MessageProcessor from this SIPStack.
 void removePendingTransaction(SIPServerTransaction tr)
          Remove a pending Server transaction from the stack.
 void removeTransaction(SIPTransaction sipTransaction)
          Remove transaction.
protected  void removeTransactionHash(SIPTransaction sipTransaction)
          Remove the transaction from transaction hash.
 boolean removeTransactionPendingAck(SIPServerTransaction serverTransaction)
          Remove entry from "Transaction Pending ACK" table.
 void setAddressResolver(AddressResolver addressResolver)
          Set the address resolution interface
 void setAggressiveCleanup(boolean aggressiveCleanup)
           
 void setClientAuth(ClientAuthType clientAuth)
           
 void setDeliverDialogTerminatedEventForNullDialog()
           
 void setDeliverTerminatedEventForAck(boolean deliverTerminatedEventForAck)
           
 void setDeliverUnsolicitedNotify(boolean deliverUnsolicitedNotify)
           
 void setEarlyDialogTimeout(int earlyDialogTimeout)
           
protected  void setHostAddress(String stackAddress)
          Set my address.
 boolean setKeepAliveTimeout(String myAddress, int myPort, String transport, String peerAddress, int peerPort, long keepAliveTimeout)
          Find suitable MessageProcessor and calls it's MessageProcessor#setKeepAliveTimeout(String, int, long) method passing peerAddress and peerPort as arguments.
 void setLogRecordFactory(LogRecordFactory logRecordFactory)
          Set the logger factory.
 void setLogStackTraceOnMessageSend(boolean logStackTraceOnMessageSend)
           
 void setMaxConnections(int nconnections)
          Set the max # of simultaneously handled TCP connections.
 void setMaxForkTime(int maxForkTime)
           
 void setMaxTxLifetimeInvite(int maxTxLifetimeInvite)
           
 void setMaxTxLifetimeNonInvite(int maxTxLifetimeNonInvite)
           
protected  void setMessageFactory(StackMessageFactory messageFactory)
          Set the message factory.
 void setMessageParserFactory(MessageParserFactory messageParserFactory)
           
 void setMessageProcessorFactory(MessageProcessorFactory messageProcessorFactory)
           
 void setNon2XXAckPassedToListener(boolean passToListener)
           
 void setReceiveUdpBufferSize(int receiveUdpBufferSize)
          Size of the receive UDP buffer.
 void setReliableConnectionKeepAliveTimeout(int reliableConnectionKeepAliveTimeout)
           
protected  void setRouter(Router router)
          Set the router algorithm.
 void setSendUdpBufferSize(int sendUdpBufferSize)
          Size of the send UDP buffer.
 void setSingleThreaded()
          Set the flag that instructs the stack to only start a single thread for sequentially processing incoming udp messages (thus serializing the processing).
 void setSslHandshakeTimeout(long sslHandshakeTimeout)
           
 void setStackName(String stackName)
          Set the descriptive name of the stack.
 void setTcpPostParsingThreadPoolSize(int tcpPostParsingThreadPoolSize)
          If all calls are occurring on a single TCP socket then the stack would process them in single thread.
 void setThreadPoolSize(int size)
          Set the thread pool size for processing incoming UDP messages.
 void setThreadPriority(int threadPriority)
           
 void setTimer(SipTimer timer)
           
 void stopStack()
          Stop stack.
 void transactionErrorEvent(SIPTransactionErrorEvent transactionErrorEvent)
          Invoked when an error has ocurred with a transaction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BASE_TIMER_INTERVAL

public static final int BASE_TIMER_INTERVAL
See Also:
Constant Field Values

CONNECTION_LINGER_TIME

public static final int CONNECTION_LINGER_TIME
See Also:
Constant Field Values

earlyDialogTimeout

protected int earlyDialogTimeout

retransmissionAlertTransactions

protected ConcurrentHashMap<String,SIPServerTransaction> retransmissionAlertTransactions

earlyDialogTable

protected ConcurrentHashMap<String,SIPDialog> earlyDialogTable

dialogTable

protected ConcurrentHashMap<String,SIPDialog> dialogTable

serverDialogMergeTestTable

protected ConcurrentHashMap<String,SIPDialog> serverDialogMergeTestTable

dialogCreatingMethods

protected static final Set<String> dialogCreatingMethods

clientTransactionTable

protected ConcurrentHashMap<String,SIPClientTransaction> clientTransactionTable

unlimitedServerTransactionTableSize

protected boolean unlimitedServerTransactionTableSize

unlimitedClientTransactionTableSize

protected boolean unlimitedClientTransactionTableSize

serverTransactionTableHighwaterMark

protected int serverTransactionTableHighwaterMark

serverTransactionTableLowaterMark

protected int serverTransactionTableLowaterMark

clientTransactionTableHiwaterMark

protected int clientTransactionTableHiwaterMark

clientTransactionTableLowaterMark

protected int clientTransactionTableLowaterMark

serverTransactionTable

protected ConcurrentHashMap<String,SIPServerTransaction> serverTransactionTable

deliverRetransmittedAckToListener

protected boolean deliverRetransmittedAckToListener

serverLogger

protected ServerLogger serverLogger

defaultRouter

protected DefaultRouter defaultRouter

needsLogging

protected boolean needsLogging

ioHandler

protected IOHandler ioHandler

toExit

protected boolean toExit

stackName

protected String stackName

stackAddress

protected String stackAddress

stackInetAddress

protected InetAddress stackInetAddress

sipMessageFactory

protected StackMessageFactory sipMessageFactory

router

protected Router router

threadPoolSize

protected int threadPoolSize

maxConnections

protected int maxConnections

cacheServerConnections

protected boolean cacheServerConnections

cacheClientConnections

protected boolean cacheClientConnections

useRouterForAll

protected boolean useRouterForAll

maxContentLength

protected int maxContentLength

maxMessageSize

protected int maxMessageSize

readTimeout

protected int readTimeout

networkLayer

protected NetworkLayer networkLayer

outboundProxy

protected String outboundProxy

routerPath

protected String routerPath

isAutomaticDialogSupportEnabled

protected boolean isAutomaticDialogSupportEnabled

forkedEvents

protected HashSet<String> forkedEvents

generateTimeStampHeader

protected boolean generateTimeStampHeader

addressResolver

protected AddressResolver addressResolver

maxListenerResponseTime

protected int maxListenerResponseTime

maxTxLifetimeInvite

protected int maxTxLifetimeInvite

maxTxLifetimeNonInvite

protected int maxTxLifetimeNonInvite

rfc2543Supported

protected boolean rfc2543Supported

threadAuditor

protected ThreadAuditor threadAuditor

logRecordFactory

protected LogRecordFactory logRecordFactory

cancelClientTransactionChecked

protected boolean cancelClientTransactionChecked

remoteTagReassignmentAllowed

protected boolean remoteTagReassignmentAllowed

logStackTraceOnMessageSend

protected boolean logStackTraceOnMessageSend

receiveUdpBufferSize

protected int receiveUdpBufferSize

sendUdpBufferSize

protected int sendUdpBufferSize

stackCongenstionControlTimeout

protected int stackCongenstionControlTimeout

isBackToBackUserAgent

protected boolean isBackToBackUserAgent

checkBranchId

protected boolean checkBranchId

isAutomaticDialogErrorHandlingEnabled

protected boolean isAutomaticDialogErrorHandlingEnabled

isDialogTerminatedEventDeliveredForNullDialog

protected boolean isDialogTerminatedEventDeliveredForNullDialog

maxForkTime

protected int maxForkTime

clientAuth

protected ClientAuthType clientAuth

minKeepAliveInterval

protected long minKeepAliveInterval

dialogTimeoutFactor

protected int dialogTimeoutFactor

messageParserFactory

public MessageParserFactory messageParserFactory

messageProcessorFactory

public MessageProcessorFactory messageProcessorFactory

aggressiveCleanup

protected boolean aggressiveCleanup

sipMessageValve

public SIPMessageValve sipMessageValve

sipEventInterceptor

public SIPEventInterceptor sipEventInterceptor

selfRoutingThreadpoolExecutor

protected static Executor selfRoutingThreadpoolExecutor

reliableConnectionKeepAliveTimeout

protected int reliableConnectionKeepAliveTimeout
Keepalive support and cleanup for client-initiated connections as per RFC 5626. Based on the maximum CRLF keep-alive period of 840 seconds, per http://tools.ietf.org/html/rfc5626#section-4.4.1. a value < 0 means that the RFC 5626 will not be triggered, as a default we don't enable it not to change existing apps behavior.

Constructor Detail

SIPTransactionStack

protected SIPTransactionStack()
Default constructor.


SIPTransactionStack

protected SIPTransactionStack(StackMessageFactory messageFactory)
Construcor for the stack. Registers the request and response factories for the stack.

Parameters:
messageFactory - User-implemented factory for processing messages.
Method Detail

getSelfRoutingThreadpoolExecutor

public Executor getSelfRoutingThreadpoolExecutor()

reInit

protected void reInit()
Re Initialize the stack instance.


getLocalAddressForTcpDst

public SocketAddress getLocalAddressForTcpDst(InetAddress dst,
                                              int dstPort,
                                              InetAddress localAddress,
                                              int localPort)
                                       throws IOException
Creates and binds, if necessary, a socket connected to the specified destination address and port and then returns its local address.

Parameters:
dst - the destination address that the socket would need to connect to.
dstPort - the port number that the connection would be established with.
localAddress - the address that we would like to bind on (null for the "any" address).
localPort - the port that we'd like our socket to bind to (0 for a random port).
Returns:
the SocketAddress that this handler would use when connecting to the specified destination address and port.
Throws:
IOException - if binding the socket fails

getLocalAddressForTlsDst

public SocketAddress getLocalAddressForTlsDst(InetAddress dst,
                                              int dstPort,
                                              InetAddress localAddress)
                                       throws IOException
Creates and binds, if necessary, a TCP SSL socket connected to the specified destination address and port and then returns its local address.

Parameters:
dst - the destination address that the socket would need to connect to.
dstPort - the port number that the connection would be established with.
localAddress - the address that we would like to bind on (null for the "any" address).
Returns:
the SocketAddress that this handler would use when connecting to the specified destination address and port.
Throws:
IOException - if binding the socket fails

disableLogging

public void disableLogging()
For debugging -- allows you to disable logging or enable logging selectively.


enableLogging

public void enableLogging()
Globally enable message logging ( for debugging)


printDialogTable

public void printDialogTable()
Print the dialog table.


getRetransmissionAlertTransaction

public SIPServerTransaction getRetransmissionAlertTransaction(String dialogId)
Retrieve a transaction from our table of transactions with pending retransmission alerts.

Parameters:
dialogId -
Returns:
-- the RetransmissionAlert enabled transaction corresponding to the given dialog ID.

isDialogCreated

public static boolean isDialogCreated(String method)
Return true if extension is supported.

Returns:
true if extension is supported and false otherwise.

addExtensionMethod

public void addExtensionMethod(String extensionMethod)
Add an extension method.

Parameters:
extensionMethod - -- extension method to support for dialog creation

putDialog

public SIPDialog putDialog(SIPDialog dialog)
Put a dialog into the dialog table.

Parameters:
dialog - -- dialog to put into the dialog table.

createDialog

public SIPDialog createDialog(SIPTransaction transaction)
Create a dialog and add this transaction to it.

Parameters:
transaction - -- tx to add to the dialog.
Returns:
the newly created Dialog.

createDialog

public SIPDialog createDialog(SIPClientTransaction transaction,
                              SIPResponse sipResponse)
Create a Dialog given a client tx and response.

Parameters:
transaction -
sipResponse -
Returns:

createDialog

public SIPDialog createDialog(SipProviderImpl sipProvider,
                              SIPResponse sipResponse)
Create a Dialog given a sip provider and response.

Parameters:
sipProvider -
sipResponse -
Returns:

removeDialog

public void removeDialog(SIPDialog dialog)
Remove the dialog from the dialog table.

Parameters:
dialog - -- dialog to remove.

getEarlyDialog

public SIPDialog getEarlyDialog(String dialogId)

removeMergeDialog

protected void removeMergeDialog(String mergeId)

putMergeDialog

protected void putMergeDialog(SIPDialog sipDialog)

getDialog

public SIPDialog getDialog(String dialogId)
Return the dialog for a given dialog ID. If compatibility is enabled then we do not assume the presence of tags and hence need to add a flag to indicate whether this is a server or client transaction.

Parameters:
dialogId - is the dialog id to check.

removeDialog

public void removeDialog(String dialogId)
Remove the dialog given its dialog id. This is used for dialog id re-assignment only.

Parameters:
dialogId - is the dialog Id to remove.

findSubscribeTransaction

public SIPClientTransaction findSubscribeTransaction(SIPRequest notifyMessage,
                                                     ListeningPointImpl listeningPoint)
Find a matching client SUBSCRIBE to the incoming notify. NOTIFY requests are matched to such SUBSCRIBE requests if they contain the same "Call-ID", a "To" header "tag" parameter which matches the "From" header "tag" parameter of the SUBSCRIBE, and the same "Event" header field. Rules for comparisons of the "Event" headers are described in section 7.2.1. If a matching NOTIFY request contains a "Subscription-State" of "active" or "pending", it creates a new subscription and a new dialog (unless they have already been created by a matching response, as described above).

Parameters:
notifyMessage -
Returns:
-- the matching ClientTransaction with semaphore aquired or null if no such client transaction can be found.

addTransactionPendingAck

public void addTransactionPendingAck(SIPServerTransaction serverTransaction)
Add entry to "Transaction Pending ACK" table.

Parameters:
serverTransaction -

findTransactionPendingAck

public SIPServerTransaction findTransactionPendingAck(SIPRequest ackMessage)
Get entry in the server transaction pending ACK table corresponding to an ACK.

Parameters:
ackMessage -
Returns:

removeTransactionPendingAck

public boolean removeTransactionPendingAck(SIPServerTransaction serverTransaction)
Remove entry from "Transaction Pending ACK" table.

Parameters:
serverTransaction -
Returns:

isTransactionPendingAck

public boolean isTransactionPendingAck(SIPServerTransaction serverTransaction)
Check if this entry exists in the "Transaction Pending ACK" table.

Parameters:
serverTransaction -
Returns:

findTransaction

public SIPTransaction findTransaction(SIPMessage sipMessage,
                                      boolean isServer)
Find the transaction corresponding to a given request.

Parameters:
sipMessage - request for which to retrieve the transaction.
isServer - search the server transaction table if true.
Returns:
the transaction object corresponding to the request or null if no such mapping exists.

findTransaction

public SIPTransaction findTransaction(String transactionId,
                                      boolean isServer)

findCancelTransaction

public SIPTransaction findCancelTransaction(SIPRequest cancelRequest,
                                            boolean isServer)
Get the transaction to cancel. Search the server transaction table for a transaction that matches the given transaction.


findPendingTransaction

public SIPServerTransaction findPendingTransaction(String transactionId)
Finds a pending server transaction. Since each request may be handled either statefully or statelessly, we keep a map of pending transactions so that a duplicate transaction is not created if a second request is recieved while the first one is being processed.

Parameters:
requestReceived -
Returns:
-- the pending transaction or null if no such transaction exists.

findMergedTransaction

public boolean findMergedTransaction(SIPRequest sipRequest)
See if there is a pending transaction with the same Merge ID as the Merge ID obtained from the SIP Request. The Merge table is for handling the following condition: If the request has no tag in the To header field, the UAS core MUST check the request against ongoing transactions. If the From tag, Call-ID, and CSeq exactly match those associated with an ongoing transaction, but the request does not match that transaction (based on the matching rules in Section 17.2.3), the UAS core SHOULD generate a 482 (Loop Detected) response and pass it to the server transaction.


removePendingTransaction

public void removePendingTransaction(SIPServerTransaction tr)
Remove a pending Server transaction from the stack. This is called after the user code has completed execution in the listener.

Parameters:
tr - -- pending transaction to remove.

removeFromMergeTable

public void removeFromMergeTable(SIPServerTransaction tr)
Remove a transaction from the merge table.

Parameters:
tr - -- the server transaction to remove from the merge table.

putInMergeTable

public void putInMergeTable(SIPServerTransaction sipTransaction,
                            SIPRequest sipRequest)
Put this into the merge request table.

Parameters:
sipTransaction - -- transaction to put into the merge table.

mapTransaction

public void mapTransaction(SIPServerTransaction transaction)
Map a Server transaction (possibly sending out a 100 if the server tx is an INVITE). This actually places it in the hash table and makes it known to the stack.

Parameters:
transaction - -- the server transaction to map.

newSIPServerRequest

public ServerRequestInterface newSIPServerRequest(SIPRequest requestReceived,
                                                  MessageChannel requestMessageChannel)
Handles a new SIP request. It finds a server transaction to handle this message. If none exists, it creates a new transaction.

Parameters:
requestReceived - Request to handle.
requestMessageChannel - Channel that received message.
Returns:
A server transaction.

newSIPServerResponse

public ServerResponseInterface newSIPServerResponse(SIPResponse responseReceived,
                                                    MessageChannel responseMessageChannel)
Handles a new SIP response. It finds a client transaction to handle this message. If none exists, it sends the message directly to the superclass.

Parameters:
responseReceived - Response to handle.
responseMessageChannel - Channel that received message.
Returns:
A client transaction.

createMessageChannel

public MessageChannel createMessageChannel(SIPRequest request,
                                           MessageProcessor mp,
                                           Hop nextHop)
                                    throws IOException
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.

Parameters:
nextHop - Hop to create a channel to contact.
Throws:
IOException

createClientTransaction

public SIPClientTransaction createClientTransaction(SIPRequest sipRequest,
                                                    MessageChannel encapsulatedMessageChannel)
Creates a client transaction that encapsulates a MessageChannel. Useful for implementations that want to subclass the standard

Parameters:
encapsulatedMessageChannel - Message channel of the transport layer.

createServerTransaction

public SIPServerTransaction createServerTransaction(MessageChannel encapsulatedMessageChannel)
Creates a server transaction that encapsulates a MessageChannel. Useful for implementations that want to subclass the standard

Parameters:
encapsulatedMessageChannel - Message channel of the transport layer.

getClientTransactionTableSize

public int getClientTransactionTableSize()
Get the size of the client transaction table.

Returns:
-- size of the ct table.

getServerTransactionTableSize

public int getServerTransactionTableSize()
Get the size of the server transaction table.

Returns:
-- size of the server table.

addTransaction

public void addTransaction(SIPClientTransaction clientTransaction)
Add a new client transaction to the set of existing transactions. Add it to the top of the list so an incoming response has less work to do in order to find the transaction.

Parameters:
clientTransaction - -- client transaction to add to the set.

removeTransaction

public void removeTransaction(SIPTransaction sipTransaction)
Remove transaction. This actually gets the tx out of the search structures which the stack keeps around. When the tx


addTransaction

public void addTransaction(SIPServerTransaction serverTransaction)
                    throws IOException
Add a new server transaction to the set of existing transactions. Add it to the top of the list so an incoming ack has less work to do in order to find the transaction.

Parameters:
serverTransaction - -- server transaction to add to the set.
Throws:
IOException

decrementActiveClientTransactionCount

protected void decrementActiveClientTransactionCount()
This method is called when a client tx transitions to the Completed or Terminated state.


removeTransactionHash

protected void removeTransactionHash(SIPTransaction sipTransaction)
Remove the transaction from transaction hash.


transactionErrorEvent

public void transactionErrorEvent(SIPTransactionErrorEvent transactionErrorEvent)
Invoked when an error has ocurred with a transaction.

Specified by:
transactionErrorEvent in interface SIPTransactionEventListener
Parameters:
transactionErrorEvent - Error event.

dialogErrorEvent

public void dialogErrorEvent(SIPDialogErrorEvent dialogErrorEvent)
Description copied from interface: SIPDialogEventListener
Invoked when an error has ocurred with a dialog.

Specified by:
dialogErrorEvent in interface SIPDialogEventListener
Parameters:
dialogErrorEvent - Error event.

stopStack

public void stopStack()
Stop stack. Clear all the timer stuff. Make the stack close all accept connections and return. This is useful if you want to start/stop the stack several times from your application. Caution : use of this function could cause peculiar bugs as messages are prcessed asynchronously by the stack.


putPendingTransaction

public void putPendingTransaction(SIPServerTransaction tr)
Put a transaction in the pending transaction list. This is to avoid a race condition when a duplicate may arrive when the application is deciding whether to create a transaction or not.


getNetworkLayer

public NetworkLayer getNetworkLayer()
Return the network layer (i.e. the interface for socket creation or the socket factory for the stack).

Returns:
-- the registered Network Layer.

isLoggingEnabled

@Deprecated
public boolean isLoggingEnabled()
Deprecated. 

Return true if logging is enabled for this stack. Deprecated. Use StackLogger.isLoggingEnabled instead

Returns:
true if logging is enabled for this stack instance.

isLoggingEnabled

@Deprecated
public boolean isLoggingEnabled(int level)
Deprecated. 

Deprecated. Use StackLogger.isLoggingEnabled instead

Parameters:
level -
Returns:

getStackLogger

@Deprecated
public StackLogger getStackLogger()
Deprecated. 

Get the logger. This method should be deprected. Use static logger = CommonLogger.getLogger() instead

Returns:
--the logger for the sip stack. Each stack has its own logger instance.

getServerLogger

public ServerLogger getServerLogger()
Server log is the place where we log messages for the signaling trace viewer.

Returns:
-- the log file where messages are logged for viewing by the trace viewer.

getMaxMessageSize

public int getMaxMessageSize()
Maximum size of a single TCP message. Limiting the size of a single TCP message prevents flooding attacks.

Returns:
the size of a single TCP message.

setSingleThreaded

public void setSingleThreaded()
Set the flag that instructs the stack to only start a single thread for sequentially processing incoming udp messages (thus serializing the processing). Same as setting thread pool size to 1.


getTcpPostParsingThreadPoolSize

public int getTcpPostParsingThreadPoolSize()
If all calls are occurring on a single TCP socket then the stack would process them in single thread. This property allows immediately after parsing to split the load into many threads which increases the performance significantly. If set to 0 then we just use the old model with single thread.

Returns:

setTcpPostParsingThreadPoolSize

public void setTcpPostParsingThreadPoolSize(int tcpPostParsingThreadPoolSize)
If all calls are occurring on a single TCP socket then the stack would process them in single thread. This property allows immediately after parsing to split the load into many threads which increases the performance significantly. If set to 0 then we just use the old model with single thread.

Parameters:
tcpPostParsingThreadPoolSize -

setThreadPoolSize

public void setThreadPoolSize(int size)
Set the thread pool size for processing incoming UDP messages. Limit the total number of threads for processing udp messages.

Parameters:
size - -- the thread pool size.

setMaxConnections

public void setMaxConnections(int nconnections)
Set the max # of simultaneously handled TCP connections.

Parameters:
nconnections - -- the number of connections to handle.

getNextHop

public Hop getNextHop(SIPRequest sipRequest)
               throws SipException
Get the default route string.

Parameters:
sipRequest - is the request for which we want to compute the next hop.
Throws:
SipException

setStackName

public void setStackName(String stackName)
Set the descriptive name of the stack.

Parameters:
stackName - -- descriptive name of the stack.

setHostAddress

protected void setHostAddress(String stackAddress)
                       throws UnknownHostException
Set my address.

Parameters:
stackAddress - -- A string containing the stack address.
Throws:
UnknownHostException

getHostAddress

public String getHostAddress()
Deprecated. 

Get my address.

Returns:
hostAddress - my host address or null if no host address is defined.

setRouter

protected void setRouter(Router router)
Set the router algorithm. This is meant for routing messages out of dialog or for non-sip uri's.

Parameters:
router - A class that implements the Router interface.

getRouter

public Router getRouter(SIPRequest request)
Get the router algorithm.

Returns:
Router router

getRouter

public Router getRouter()

isAlive

public boolean isAlive()
return the status of the toExit flag.

Returns:
true if the stack object is alive and false otherwise.

addMessageProcessor

protected void addMessageProcessor(MessageProcessor newMessageProcessor)
                            throws IOException
Adds a new MessageProcessor to the list of running processors for this SIPStack and starts it. You can use this method for dynamic stack configuration.

Throws:
IOException

removeMessageProcessor

protected void removeMessageProcessor(MessageProcessor oldMessageProcessor)
Removes a MessageProcessor from this SIPStack.

Parameters:
oldMessageProcessor -

getMessageProcessors

protected MessageProcessor[] getMessageProcessors()
Gets an array of running MessageProcessors on this SIPStack. Acknowledgement: Jeff Keyser suggested that applications should have access to the running message processors and contributed this code.

Returns:
an array of running message processors.

createMessageProcessor

protected MessageProcessor createMessageProcessor(InetAddress ipAddress,
                                                  int port,
                                                  String transport)
                                           throws IOException
Creates the equivalent of a JAIN listening point and attaches to the stack.

Parameters:
ipAddress - -- ip address for the listening point.
port - -- port for the listening point.
transport - -- transport for the listening point.
Throws:
IOException

setMessageFactory

protected void setMessageFactory(StackMessageFactory messageFactory)
Set the message factory.

Parameters:
messageFactory - -- messageFactory to set.

createRawMessageChannel

public MessageChannel createRawMessageChannel(String sourceIpAddress,
                                              int sourcePort,
                                              Hop nextHop)
                                       throws UnknownHostException
Creates a new MessageChannel for a given Hop.

Parameters:
sourceIpAddress - - Ip address of the source of this message.
sourcePort - - source port of the message channel to be created.
nextHop - Hop to create a MessageChannel to.
Returns:
A MessageChannel to the specified Hop, or null if no MessageProcessors support contacting that Hop.
Throws:
UnknownHostException - If the host in the Hop doesn't exist.

isEventForked

public boolean isEventForked(String ename)
Return true if a given event can result in a forked subscription. The stack is configured with a set of event names that can result in forked subscriptions.

Parameters:
ename - -- event name to check.

getAddressResolver

public AddressResolver getAddressResolver()
get the address resolver interface.

Returns:
-- the registered address resolver.

setAddressResolver

public void setAddressResolver(AddressResolver addressResolver)
Set the address resolution interface

Parameters:
addressResolver - -- the address resolver to set.

setLogRecordFactory

public void setLogRecordFactory(LogRecordFactory logRecordFactory)
Set the logger factory.

Parameters:
logRecordFactory - -- the log record factory to set.

getThreadAuditor

public ThreadAuditor getThreadAuditor()
get the thread auditor object

Returns:
-- the thread auditor of the stack

auditStack

public String auditStack(Set activeCallIDs,
                         long leakedDialogTimer,
                         long leakedTransactionTimer)
Audits the SIP Stack for leaks

Returns:
Audit report, null if no leaks were found

setNon2XXAckPassedToListener

public void setNon2XXAckPassedToListener(boolean passToListener)

isNon2XXAckPassedToListener

public boolean isNon2XXAckPassedToListener()
Returns:
the non2XXAckPassedToListener

getActiveClientTransactionCount

public int getActiveClientTransactionCount()
Get the count of client transactions that is not in the completed or terminated state.

Returns:
the activeClientTransactionCount

isRfc2543Supported

public boolean isRfc2543Supported()

isCancelClientTransactionChecked

public boolean isCancelClientTransactionChecked()

isRemoteTagReassignmentAllowed

public boolean isRemoteTagReassignmentAllowed()

getDialogs

public Collection<Dialog> getDialogs()
This method is slated for addition to the next spec revision.

Returns:
-- the collection of dialogs that is being managed by the stack.

getDialogs

public Collection<Dialog> getDialogs(DialogState state)
Returns:
-- the collection of dialogs matching the state that is being managed by the stack.

getReplacesDialog

public Dialog getReplacesDialog(ReplacesHeader replacesHeader)
Get the Replaced Dialog from the stack.

Parameters:
replacesHeader - -- the header that references the dialog being replaced.

getJoinDialog

public Dialog getJoinDialog(JoinHeader joinHeader)
Get the Join Dialog from the stack.

Parameters:
joinHeader - -- the header that references the dialog being joined.

setTimer

public void setTimer(SipTimer timer)
Parameters:
timer - the timer to set

getTimer

public SipTimer getTimer()
                  throws IllegalStateException
Returns:
the timer
Throws:
IllegalStateException

getReceiveUdpBufferSize

public int getReceiveUdpBufferSize()
Size of the receive UDP buffer. This property affects performance under load. Bigger buffer is better under load.

Returns:

setReceiveUdpBufferSize

public void setReceiveUdpBufferSize(int receiveUdpBufferSize)
Size of the receive UDP buffer. This property affects performance under load. Bigger buffer is better under load.


getSendUdpBufferSize

public int getSendUdpBufferSize()
Size of the send UDP buffer. This property affects performance under load. Bigger buffer is better under load.

Returns:

setSendUdpBufferSize

public void setSendUdpBufferSize(int sendUdpBufferSize)
Size of the send UDP buffer. This property affects performance under load. Bigger buffer is better under load.


checkBranchId

public boolean checkBranchId()
Flag that reqests checking of branch IDs on responses.

Returns:

setLogStackTraceOnMessageSend

public void setLogStackTraceOnMessageSend(boolean logStackTraceOnMessageSend)
Parameters:
logStackTraceOnMessageSend - the logStackTraceOnMessageSend to set

isLogStackTraceOnMessageSend

public boolean isLogStackTraceOnMessageSend()
Returns:
the logStackTraceOnMessageSend

setDeliverDialogTerminatedEventForNullDialog

public void setDeliverDialogTerminatedEventForNullDialog()

addForkedClientTransaction

public void addForkedClientTransaction(SIPClientTransaction clientTransaction)

getForkedTransaction

public SIPClientTransaction getForkedTransaction(String transactionId)

setDeliverUnsolicitedNotify

public void setDeliverUnsolicitedNotify(boolean deliverUnsolicitedNotify)
Parameters:
deliverUnsolicitedNotify - the deliverUnsolicitedNotify to set

isDeliverUnsolicitedNotify

public boolean isDeliverUnsolicitedNotify()
Returns:
the deliverUnsolicitedNotify

setDeliverTerminatedEventForAck

public void setDeliverTerminatedEventForAck(boolean deliverTerminatedEventForAck)
Parameters:
deliverTerminatedEventForAck - the deliverTerminatedEventForAck to set

isDeliverTerminatedEventForAck

public boolean isDeliverTerminatedEventForAck()
Returns:
the deliverTerminatedEventForAck

getMinKeepAliveInterval

public long getMinKeepAliveInterval()

setMaxForkTime

public void setMaxForkTime(int maxForkTime)
Parameters:
maxForkTime - the maxForkTime to set

getMaxForkTime

public int getMaxForkTime()
Returns:
the maxForkTime

isDeliverRetransmittedAckToListener

public boolean isDeliverRetransmittedAckToListener()
This is a testing interface. Normally the application does not see retransmitted ACK for 200 OK retransmissions.

Returns:

getAckTimeoutFactor

public int getAckTimeoutFactor()
Get the dialog timeout counter.

Returns:

getSipListener

public abstract SipListener getSipListener()

getReinviteExecutor

public ExecutorService getReinviteExecutor()
Executor used to optimize the ReinviteSender Runnable in the sendRequest of the SipDialog


setMessageParserFactory

public void setMessageParserFactory(MessageParserFactory messageParserFactory)
Parameters:
messageParserFactory - the messageParserFactory to set

getMessageParserFactory

public MessageParserFactory getMessageParserFactory()
Returns:
the messageParserFactory

setMessageProcessorFactory

public void setMessageProcessorFactory(MessageProcessorFactory messageProcessorFactory)
Parameters:
messageProcessorFactory - the messageProcessorFactory to set

getMessageProcessorFactory

public MessageProcessorFactory getMessageProcessorFactory()
Returns:
the messageProcessorFactory

setAggressiveCleanup

public void setAggressiveCleanup(boolean aggressiveCleanup)
Parameters:
aggressiveCleanup - the aggressiveCleanup to set

isAggressiveCleanup

public boolean isAggressiveCleanup()
Returns:
the aggressiveCleanup

getEarlyDialogTimeout

public int getEarlyDialogTimeout()

setClientAuth

public void setClientAuth(ClientAuthType clientAuth)
Parameters:
clientAuth - the clientAuth to set

getClientAuth

public ClientAuthType getClientAuth()
Returns:
the clientAuth

setThreadPriority

public void setThreadPriority(int threadPriority)
Parameters:
threadPriority - the threadPriority to set

getThreadPriority

public int getThreadPriority()
Returns:
the threadPriority

getReliableConnectionKeepAliveTimeout

public int getReliableConnectionKeepAliveTimeout()

setReliableConnectionKeepAliveTimeout

public void setReliableConnectionKeepAliveTimeout(int reliableConnectionKeepAliveTimeout)

setKeepAliveTimeout

public boolean setKeepAliveTimeout(String myAddress,
                                   int myPort,
                                   String transport,
                                   String peerAddress,
                                   int peerPort,
                                   long keepAliveTimeout)
Find suitable MessageProcessor and calls it's MessageProcessor#setKeepAliveTimeout(String, int, long) method passing peerAddress and peerPort as arguments.

Parameters:
myAddress - - server ip address
myPort - - server port
transport - - transport
peerAddress - - peerAddress
peerPort - - peerPort
Returns:
result of invocation of MessageProcessor#setKeepAliveTimeout(String, int, long) if MessageProcessor was found

closeReliableConnection

public boolean closeReliableConnection(String myAddress,
                                       int myPort,
                                       String transport,
                                       String peerAddress,
                                       int peerPort)
Find suitable MessageProcessor and calls it's MessageProcessor#closeReliableConnection(String, int) method passing peerAddress and peerPort as arguments.

Parameters:
myAddress - - server ip address
myPort - - server port
transport - - transport
peerAddress - - peerAddress
peerPort - - peerPort

getSslHandshakeTimeout

public long getSslHandshakeTimeout()
Returns:
the sslHandshakeTimeout

setSslHandshakeTimeout

public void setSslHandshakeTimeout(long sslHandshakeTimeout)
Parameters:
sslHandshakeTimeout - the sslHandshakeTimeout to set

setEarlyDialogTimeout

public void setEarlyDialogTimeout(int earlyDialogTimeout)
Parameters:
earlyDialogTimeout - the earlyDialogTimeout to set

getMaxTxLifetimeInvite

public int getMaxTxLifetimeInvite()
Returns:
the maxTxLifetimeInvite

setMaxTxLifetimeInvite

public void setMaxTxLifetimeInvite(int maxTxLifetimeInvite)
Parameters:
maxTxLifetimeInvite - the maxTxLifetimeInvite to set

getMaxTxLifetimeNonInvite

public int getMaxTxLifetimeNonInvite()
Returns:
the maxTxLifetimeNonInvite

setMaxTxLifetimeNonInvite

public void setMaxTxLifetimeNonInvite(int maxTxLifetimeNonInvite)
Parameters:
maxTxLifetimeNonInvite - the maxTxLifetimeNonInvite to set


Copyright © 2012. All Rights Reserved.