public class SIPClientTransactionImpl extends SIPTransactionImpl implements SIPClientTransaction
|INVITE from TU Timer A fires |INVITE sent Reset A, V Timer B fires INVITE sent +-----------+ or Transport Err. +---------| |---------------+inform TU | | Calling | | +-------->| |-------------->| +-----------+ 2xx | | | 2xx to TU | | |1xx | 300-699 +---------------+ |1xx to TU | ACK sent | | | resp. to TU | 1xx V | | 1xx to TU -----------+ | | +---------| | | | | |Proceeding |-------------->| | +-------->| | 2xx | | +-----------+ 2xx to TU | | 300-699 | | | ACK sent, | | | resp. to TU| | | | | NOTE: | 300-699 V | | ACK sent +-----------+Transport Err. | transitions | +---------| |Inform TU | labeled with | | | Completed |-------------->| the event | +-------->| | | over the action | +-----------+ | to take | ˆ | | | | | Timer D fires | +--------------+ | - | | | V | +-----------+ | | | | | Terminated|<--------------+ | | +-----------+ Figure 5: INVITE client transaction |Request from TU |send request Timer E V send request +-----------+ +---------| |-------------------+ | | Trying | Timer F | +-------->| | or Transport Err.| +-----------+ inform TU | 200-699 | | | resp. to TU | |1xx | +---------------+ |resp. to TU | | | | | Timer E V Timer F | | send req +-----------+ or Transport Err. | | +---------| | inform TU | | | |Proceeding |------------------>| | +-------->| |-----+ | | +-----------+ |1xx | | | ˆ |resp to TU | | 200-699 | +--------+ | | resp. to TU | | | | | | V | | +-----------+ | | | | | | | Completed | | | | | | | +-----------+ | | ˆ | | | | | Timer K | +--------------+ | - | | | V | NOTE: +-----------+ | | | | transitions | Terminated|<------------------+ labeled with | | the event +-----------+ over the action to take Figure 6: non-INVITE client transaction
Modifier and Type | Class and Description |
---|---|
class |
SIPClientTransactionImpl.TransactionTimer |
applicationData, auditTag, baseTimerInterval, collectionTime, encapsulatedChannel, expiresTimerTask, isMapped, lastResponse, mergeId, originalRequest, originalRequestBranch, originalRequestBytes, originalRequestCSeqNumber, originalRequestHasPort, sipStack, T2, T4, timeoutTimerTicksLeft, timerD, timerI, timerK, toListener, transactionId, transactionTimerStarted
CALLING_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 |
SIPClientTransactionImpl(SIPTransactionStack newSIPStack,
MessageChannel newChannelToUse)
Creates a new client transaction.
|
Modifier and Type | Method and Description |
---|---|
void |
alertIfStillInCallingStateBy(int count)
Send a transaction timeout event to the application if Tx is still in Calling state in the
given time period ( in base timer interval count ) after sending request.
|
boolean |
checkFromTag(SIPResponse sipResponse)
Check if the From tag of the response matches the from tag of the original message.
|
void |
cleanUp() |
protected void |
cleanUpOnTerminated() |
protected void |
cleanUpOnTimer() |
void |
clearState()
This is called by the stack after a non-invite client transaction goes to completed state.
|
Request |
createAck()
Creates a new Ack message from the Request associated with this client
transaction.
|
Request |
createCancel()
Creates a new Cancel message from the Request associated with this client
transaction.
|
void |
fireRetransmissionTimer()
Called by the transaction stack when a retransmission timer fires.
|
void |
fireTimeoutTimer()
Called by the transaction stack when a timeout timer fires.
|
SIPDialog |
getDefaultDialog()
Get the default dialog that was originally assigned to the client transaction.
|
Dialog |
getDialog()
Gets the dialog object of this Transaction object.
|
SIPDialog |
getDialog(String dialogId) |
Hop |
getNextHop()
Reeturn the previously computed next hop (avoid computing it twice).
|
String |
getOriginalRequestCallId() |
Contact |
getOriginalRequestContact() |
Event |
getOriginalRequestEvent() |
String |
getOriginalRequestFromTag() |
String |
getOriginalRequestScheme() |
Via |
getOutgoingViaHeader()
get the via header for an outgoing request.
|
MessageChannel |
getRequestChannel()
Returns 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 |
isNotifyOnRetransmit() |
void |
processResponse(SIPResponse sipResponse,
MessageChannel incomingChannel)
This method is called prior to dialog assignment.
|
void |
processResponse(SIPResponse transactionResponse,
MessageChannel sourceChannel,
SIPDialog dialog)
Process a new response message through this transaction.
|
void |
sendMessage(SIPMessage messageToSend)
Process the message through the transaction and sends it to the SIP peer.
|
void |
sendRequest()
Sends the Request which created this ClientTransaction.
|
void |
setDialog(SIPDialog sipDialog,
String dialogId)
set the dialog object.
|
void |
setNextHop(Hop hop)
Set the next hop ( if it has already been computed).
|
void |
setNotifyOnRetransmit(boolean notifyOnRetransmit)
Set this flag if you want your Listener to get Timeout.RETRANSMIT notifications each time a
retransmission occurs.
|
void |
setResponseInterface(ServerResponseInterface newRespondTo)
Sets the real ResponseInterface this transaction encapsulates.
|
void |
setState(int newState)
Changes the state of this transaction.
|
void |
setViaHost(String host)
Set the port of the recipient.
|
void |
setViaPort(int port)
Set the port of the recipient.
|
void |
startTransactionTimer()
Start the timer task.
|
void |
stopExpiresTimer()
Stop the ExPIRES timer if it is running.
|
void |
terminate()
Terminate this transaction and immediately release all stack resources
associated with it.
|
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, getState, getT2, getT4, getTimerD, getTimerI, getTimerK, getTimerT2, getTimerT4, getTransactionId, getTransport, getViaHeader, hashCode, isByeTransaction, isCancelTransaction, isDialogCreatingTransaction, isInviteTransaction, isReleaseReferences, isReliable, isSecure, isServerTransaction, isTerminated, isTransactionMapped, passToListener, raiseErrorEvent, raiseIOExceptionEvent, releaseSem, removeEventListener, scheduleMaxTxLifeTimeTimer, semRelease, sendMessage, setApplicationData, setAuditTag, setBranch, setCollectionTime, setEncapsulatedChannel, setForkId, setOriginalRequest, setPassToListener, setReleaseReferences, setRetransmitTimer, setTimerD, setTimerT2, setTimerT4, setTransactionMapped, testAndSetTransactionTerminatedEvent
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
isSecure
acquireSem, 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, getState, getT2, getT4, getTimerD, getTimerI, getTimerK, getTimerT2, getTimerT4, getTransactionId, getTransport, getViaHeader, hashCode, isByeTransaction, isCancelTransaction, isDialogCreatingTransaction, isInviteTransaction, isReleaseReferences, isReliable, isSecure, isServerTransaction, isTerminated, isTransactionMapped, passToListener, raiseErrorEvent, raiseIOExceptionEvent, releaseSem, removeEventListener, scheduleMaxTxLifeTimeTimer, semRelease, setApplicationData, setAuditTag, setBranch, setCollectionTime, setEncapsulatedChannel, setForkId, setOriginalRequest, setPassToListener, setReleaseReferences, setRetransmitTimer, setTimerD, setTimerT2, setTimerT4, setTransactionMapped, testAndSetTransactionTerminatedEvent
protected SIPClientTransactionImpl(SIPTransactionStack newSIPStack, MessageChannel newChannelToUse)
newSIPStack
- Transaction stack this transaction belongs to.newChannelToUse
- Channel to encapsulate.public void setResponseInterface(ServerResponseInterface newRespondTo)
SIPClientTransaction
setResponseInterface
in interface SIPClientTransaction
newRespondTo
- ResponseInterface to send messages to.SIPClientTransaction.setResponseInterface(android.gov.nist.javax.sip.stack.ServerResponseInterface)
public MessageChannel getRequestChannel()
SIPClientTransaction
getRequestChannel
in interface SIPClientTransaction
SIPClientTransaction.getRequestChannel()
public boolean isMessagePartOfTransaction(SIPMessage messageToTest)
SIPTransaction
isMessagePartOfTransaction
in interface SIPClientTransaction
isMessagePartOfTransaction
in interface SIPTransaction
isMessagePartOfTransaction
in class SIPTransactionImpl
messageToTest
- Message to check if it is part of this transaction.SIPClientTransaction.isMessagePartOfTransaction(android.gov.nist.javax.sip.message.SIPMessage)
public void sendMessage(SIPMessage messageToSend) throws IOException
SIPTransaction
sendMessage
in interface SIPClientTransaction
sendMessage
in interface SIPTransaction
sendMessage
in class SIPTransactionImpl
messageToSend
- Message to send to the SIP peer.IOException
SIPClientTransaction.sendMessage(android.gov.nist.javax.sip.message.SIPMessage)
public void processResponse(SIPResponse transactionResponse, MessageChannel sourceChannel, SIPDialog dialog)
SIPClientTransaction
processResponse
in interface ServerResponseInterface
processResponse
in interface SIPClientTransaction
transactionResponse
- Response to process.sourceChannel
- Channel that received this message.dialog
- -- dialog for this responseSIPClientTransaction.processResponse(android.gov.nist.javax.sip.message.SIPResponse,
android.gov.nist.javax.sip.stack.MessageChannel, android.gov.nist.javax.sip.stack.SIPDialog)
public void sendRequest() throws SipException
ClientTransaction
MessageFactory
and then creates a new
ClientTransaction from
SipProvider.getNewClientTransaction(Request)
. Calling this method
on the ClientTransaction sends the Request onto the network. The Request
message gets sent via the ListeningPoint information of the SipProvider
that is associated to this ClientTransaction.
This method assumes that the Request is sent out of Dialog. It uses the Router to determine the next hop. If the Router returns a empty iterator, and a Dialog is associated with the outgoing request of the Transaction then the Dialog route set is used to send the outgoing request.
This method implies that the application is functioning as either a UAC or a stateful proxy, hence the underlying implementation acts statefully.
sendRequest
in interface SIPClientTransaction
sendRequest
in interface ClientTransaction
SipException
- if the SipProvider cannot send the Request for any
reason.SIPClientTransaction.sendRequest()
public void fireRetransmissionTimer()
fireRetransmissionTimer
in interface SIPTransaction
public void fireTimeoutTimer()
fireTimeoutTimer
in interface SIPTransaction
public Request createCancel() throws SipException
ClientTransaction
Note that both the transaction corresponding to the original request and
the CANCEL transaction will complete independently. However, a UAC
canceling a request cannot rely on receiving a 487 (Request Terminated)
response for the original request, as an RFC 2543 compliant UAS will
not generate such a response. Therefore if there is no final response for
the original request the application will receieve a TimeoutEvent with
Timeout.TRANSACTION
and the client should then consider the
original transaction cancelled.
createCancel
in interface SIPClientTransaction
createCancel
in interface ClientTransaction
SipException
- if this method is called to cancel a request that
can't be cancelled i.e. ACK.SIPClientTransaction.createCancel()
public Request createAck() throws SipException
ClientTransaction
createAck
in interface SIPClientTransaction
createAck
in interface ClientTransaction
SipException
- if this method is called before a final response
is received for the transaction.SIPClientTransaction.createAck()
public void setViaPort(int port)
SIPClientTransaction
setViaPort
in interface SIPClientTransaction
SIPClientTransaction.setViaPort(int)
public void setViaHost(String host)
SIPClientTransaction
setViaHost
in interface SIPClientTransaction
SIPClientTransaction.setViaHost(java.lang.String)
public int getViaPort()
SIPTransaction
getViaPort
in interface SIPClientTransaction
getViaPort
in interface SIPTransaction
getViaPort
in class SIPTransactionImpl
SIPClientTransaction.getViaPort()
public String getViaHost()
SIPTransaction
getViaHost
in interface SIPClientTransaction
getViaHost
in interface SIPTransaction
getViaHost
in class SIPTransactionImpl
SIPClientTransaction.getViaHost()
public Via getOutgoingViaHeader()
SIPClientTransaction
getOutgoingViaHeader
in interface SIPClientTransaction
SIPClientTransaction.getOutgoingViaHeader()
public void clearState()
SIPClientTransaction
clearState
in interface SIPClientTransaction
SIPClientTransaction.clearState()
public void setState(int newState)
SIPTransaction
setState
in interface SIPClientTransaction
setState
in interface SIPTransaction
setState
in class SIPTransactionImpl
newState
- New state of this transaction.SIPClientTransaction.setState(int)
public void startTransactionTimer()
startTransactionTimer
in interface SIPTransaction
public void terminate()
Transaction
terminate
in interface SIPClientTransaction
terminate
in interface Transaction
SIPClientTransaction.terminate()
public void stopExpiresTimer()
SIPClientTransaction
stopExpiresTimer
in interface SIPClientTransaction
SIPClientTransaction.stopExpiresTimer()
public boolean checkFromTag(SIPResponse sipResponse)
SIPClientTransaction
checkFromTag
in interface SIPClientTransaction
sipResponse
- the response to check.SIPClientTransaction.checkFromTag(android.gov.nist.javax.sip.message.SIPResponse)
public void processResponse(SIPResponse sipResponse, MessageChannel incomingChannel)
ServerResponseInterface
processResponse
in interface ServerResponseInterface
processResponse
in interface SIPClientTransaction
SIPClientTransaction.processResponse(android.gov.nist.javax.sip.message.SIPResponse,
android.gov.nist.javax.sip.stack.MessageChannel)
public Dialog getDialog()
SIPTransaction
getDialog
in interface SIPClientTransaction
getDialog
in interface SIPTransaction
getDialog
in interface Transaction
getDialog
in class SIPTransactionImpl
SIPClientTransaction.getDialog()
public SIPDialog getDialog(String dialogId)
getDialog
in interface SIPClientTransaction
SIPClientTransaction.getDialog(java.lang.String)
public void setDialog(SIPDialog sipDialog, String dialogId)
SIPTransaction
setDialog
in interface SIPClientTransaction
setDialog
in interface SIPTransaction
setDialog
in class SIPTransactionImpl
sipDialog
- --
the dialog to set.dialogId
- --
the dialog id ot associate with the dialog.sSIPClientTransaction.setDialog(android.gov.nist.javax.sip.stack.SIPDialog,
java.lang.String)
public SIPDialog getDefaultDialog()
ClientTransactionExt
getDefaultDialog
in interface ClientTransactionExt
getDefaultDialog
in interface SIPClientTransaction
SIPClientTransaction.getDefaultDialog()
public void setNextHop(Hop hop)
SIPClientTransaction
setNextHop
in interface SIPClientTransaction
hop
- -- the hop that has been previously computed.SIPClientTransaction.setNextHop(android.javax.sip.address.Hop)
public Hop getNextHop()
SIPClientTransaction
getNextHop
in interface ClientTransactionExt
getNextHop
in interface SIPClientTransaction
SIPClientTransaction.getNextHop()
public void setNotifyOnRetransmit(boolean notifyOnRetransmit)
SIPClientTransaction
setNotifyOnRetransmit
in interface ClientTransactionExt
setNotifyOnRetransmit
in interface SIPClientTransaction
notifyOnRetransmit
- the notifyOnRetransmit to setSIPClientTransaction.setNotifyOnRetransmit(boolean)
public boolean isNotifyOnRetransmit()
isNotifyOnRetransmit
in interface SIPClientTransaction
SIPClientTransaction.isNotifyOnRetransmit()
public void alertIfStillInCallingStateBy(int count)
ClientTransactionExt
alertIfStillInCallingStateBy
in interface ClientTransactionExt
alertIfStillInCallingStateBy
in interface SIPClientTransaction
count
- -- the number of base timer intervals after which an alert is issued.SIPClientTransaction.alertIfStillInCallingStateBy(int)
protected void cleanUpOnTimer()
public void cleanUp()
cleanUp
in interface SIPClientTransaction
cleanUp
in interface SIPTransaction
cleanUp
in class SIPTransactionImpl
SIPClientTransaction.cleanUp()
protected void cleanUpOnTerminated()
public String getOriginalRequestFromTag()
getOriginalRequestFromTag
in interface SIPClientTransaction
SIPClientTransaction.getOriginalRequestFromTag()
public String getOriginalRequestCallId()
getOriginalRequestCallId
in interface SIPClientTransaction
SIPClientTransaction.getOriginalRequestCallId()
public Event getOriginalRequestEvent()
getOriginalRequestEvent
in interface SIPClientTransaction
SIPClientTransaction.getOriginalRequestEvent()
public Contact getOriginalRequestContact()
getOriginalRequestContact
in interface SIPClientTransaction
SIPClientTransaction.getOriginalRequestContact()
public String getOriginalRequestScheme()
getOriginalRequestScheme
in interface SIPClientTransaction
SIPClientTransaction.getOriginalRequestScheme()
Copyright © 2014. All Rights Reserved.