|
NIST-SIP: The Reference Implementation for JAIN-SIP 1.2 | |||||||||
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
gov.nist.javax.sip.stack.SIPClientTransaction
public class SIPClientTransaction
Represents a client transaction. Implements the following state machines. (From RFC 3261)
|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
Nested Class Summary | |
---|---|
class |
SIPClientTransaction.TransactionTimer
|
Field Summary |
---|
Fields inherited from class gov.nist.javax.sip.stack.SIPTransaction |
---|
auditTag, CALLING_STATE, COMPLETED_STATE, CONFIRMED_STATE, INITIAL_STATE, PROCEEDING_STATE, TERMINATED_STATE, TRYING_STATE |
Method Summary | |
---|---|
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. |
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. |
SIPDialog |
getDefaultDialog()
|
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). |
Via |
getOutgoingViaHeader()
get the via header for an outgoing request. |
MessageChannel |
getRequestChannel()
Returns this transaction. |
String |
getViaHost()
Get the host of the recipient. |
int |
getViaPort()
Get the port of the recipient. |
boolean |
isMessagePartOfTransaction(SIPMessage messageToTest)
Deterines if the message is a 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)
Send a request message through this transaction and onto the client. |
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(TransactionState newState)
Sets a timeout after which the connection is closed (provided the server does not use the connection for outgoing requests in this time period) and calls the superclass to set state. |
void |
terminate()
Terminate this transaction and immediately release all stack resources associated with it. |
Methods inherited from class gov.nist.javax.sip.stack.MessageChannel |
---|
getHostPort, getKey, getKey, getPeerHostPort, getRawIpSourceAddress, getViaHostPort, logResponse, sendMessage, sendMessage |
Methods inherited from class java.lang.Object |
---|
equals, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.sip.Transaction |
---|
getApplicationData, getBranchId, getRequest, getRetransmitTimer, getState, setApplicationData, setRetransmitTimer |
Method Detail |
---|
public void setResponseInterface(ServerResponseInterface newRespondTo)
newRespondTo
- ResponseInterface to send messages to.public MessageChannel getRequestChannel()
public boolean isMessagePartOfTransaction(SIPMessage messageToTest)
isMessagePartOfTransaction
in class SIPTransaction
messageToTest
- Message to check if it is part of this transaction.
public void sendMessage(SIPMessage messageToSend) throws IOException
sendMessage
in class SIPTransaction
messageToSend
- Request to process and send.
IOException
public void processResponse(SIPResponse transactionResponse, MessageChannel sourceChannel, SIPDialog dialog)
processResponse
in interface ServerResponseInterface
transactionResponse
- Response to process.sourceChannel
- Channel that received this message.dialog
- -- dialog for this responsepublic 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 ClientTransaction
SipException
- if the SipProvider cannot send the Request for any
reason.Request
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 ClientTransaction
SipException
- if this method is called to cancel a request that
can't be cancelled i.e. ACK.public Request createAck() throws SipException
ClientTransaction
createAck
in interface ClientTransaction
SipException
- if this method is called before a final response
is received for the transaction.public int getViaPort()
getViaPort
in class SIPTransaction
public String getViaHost()
getViaHost
in class SIPTransaction
public Via getOutgoingViaHeader()
public void clearState()
public void setState(TransactionState newState)
setState
in class SIPTransaction
newState
- New state of this transaction.public void terminate() throws ObjectInUseException
Transaction
terminate
in interface Transaction
ObjectInUseException
- if the transaction cannot be terminated as
it is associated to a dialog.public void processResponse(SIPResponse sipResponse, MessageChannel incomingChannel)
ServerResponseInterface
processResponse
in interface ServerResponseInterface
public Dialog getDialog()
SIPTransaction
getDialog
in interface Transaction
getDialog
in class SIPTransaction
Dialog
public SIPDialog getDialog(String dialogId)
public void setDialog(SIPDialog sipDialog, String dialogId)
SIPTransaction
setDialog
in class SIPTransaction
sipDialog
- --
the dialog to set.dialogId
- --
the dialog id ot associate with the dialog.spublic SIPDialog getDefaultDialog()
public void setNextHop(Hop hop)
hop
- -- the hop that has been previously computed.public Hop getNextHop()
getNextHop
in interface ClientTransactionExt
public void setNotifyOnRetransmit(boolean notifyOnRetransmit)
setNotifyOnRetransmit
in interface ClientTransactionExt
notifyOnRetransmit
- the notifyOnRetransmit to setpublic boolean isNotifyOnRetransmit()
public void alertIfStillInCallingStateBy(int count)
ClientTransactionExt
alertIfStillInCallingStateBy
in interface ClientTransactionExt
count
- -- the number of base timer intervals after which an alert is issued.
|
NIST-SIP: The Reference Implementation for JAIN-SIP 1.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |