public class SIPServerTransactionImpl extends SIPTransactionImpl implements SIPServerTransaction
|INVITE
|pass INV to TU
INVITE V send 100 if TU won't in 200ms
send response+-----------+
+--------| |--------+101-199 from TU
| | Proceeding| |send response
+------->| |<-------+
| | Transport Err.
| | Inform TU
| |--------------->+
+-----------+ |
300-699 from TU | |2xx from TU |
send response | |send response |
| +------------------>+
| |
INVITE V Timer G fires |
send response+-----------+ send response |
+--------| |--------+ |
| | Completed | | |
+------->| |<-------+ |
+-----------+ |
| | |
ACK | | |
- | +------------------>+
| Timer H fires |
V or Transport Err.|
+-----------+ Inform TU |
| | |
| Confirmed | |
| | |
+-----------+ |
| |
|Timer I fires |
|- |
| |
V |
+-----------+ |
| | |
| Terminated|<---------------+
| |
+-----------+
Figure 7: INVITE server transaction
Request received
|pass to TU
V
+-----------+
| |
| Trying |-------------+
| | |
+-----------+ |200-699 from TU
| |send response
|1xx from TU |
|send response |
| |
Request V 1xx from TU |
send response+-----------+send response|
+--------| |--------+ |
| | Proceeding| | |
+------->| |<-------+ |
+<--------------| | |
|Trnsprt Err +-----------+ |
|Inform TU | |
| | |
| |200-699 from TU |
| |send response |
| Request V |
| send response+-----------+ |
| +--------| | |
| | | Completed |<------------+
| +------->| |
+<--------------| |
|Trnsprt Err +-----------+
|Inform TU |
| |Timer J fires
| |-
| |
| V
| +-----------+
| | |
+-------------->| Terminated|
| |
+-----------+
| Modifier and Type | Field and Description |
|---|---|
protected String |
dialogId |
protected boolean |
isAckSeen |
applicationData, auditTag, baseTimerInterval, collectionTime, encapsulatedChannel, expiresTimerTask, isMapped, lastResponse, mergeId, originalRequest, originalRequestBranch, originalRequestBytes, originalRequestCSeqNumber, originalRequestHasPort, sipStack, T2, T4, timeoutTimerTicksLeft, timerD, timerI, timerK, toListener, transactionId, transactionTimerStartedCONTENT_SUBTYPE_SDP, CONTENT_TYPE_APPLICATIONCALLING_STATE, COMPLETED_STATE, CONFIRMED_STATE, INITIAL_STATE, PROCEEDING_STATE, T1, TERMINATED_STATE, TIMER_A, TIMER_B, TIMER_F, TIMER_H, TIMER_J, TRYING_STATE| Modifier | Constructor and Description |
|---|---|
protected |
SIPServerTransactionImpl(SIPTransactionStack sipStack,
MessageChannel newChannelToUse)
Creates a new server transaction.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
ackSeen()
This is book-keeping for retransmission filter management.
|
void |
cleanUp() |
protected void |
cleanUpOnTimer() |
void |
disableRetransmissionAlerts()
Disable retransmission Alerts and cancel associated timers.
|
void |
enableRetransmissionAlerts()
Enable the timeout retransmit notifications for the ServerTransaction.
|
boolean |
equals(Object other) |
void |
fireRetransmissionTimer()
Called by the transaction stack when a retransmission timer fires.
|
void |
fireTimeoutTimer()
This method is called when this transaction's timeout timer has fired.
|
SIPServerTransaction |
getCanceledInviteTransaction()
TODO -- this method has to be added to the api.
|
Dialog |
getDialog()
Gets the dialog object of this Transaction object.
|
int |
getLastResponseStatusCode()
Get the last response status code.
|
long |
getPendingReliableCSeqNumber() |
String |
getPendingReliableResponseMethod() |
long |
getPendingReliableRSeqNumber() |
protected int |
getRealState()
Return the book-keeping information that we actually use.
|
byte[] |
getReliableProvisionalResponse() |
MessageChannel |
getResponseChannel()
Returns this transaction.
|
TransactionState |
getState()
Gets the current state of this transaction.
|
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.
|
boolean |
isMessagePartOfTransaction(SIPMessage messageToTest)
Tests a message to see if it is part of this transaction.
|
boolean |
isRetransmissionAlertEnabled() |
void |
map()
Send out a trying response (only happens when the transaction is mapped).
|
boolean |
prackRecieved()
Cancel the retransmit timer for the provisional response task.
|
void |
processRequest(SIPRequest transactionRequest,
MessageChannel sourceChannel)
Process a new request message through this transaction.
|
void |
releaseSem()
Release the transaction semaphore.
|
void |
resendLastResponseAsBytes() |
void |
scheduleAckRemoval() |
void |
sendMessage(SIPMessage messageToSend)
Process the message through the transaction and sends it to the SIP peer.
|
void |
sendReliableProvisionalResponse(Response relResponse) |
void |
sendResponse(Response response)
Sends the Response to a Request which is associated with this
ServerTransaction.
|
protected void |
sendResponse(SIPResponse transactionResponse)
Send a response.
|
void |
setAckSeen()
This is book-keeping for retransmission filter management.
|
void |
setDialog(SIPDialog sipDialog,
String dialogId)
set the dialog object.
|
void |
setInviteTransaction(SIPServerTransaction st)
The INVITE Server Transaction corresponding to a CANCEL Server Transaction.
|
void |
setMapped(boolean b) |
void |
setOriginalRequest(SIPRequest originalRequest)
Sets the request message that this transaction handles.
|
void |
setPendingSubscribe(SIPClientTransaction pendingSubscribeClientTx) |
void |
setRequestInterface(ServerRequestInterface newRequestOf)
Sets the real RequestInterface this transaction encapsulates.
|
void |
setState(int newState)
Changes the state of this transaction.
|
void |
startTransactionTimer()
Start the timer that runs the transaction state machine.
|
protected void |
startTransactionTimerJ(long time)
Start the timer task.
|
void |
terminate()
Terminate this transaction and immediately release all stack resources
associated with it.
|
void |
waitForTermination() |
acquireSem, addEventListener, cancelMaxTxLifeTimeTimer, close, disableRetransmissionTimer, disableTimeoutTimer, doesCancelMatchTransaction, enableRetransmissionTimer, enableRetransmissionTimer, enableTimeoutTimer, extractCertIdentities, fireTimer, getApplicationData, getAuditTag, getBaseTimerInterval, getBranch, getBranchId, getCipherSuite, getCSeq, getForkId, getHost, getInternalState, getKey, getLastResponse, getLocalCertificates, getMergeId, getMessageChannel, getMessageProcessor, getMethod, getOriginalRequest, getPeerAddress, getPeerCertificates, getPeerInetAddress, getPeerPacketSourceAddress, getPeerPacketSourcePort, getPeerPort, getPeerProtocol, getPort, getRequest, getResponse, getRetransmitTimer, getSipProvider, getSIPStack, getT2, getT4, getTimerD, getTimerI, getTimerK, getTimerT2, getTimerT4, getTransactionId, getTransport, getViaHeader, hashCode, isByeTransaction, isCancelTransaction, isDialogCreatingTransaction, isInviteTransaction, isReleaseReferences, isReliable, isSecure, isServerTransaction, isTerminated, isTransactionMapped, passToListener, raiseErrorEvent, raiseIOExceptionEvent, removeEventListener, scheduleMaxTxLifeTimeTimer, semRelease, sendMessage, setApplicationData, setAuditTag, setBranch, setCollectionTime, setEncapsulatedChannel, setForkId, setPassToListener, setReleaseReferences, setRetransmitTimer, setTimerD, setTimerT2, setTimerT4, setTransactionMapped, testAndSetTransactionTerminatedEventclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitisTransactionMapped, setTransactionMappedacquireSem, addEventListener, cancelMaxTxLifeTimeTimer, close, disableRetransmissionTimer, disableTimeoutTimer, doesCancelMatchTransaction, extractCertIdentities, fireTimer, getApplicationData, getAuditTag, getBaseTimerInterval, getBranch, getBranchId, getCipherSuite, getCSeq, getForkId, getHost, getInternalState, getKey, getLastResponse, getLocalCertificates, getMergeId, getMessageChannel, getMessageProcessor, getMethod, getOriginalRequest, getPeerAddress, getPeerCertificates, getPeerPacketSourceAddress, getPeerPacketSourcePort, getPeerPort, getPeerProtocol, getPort, getRequest, getResponse, getRetransmitTimer, getSipProvider, getSIPStack, getT2, getT4, getTimerD, getTimerI, getTimerK, getTimerT2, getTimerT4, getTransactionId, getTransport, getViaHeader, hashCode, isByeTransaction, isCancelTransaction, isDialogCreatingTransaction, isInviteTransaction, isReleaseReferences, isReliable, isSecure, isServerTransaction, isTerminated, passToListener, raiseErrorEvent, raiseIOExceptionEvent, removeEventListener, scheduleMaxTxLifeTimeTimer, semRelease, setApplicationData, setAuditTag, setBranch, setCollectionTime, setEncapsulatedChannel, setForkId, setPassToListener, setReleaseReferences, setRetransmitTimer, setTimerD, setTimerT2, setTimerT4, testAndSetTransactionTerminatedEventprotected String dialogId
protected boolean isAckSeen
protected SIPServerTransactionImpl(SIPTransactionStack sipStack, MessageChannel newChannelToUse)
sipStack - Transaction stack this transaction belongs to.newChannelToUse - Channel to encapsulate.protected void sendResponse(SIPResponse transactionResponse) throws IOException
transactionResponse - -- the response to sendIOExceptionpublic void setRequestInterface(ServerRequestInterface newRequestOf)
SIPServerTransactionsetRequestInterface in interface SIPServerTransactionnewRequestOf - RequestInterface to send messages to.SIPServerTransaction.setRequestInterface(com.telestax.javax.sip.stack.ServerRequestInterface)public MessageChannel getResponseChannel()
SIPServerTransactiongetResponseChannel in interface SIPServerTransactionSIPServerTransaction.getResponseChannel()public boolean isMessagePartOfTransaction(SIPMessage messageToTest)
SIPTransactionisMessagePartOfTransaction in interface SIPServerTransactionisMessagePartOfTransaction in interface SIPTransactionisMessagePartOfTransaction in class SIPTransactionImplmessageToTest - Message to check if it is part of this transaction.SIPServerTransaction.isMessagePartOfTransaction(com.telestax.javax.sip.message.SIPMessage)public void map()
SIPServerTransactionmap in interface SIPServerTransactionSIPServerTransaction.map()public void processRequest(SIPRequest transactionRequest, MessageChannel sourceChannel)
SIPServerTransactionprocessRequest in interface ServerRequestInterfaceprocessRequest in interface SIPServerTransactiontransactionRequest - Request to process.sourceChannel - Channel that received this message.SIPServerTransaction.processRequest(com.telestax.javax.sip.message.SIPRequest, com.telestax.javax.sip.stack.MessageChannel)public void sendMessage(SIPMessage messageToSend) throws IOException
SIPTransactionsendMessage in interface SIPServerTransactionsendMessage in interface SIPTransactionsendMessage in class SIPTransactionImplmessageToSend - Message to send to the SIP peer.IOExceptionSIPServerTransaction.sendMessage(com.telestax.javax.sip.message.SIPMessage)public String getViaHost()
SIPTransactiongetViaHost in interface SIPServerTransactiongetViaHost in interface SIPTransactiongetViaHost in class SIPTransactionImplSIPServerTransaction.getViaHost()public int getViaPort()
SIPTransactiongetViaPort in interface SIPServerTransactiongetViaPort in interface SIPTransactiongetViaPort in class SIPTransactionImplSIPServerTransaction.getViaPort()public void fireRetransmissionTimer()
SIPTransactionfireRetransmissionTimer in interface SIPTransactionSIPTransaction.fireRetransmissionTimer()public void resendLastResponseAsBytes()
throws IOException
resendLastResponseAsBytes in interface SIPServerTransactionIOExceptionSIPServerTransaction.resendLastResponseAsBytes()public void fireTimeoutTimer()
SIPTransactionfireTimeoutTimer in interface SIPTransactionSIPTransaction.fireTimeoutTimer()public int getLastResponseStatusCode()
SIPServerTransactiongetLastResponseStatusCode in interface SIPServerTransactionSIPServerTransaction.getLastResponseStatusCode()public void setOriginalRequest(SIPRequest originalRequest)
SIPTransactionsetOriginalRequest in interface SIPServerTransactionsetOriginalRequest in interface SIPTransactionsetOriginalRequest in class SIPTransactionImploriginalRequest - Request being handled.SIPServerTransaction.setOriginalRequest(com.telestax.javax.sip.message.SIPRequest)public void sendResponse(Response response) throws SipException
ServerTransactionMessageFactory and
then passes that Response to this method. The Response message gets sent out on
the network via the ListeningPoint information that is associated with
the SipProvider of this ServerTransaction.
This method implies that the application is functioning as either a UAS or a stateful proxy, hence the underlying implementation acts statefully. When a UAS sends a 2xx response to an INVITE, the server transaction is transitions to the TerminatedState. The implementation may delay physically removing ServerTransaction record from memory to catch retransmissions of the INVITE in accordance with the reccomendation of http://bugs.sipit.net/show_bug.cgi?id=769 .
ACK Processing and final response retransmission:
If a Dialog is associated
with the ServerTransaction then when the UAC sends the ACK ( the typical case for User Agents),
the Application ( i.e. Listener )
will see a ServerTransaction corresponding to the ACK and the corresponding
Dialog presented to it. The ACK will be presented to the Listener only
once in this case. Retransmissions of the OK and filtering of ACK retransmission
are the responsibility of the Dialog layer of this specification. However
if no Dialog is associated with the INVITE Transaction, the ACK will be presented
to the Application with a null Dialog in the RequestEvent and there will be
no Dialog associated with the ACK Transaction
(i.e. Transaction.getDialog() returns null).
In this case (when there is no Dialog associated with the original INVITE or ACK)
the Application is responsible for retransmission
of the OK for the INVITE if necessary (i.e. if it wants to manage its own dialog layer and
function as a User Agent) and for dealing with retransmissions of the ACK. This
requires that the three way handshake of an INVITE is managed by the UAS
application and not the implementation of this specification.
Note that Responses created via Dialog.createReliableProvisionalResponse(int)
should be sent using Dialog.sendReliableProvisionalResponse(Response)
sendResponse in interface SIPServerTransactionsendResponse in interface ServerTransactionresponse - the Response to send to the Request.SipException - if the SipProvider cannot send the Response for any
other reason.SIPServerTransaction.sendResponse(javax.sip.message.Response)protected int getRealState()
public TransactionState getState()
SIPTransactiongetState in interface SIPServerTransactiongetState in interface SIPTransactiongetState in interface TransactiongetState in class SIPTransactionImplSIPServerTransaction.getState()public void setState(int newState)
SIPTransactionsetState in interface SIPServerTransactionsetState in interface SIPTransactionsetState in class SIPTransactionImplnewState - New state of this transaction.SIPServerTransaction.setState(int)public void startTransactionTimer()
SIPTransactionstartTransactionTimer in interface SIPTransactionSIPTransaction.startTransactionTimer()protected void startTransactionTimerJ(long time)
public boolean equals(Object other)
equals in interface SIPServerTransactionequals in class ObjectSIPServerTransaction.equals(java.lang.Object)public Dialog getDialog()
SIPTransactiongetDialog in interface SIPServerTransactiongetDialog in interface SIPTransactiongetDialog in interface TransactiongetDialog in class SIPTransactionImplSIPServerTransaction.getDialog()public void setDialog(SIPDialog sipDialog, String dialogId)
SIPTransactionsetDialog in interface SIPServerTransactionsetDialog in interface SIPTransactionsetDialog in class SIPTransactionImplsipDialog - --
the dialog to set.dialogId - --
the dialog id ot associate with the dialog.sSIPServerTransaction.setDialog(com.telestax.javax.sip.stack.SIPDialog, java.lang.String)public void terminate()
throws ObjectInUseException
Transactionterminate in interface SIPServerTransactionterminate in interface TransactionObjectInUseException - if the transaction cannot be terminated as
it is associated to a dialog.SIPServerTransaction.terminate()public void sendReliableProvisionalResponse(Response relResponse) throws SipException
sendReliableProvisionalResponse in interface SIPServerTransactionSipExceptionpublic byte[] getReliableProvisionalResponse()
getReliableProvisionalResponse in interface SIPServerTransactionSIPServerTransaction.getReliableProvisionalResponse()public boolean prackRecieved()
SIPServerTransactionprackRecieved in interface SIPServerTransactionSIPServerTransaction.prackRecieved()public void enableRetransmissionAlerts()
throws SipException
ServerTransactionTimeout.RETRANSMIT
until the application calls Transaction.terminate() or a
the listener receives a SipListener.processTransactionTerminated(TransactionTerminatedEvent) callback.
Note that the stack calls
SipListener.processTransactionTerminated(TransactionTerminatedEvent)asynchronously
after it removes the transaction some time after the Transaction state is set to
TransactionState.TERMINATED ;
after which, it maintains no record of the Transaction.enableRetransmissionAlerts in interface SIPServerTransactionenableRetransmissionAlerts in interface ServerTransactionSipException - if a Dialog is already associated with the ServerTransaction
when the method is called.SIPServerTransaction.enableRetransmissionAlerts()public boolean isRetransmissionAlertEnabled()
isRetransmissionAlertEnabled in interface SIPServerTransactionSIPServerTransaction.isRetransmissionAlertEnabled()public void disableRetransmissionAlerts()
SIPServerTransactiondisableRetransmissionAlerts in interface SIPServerTransactionSIPServerTransaction.disableRetransmissionAlerts()public void setAckSeen()
SIPServerTransactionsetAckSeen in interface SIPServerTransactionSIPServerTransaction.setAckSeen()public boolean ackSeen()
SIPServerTransactionackSeen in interface SIPServerTransactionSIPServerTransaction.ackSeen()public void setMapped(boolean b)
setMapped in interface SIPServerTransactionSIPServerTransaction.setMapped(boolean)public void setPendingSubscribe(SIPClientTransaction pendingSubscribeClientTx)
setPendingSubscribe in interface SIPServerTransactionSIPServerTransaction.setPendingSubscribe(com.telestax.javax.sip.stack.SIPClientTransaction)public void releaseSem()
SIPTransactionreleaseSem in interface SIPServerTransactionreleaseSem in interface SIPTransactionreleaseSem in class SIPTransactionImplSIPServerTransaction.releaseSem()public void setInviteTransaction(SIPServerTransaction st)
setInviteTransaction in interface SIPServerTransactionst - -- the invite server tx corresponding to the cancel server transaction.public SIPServerTransaction getCanceledInviteTransaction()
getCanceledInviteTransaction in interface ServerTransactionExtgetCanceledInviteTransaction in interface SIPServerTransactionpublic void scheduleAckRemoval()
throws IllegalStateException
scheduleAckRemoval in interface SIPServerTransactionIllegalStateExceptionSIPServerTransaction.scheduleAckRemoval()public void cleanUp()
cleanUp in interface SIPServerTransactioncleanUp in interface SIPTransactioncleanUp in class SIPTransactionImplSIPServerTransaction.cleanUp()protected void cleanUpOnTimer()
public String getPendingReliableResponseMethod()
getPendingReliableResponseMethod in interface SIPServerTransactionSIPServerTransaction.getPendingReliableResponseMethod()public long getPendingReliableCSeqNumber()
getPendingReliableCSeqNumber in interface SIPServerTransactionSIPServerTransaction.getPendingReliableCSeqNumber()public long getPendingReliableRSeqNumber()
getPendingReliableRSeqNumber in interface SIPServerTransactionSIPServerTransaction.getPendingReliableRSeqNumber()public void waitForTermination()
waitForTermination in interface SIPServerTransactionSIPServerTransaction.waitForTermination()Copyright © 2014. All Rights Reserved.