|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgov.nist.javax.sip.stack.MessageChannel
gov.nist.javax.sip.stack.SIPTransaction
public abstract class SIPTransaction
Abstract class to support both client and server transactions. Provides an encapsulation of a message channel, handles timer events, and creation of the Via header for a message.
Field Summary | |
---|---|
protected Object |
applicationData
|
long |
auditTag
|
protected int |
BASE_TIMER_INTERVAL
|
static TransactionState |
CALLING_STATE
CALLING State. |
protected int |
collectionTime
|
static TransactionState |
COMPLETED_STATE
Completed state. |
static TransactionState |
CONFIRMED_STATE
Confirmed state. |
gov.nist.javax.sip.stack.SIPClientTransaction.ExpiresTimerTask |
expiresTimerTask
|
static TransactionState |
INITIAL_STATE
Initialized but no state assigned. |
protected boolean |
isMapped
|
protected SIPResponse |
lastResponse
|
protected static int |
MAXIMUM_RETRANSMISSION_TICK_COUNT
Maximum number of ticks between retransmissions. |
protected String |
mergeId
|
protected SIPRequest |
originalRequest
|
protected String |
originalRequestBranch
|
protected byte[] |
originalRequestBytes
|
protected long |
originalRequestCSeqNumber
|
protected boolean |
originalRequestHasPort
|
static TransactionState |
PROCEEDING_STATE
Proceeding state. |
protected SIPTransactionStack |
sipStack
|
protected static int |
T1
One timer tick. |
protected int |
T2
The maximum retransmit interval for non-INVITE requests and INVITE responses |
protected int |
T4
5 sec Maximum duration a message will remain in the network |
static TransactionState |
TERMINATED_STATE
Terminated state. |
protected int |
timeoutTimerTicksLeft
|
protected static int |
TIMER_A
INVITE request retransmit interval, for UDP only |
protected static int |
TIMER_B
INVITE transaction timeout timer |
protected int |
TIMER_D
|
protected static int |
TIMER_F
|
protected static int |
TIMER_H
|
protected int |
TIMER_I
|
protected static int |
TIMER_J
|
protected int |
TIMER_K
|
protected boolean |
toListener
|
protected String |
transactionId
|
protected AtomicBoolean |
transactionTimerStarted
|
static TransactionState |
TRYING_STATE
Trying state. |
Fields inherited from class gov.nist.javax.sip.stack.MessageChannel |
---|
messageProcessor, useCount |
Constructor Summary | |
---|---|
protected |
SIPTransaction(SIPTransactionStack newParentStack,
MessageChannel newEncapsulatedChannel)
Transaction constructor. |
Method Summary | |
---|---|
boolean |
acquireSem()
A given tx can process only a single outstanding event at a time. |
void |
addEventListener(SIPTransactionEventListener newListener)
Adds a new event listener to this transaction. |
void |
cancelMaxTxLifeTimeTimer()
|
abstract void |
cleanUp()
|
void |
close()
Close the encapsulated channel. |
protected void |
disableRetransmissionTimer()
Turns off retransmission events for this transaction. |
protected void |
disableTimeoutTimer()
Disabled the timeout timer. |
boolean |
doesCancelMatchTransaction(SIPRequest requestToTest)
A method that can be used to test if an incoming request belongs to this transction. |
protected void |
enableRetransmissionTimer()
Enables retransmission timer events for this transaction to begin in one tick. |
protected void |
enableRetransmissionTimer(int tickCount)
Enables retransmission timer events for this transaction to begin after the number of ticks passed to this routine. |
protected void |
enableTimeoutTimer(int tickCount)
Enables a timeout event to occur for this transaction after the number of ticks passed to this method. |
List<String> |
extractCertIdentities()
Extract identities from certificates exchanged over TLS, based on guidelines from rfc5922. |
protected abstract void |
fireRetransmissionTimer()
This method is called when this transaction's retransmission timer has fired. |
protected abstract void |
fireTimeoutTimer()
This method is called when this transaction's timeout timer has fired. |
Object |
getApplicationData()
Get the application data associated with this transaction. |
String |
getBranch()
Gets the current setting for the branch parameter of this transaction. |
String |
getBranchId()
Returns a unique branch identifer that identifies this transaction. |
String |
getCipherSuite()
Return the Cipher Suite that was used for the SSL handshake. |
long |
getCSeq()
Get the Sequence number of the request used to create the transaction. |
abstract Dialog |
getDialog()
Gets the dialog object of this Transaction object. |
String |
getForkId()
Retrieves the fork id for the transaction. |
String |
getHost()
Get the host of this message channel. |
int |
getInternalState()
Gets the current state of this transaction. |
String |
getKey()
Generate a key which identifies the message channel. |
SIPResponse |
getLastResponse()
Get the last response. |
Certificate[] |
getLocalCertificates()
Get the certificate(s) that were sent to the peer during handshaking. |
String |
getMergeId()
|
MessageChannel |
getMessageChannel()
Returns the message channel used for transmitting/receiving messages for this transaction. |
MessageProcessor |
getMessageProcessor()
Get the message processor. |
String |
getMethod()
Get the method of the request used to create this transaction. |
SIPRequest |
getOriginalRequest()
Gets the request being handled by this transaction. |
String |
getPeerAddress()
Get the peer address of the machine that sent us this message. |
Certificate[] |
getPeerCertificates()
|
protected InetAddress |
getPeerInetAddress()
|
InetAddress |
getPeerPacketSourceAddress()
|
int |
getPeerPacketSourcePort()
|
int |
getPeerPort()
Get the sender port ( the port of the other end that sent me the message). |
protected String |
getPeerProtocol()
|
int |
getPort()
Get port of this message channel. |
Request |
getRequest()
Get the original request but cast to a Request structure. |
Response |
getResponse()
Get the JAIN interface response |
int |
getRetransmitTimer()
Returns the current value of the retransmit timer in milliseconds used to retransmit messages over unreliable transports. |
SipProviderImpl |
getSipProvider()
Return the SipProvider for which the transaction is assigned. |
SIPTransactionStack |
getSIPStack()
Get the SIPStack object from this message channel. |
TransactionState |
getState()
Gets the current state of this transaction. |
int |
getTimerD()
Sets the value of Timer D (in ms) |
int |
getTimerT2()
Retrieve the value of Timer T2 (in ms) |
int |
getTimerT4()
Retrieve the value of Timer T4 (in ms) |
String |
getTransactionId()
Get the transaction Id. |
String |
getTransport()
Get transport string of this message channel. |
Via |
getViaHeader()
Returns the Via header for this channel. |
String |
getViaHost()
Get the host to assign for an outgoing Request via header. |
int |
getViaPort()
Get the port to assign for the via header of an outgoing message. |
int |
hashCode()
Hashcode method for fast hashtable lookup. |
boolean |
isByeTransaction()
Return a flag that states if this is a BYE transaction. |
boolean |
isCancelTransaction()
Return true if the transaction corresponds to a CANCEL message. |
boolean |
isDialogCreatingTransaction()
Returns a flag stating whether this transaction is for a request that creates a dialog. |
boolean |
isInviteTransaction()
Returns a flag stating whether this transaction is for an INVITE request or not. |
abstract boolean |
isMessagePartOfTransaction(SIPMessage messageToTest)
Tests a message to see if it is part of this transaction. |
boolean |
isReleaseReferences()
retrieve the value of release references to know if the stack performs optimizations on cleanup to save on memory |
boolean |
isReliable()
Get whether this channel is reliable or not. |
boolean |
isSecure()
Return true if this is a secure channel. |
protected boolean |
isServerTransaction()
A shortcut way of telling if we are a server transaction. |
boolean |
isTerminated()
Tests if this transaction has terminated. |
boolean |
passToListener()
Set true to pass the request up to the listener. |
protected void |
raiseErrorEvent(int errorEventID)
Creates a SIPTransactionErrorEvent and sends it to all of the listeners of this transaction. |
void |
raiseIOExceptionEvent()
Raise an IO Exception event - this is used for reporting asynchronous IO Exceptions that are attributable to this transaction. |
void |
releaseSem()
Release the transaction semaphore. |
void |
removeEventListener(SIPTransactionEventListener oldListener)
Removed an event listener from this transaction. |
protected void |
scheduleMaxTxLifeTimeTimer()
|
protected void |
semRelease()
|
protected void |
sendMessage(byte[] messageBytes,
InetAddress receiverAddress,
int receiverPort,
boolean retry)
Parse the byte array as a message, process it through the transaction, and send it to the SIP peer. |
void |
sendMessage(SIPMessage messageToSend)
Process the message through the transaction and sends it to the SIP peer. |
void |
setApplicationData(Object applicationData)
Set the application data pointer. |
void |
setBranch(String newBranch)
Sets the Via header branch parameter used to identify this transaction. |
abstract void |
setDialog(SIPDialog sipDialog,
String dialogId)
set the dialog object. |
void |
setEncapsulatedChannel(MessageChannel messageChannel)
Set the encapsuated channel. |
void |
setForkId(String forkId)
Sets the fork id for the transaction. |
void |
setOriginalRequest(SIPRequest newOriginalRequest)
Sets the request message that this transaction handles. |
void |
setPassToListener()
Set the passToListener flag to true. |
void |
setReleaseReferences(boolean releaseReferences)
If set to true it will release all references that it no longer needs. |
void |
setRetransmitTimer(int retransmitTimer)
Sets the value of the retransmit timer to the newly supplied timer value. |
void |
setState(int newState)
Changes the state of this transaction. |
void |
setTimerD(int interval)
Sets the value of Timer D (in ms) |
void |
setTimerT2(int interval)
Sets the value of Timer T2 (in ms) |
void |
setTimerT4(int interval)
Sets the value of Timer T4 (in ms) |
protected abstract void |
startTransactionTimer()
Start the timer that runs the transaction state machine. |
protected boolean |
testAndSetTransactionTerminatedEvent()
Flag to test if the terminated event is delivered. |
Methods inherited from class gov.nist.javax.sip.stack.MessageChannel |
---|
createBadReqRes, getEncapsulatedClientTransaction, getHostPort, getKey, getKey, getPeerHostPort, getRawIpSourceAddress, getViaHostPort, logMessage, logResponse, sendMessage, sendMessage, setEncapsulatedClientTransaction, uncache |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.sip.Transaction |
---|
terminate |
Field Detail |
---|
protected boolean toListener
protected int BASE_TIMER_INTERVAL
protected int T4
protected int T2
protected int TIMER_I
protected int TIMER_K
protected int TIMER_D
protected static final int T1
protected static final int TIMER_A
protected static final int TIMER_B
protected static final int TIMER_J
protected static final int TIMER_F
protected static final int TIMER_H
protected transient Object applicationData
protected SIPResponse lastResponse
protected boolean isMapped
protected String transactionId
public long auditTag
public static final TransactionState INITIAL_STATE
public static final TransactionState TRYING_STATE
public static final TransactionState CALLING_STATE
public static final TransactionState PROCEEDING_STATE
public static final TransactionState COMPLETED_STATE
public static final TransactionState CONFIRMED_STATE
public static final TransactionState TERMINATED_STATE
protected static final int MAXIMUM_RETRANSMISSION_TICK_COUNT
protected transient SIPTransactionStack sipStack
protected SIPRequest originalRequest
protected byte[] originalRequestBytes
protected long originalRequestCSeqNumber
protected String originalRequestBranch
protected boolean originalRequestHasPort
protected AtomicBoolean transactionTimerStarted
protected int timeoutTimerTicksLeft
protected int collectionTime
protected String mergeId
public gov.nist.javax.sip.stack.SIPClientTransaction.ExpiresTimerTask expiresTimerTask
Constructor Detail |
---|
protected SIPTransaction(SIPTransactionStack newParentStack, MessageChannel newEncapsulatedChannel)
newParentStack
- Parent stack for this transaction.newEncapsulatedChannel
- Underlying channel for this transaction.Method Detail |
---|
public String getBranchId()
Transaction
getBranchId
in interface Transaction
public abstract void cleanUp()
public void setOriginalRequest(SIPRequest newOriginalRequest)
newOriginalRequest
- Request being handled.public SIPRequest getOriginalRequest()
public Request getRequest()
getRequest
in interface Transaction
public final boolean isDialogCreatingTransaction()
public final boolean isInviteTransaction()
public final boolean isCancelTransaction()
public final boolean isByeTransaction()
public MessageChannel getMessageChannel()
public final void setBranch(String newBranch)
newBranch
- New string used as the branch for this transaction.public final String getBranch()
public final String getMethod()
public final long getCSeq()
public void setState(int newState)
newState
- New state of this transaction.public int getInternalState()
public TransactionState getState()
getState
in interface Transaction
protected final void enableRetransmissionTimer()
protected final void enableRetransmissionTimer(int tickCount)
tickCount
- Number of ticks before the next retransmission timer event
occurs.protected final void disableRetransmissionTimer()
protected final void enableTimeoutTimer(int tickCount)
tickCount
- Number of ticks before this transaction times out.protected final void disableTimeoutTimer()
public final boolean isTerminated()
public String getHost()
MessageChannel
getHost
in interface TransactionExt
getHost
in class MessageChannel
public String getKey()
MessageChannel
getKey
in class MessageChannel
public int getPort()
MessageChannel
getPort
in interface TransactionExt
getPort
in class MessageChannel
public SIPTransactionStack getSIPStack()
MessageChannel
getSIPStack
in class MessageChannel
public String getPeerAddress()
MessageChannel
getPeerAddress
in interface TransactionExt
getPeerAddress
in class MessageChannel
public int getPeerPort()
MessageChannel
getPeerPort
in interface TransactionExt
getPeerPort
in class MessageChannel
public int getPeerPacketSourcePort()
getPeerPacketSourcePort
in class MessageChannel
public InetAddress getPeerPacketSourceAddress()
getPeerPacketSourceAddress
in class MessageChannel
protected InetAddress getPeerInetAddress()
getPeerInetAddress
in class MessageChannel
protected String getPeerProtocol()
getPeerProtocol
in class MessageChannel
public String getTransport()
MessageChannel
getTransport
in interface TransactionExt
getTransport
in class MessageChannel
public boolean isReliable()
MessageChannel
isReliable
in class MessageChannel
public Via getViaHeader()
getViaHeader
in class MessageChannel
public void sendMessage(SIPMessage messageToSend) throws IOException
sendMessage
in class MessageChannel
messageToSend
- Message to send to the SIP peer.
IOException
protected void sendMessage(byte[] messageBytes, InetAddress receiverAddress, int receiverPort, boolean retry) throws IOException
sendMessage
in class MessageChannel
messageBytes
- Bytes of the message to send.receiverAddress
- Address of the target peer.receiverPort
- Network port of the target peer.
IOException
- If called.public void addEventListener(SIPTransactionEventListener newListener)
newListener
- Listener to add.public void removeEventListener(SIPTransactionEventListener oldListener)
oldListener
- Listener to remove.protected void raiseErrorEvent(int errorEventID)
errorEventID
- ID of the error to raise.protected boolean isServerTransaction()
public abstract Dialog getDialog()
getDialog
in interface Transaction
Dialog
public abstract void setDialog(SIPDialog sipDialog, String dialogId)
sipDialog
- --
the dialog to set.dialogId
- --
the dialog id ot associate with the dialog.spublic int getRetransmitTimer()
getRetransmitTimer
in interface Transaction
public String getViaHost()
getViaHost
in class MessageChannel
public SIPResponse getLastResponse()
public Response getResponse()
public String getTransactionId()
public int hashCode()
hashCode
in class Object
public int getViaPort()
getViaPort
in class MessageChannel
public boolean doesCancelMatchTransaction(SIPRequest requestToTest)
requestToTest
- is the request to test.
public void setRetransmitTimer(int retransmitTimer)
setRetransmitTimer
in interface Transaction
retransmitTimer
- -
the new integer value of the retransmit timer in milliseconds.public void close()
close
in class MessageChannel
public boolean isSecure()
MessageChannel
isSecure
in class MessageChannel
public MessageProcessor getMessageProcessor()
MessageChannel
getMessageProcessor
in class MessageChannel
public void setApplicationData(Object applicationData)
setApplicationData
in interface Transaction
applicationData
- --
application data pointer to set. null clears the applicationd
data pointer.public Object getApplicationData()
getApplicationData
in interface Transaction
public void setEncapsulatedChannel(MessageChannel messageChannel)
public SipProviderImpl getSipProvider()
getSipProvider
in interface TransactionExt
public void raiseIOExceptionEvent()
public boolean acquireSem()
public void releaseSem()
protected void semRelease()
public boolean passToListener()
public void setPassToListener()
protected boolean testAndSetTransactionTerminatedEvent()
public String getCipherSuite() throws UnsupportedOperationException
TransactionExt
getCipherSuite
in interface TransactionExt
UnsupportedOperationException
public Certificate[] getLocalCertificates() throws UnsupportedOperationException
TransactionExt
getLocalCertificates
in interface TransactionExt
UnsupportedOperationException
public Certificate[] getPeerCertificates() throws SSLPeerUnverifiedException
getPeerCertificates
in interface TransactionExt
SSLPeerUnverifiedException
public List<String> extractCertIdentities() throws SSLPeerUnverifiedException
extractCertIdentities
in interface TransactionExt
SSLPeerUnverifiedException
protected abstract void startTransactionTimer()
public abstract boolean isMessagePartOfTransaction(SIPMessage messageToTest)
protected abstract void fireRetransmissionTimer()
protected abstract void fireTimeoutTimer()
public boolean isReleaseReferences()
TransactionExt
isReleaseReferences
in interface TransactionExt
public void setReleaseReferences(boolean releaseReferences)
TransactionExt
setReleaseReferences
in interface TransactionExt
public int getTimerD()
TransactionExt
getTimerD
in interface TransactionExt
public int getTimerT2()
TransactionExt
getTimerT2
in interface TransactionExt
public int getTimerT4()
TransactionExt
getTimerT4
in interface TransactionExt
public void setTimerD(int interval)
TransactionExt
setTimerD
in interface TransactionExt
interval
- value of Timer D (in ms)public void setTimerT2(int interval)
TransactionExt
setTimerT2
in interface TransactionExt
interval
- value of Timer T2 (in ms)public void setTimerT4(int interval)
TransactionExt
setTimerT4
in interface TransactionExt
interval
- value of Timer T4 (in ms)public void setForkId(String forkId)
forkId
- public String getForkId()
protected void scheduleMaxTxLifeTimeTimer()
public void cancelMaxTxLifeTimeTimer()
public String getMergeId()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |