Adds a transaction layer to the
SIPMessageStack class. This
is done by
replacing the normal MessageChannels returned by the base class with
transaction-aware MessageChannels that encapsulate the original channels
and handle the transaction state machine, retransmissions, etc.
This code is in the public domain. version: JAIN-SIP-1.1
Inner Class :class TransactionScanner implements Runnable
createClientTransaction(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.
createMessageChannel(Hop nextHop) 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.
createMessageChannel(MessageChannel rawChannel) Creates a client transaction from a raw channel.
Parameters: rawChannel - is the transport channel to encapsulate.
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.
findSubscribeTransaction(Request notifyMessage) Finds a matching client SUBSCRIBE to the incoming notify.
NOTIFY requests are matched to such SUBSCRIBE requests if they
contain the same "Call-ID", a "ToHeader" header "tag" parameter which
matches the "FromHeader" header "tag" parameter of the SUBSCRIBE, and the
same "Event" header field.
findTransaction(Message sipMessage, boolean isServer) Finds the transaction corresponding to a given request.
Parameters: sipMessage - request for which to retrieve the transaction. Parameters: isServer - search the server transaction table if true.
newSIPServerRequest(Request requestReceived, MessageChannel requestMessageChannel) Handles a new SIP request.
It finds a server transaction to handle
this message.
newSIPServerResponse(Response responseReceived, MessageChannel responseMessageChannel) Handles a new SIP response.
It finds a client transaction to handle
this message.
public void
putDialog(Dialog dialog) Puts a dialog into the dialog table.
Construcor for the stack. Registers the request and response
factories for the stack.
Parameters: messageFactory - User-implemented factory for processingmessages.
Method Detail
addExtensionMethod
public void addExtensionMethod(String extensionMethod)(Code)
Adds an extension method.
Parameters: extensionMethod - -- extension method to support for dialogcreation
Adds a new client transaction to the set of existing transactions.
Parameters: serverTransaction - -- server transaction to add to the set.
allowDialogStateChange
public boolean allowDialogStateChange(String method)(Code)
Returns true if method can change dialog state.
Parameters: method - the name of the method used for create true if extension is supported and false otherwise.
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. the requested client transaction
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. the requested message channel
Creates a raw message channel. A raw message channel has no
transaction wrapper.
Parameters: hop - hop for which to create the raw message channel. the requested message channel
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. the requested server transaction
Gets the transaction to cancel. Search the server transaction
table for a transaction that matches the given transaction.
Parameters: cancelRequest - the request to be found Parameters: isServer - true if this is a server request the transaction object requested
Finds a matching client SUBSCRIBE to the incoming notify.
NOTIFY requests are matched to such SUBSCRIBE requests if they
contain the same "Call-ID", a "ToHeader" header "tag" parameter which
matches the "FromHeader" 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 - the request to be matched the new client transaction object
Finds the transaction corresponding to a given request.
Parameters: sipMessage - request for which to retrieve the transaction. Parameters: isServer - search the server transaction table if true. the transaction object corresponding to the request or nullif no such mapping exists.
Returns 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. the Dialog object for the requested id
isDialogCreated
public boolean isDialogCreated(String method)(Code)
Returns true if extension is supported.
Parameters: method - the name of the method used for create true if extension is supported and false otherwise.
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. Parameters: requestMessageChannel - Channel that received message. A server transaction.
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. Parameters: responseMessageChannel - Channel that received message. A client transaction.