JAIN-SIP 2.0 API

javax.sip
Class ResponseEvent

java.lang.Object
  extended by java.util.EventObject
      extended by javax.sip.ResponseEvent
All Implemented Interfaces:
Serializable

public class ResponseEvent
extends EventObject

This class represents a Response event that is passed from a SipProvider to its SipListener. This specification handles the passing of Response messages to the application with the event model. An application (SipListener) registers with the SIP protocol stack (SipProvider) and listens for Response events from the SipProvider.

This specification defines a single Response event object to handle all Response messages. The Response event encapsulates the Response message that can be retrieved from getResponse(). Therefore the event type of a Response event can be determined as follows:

eventType == ResponseEvent.getResponse().getStatusCode();

A Response event also encapsulates the client transaction upon which the Response is correlated, i.e. the client transaction of the Request message upon which this is a Response.

ResponseEvent contains the following elements:

Since:
1.1
Version:
2.0
Author:
Oracle Inc., NIST
See Also:
Serialized Form

Constructor Summary
ResponseEvent(Object source, ListeningPoint listeningPoint, ClientTransaction clientTransaction, Dialog dialog, Response response)
          Constructs a ResponseEvent encapsulating the Response that has been received by the underlying SipProvider.
 
Method Summary
 ClientTransaction getClientTransaction()
          Gets the client transaction associated with this ResponseEvent
 Dialog getDialog()
          Gets the Dialog associated with the event or null if no dialog exists.
 ListeningPoint getListeningPoint()
          Get the listening point over which this response was receieved.
 ClientTransaction getOriginalTransaction()
          Get the original transaction for which this is a forked response.
 String getRemoteIpAddress()
          Get the remote IP addr. from which request was received.
 int getRemotePort()
          Get the remote port from which response was received.
 Response getResponse()
          Gets the Response message encapsulated in this ResponseEvent.
 boolean isForkedResponse()
          Return true if this is a forked response.
 void setForkedResponse(boolean forked)
          Set true if this is a forked response.
 void setOriginalTransaction(ClientTransaction originalTransaction)
          Set the original transaction for a forked response.
 void setRemoteIpAddress(String remoteIpAddress)
          Set the remote IP addr. from which request was received.
 void setRemotePort(int remotePort)
          Set the remote port from which response was received.
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ResponseEvent

public ResponseEvent(Object source,
                     ListeningPoint listeningPoint,
                     ClientTransaction clientTransaction,
                     Dialog dialog,
                     Response response)
Constructs a ResponseEvent encapsulating the Response that has been received by the underlying SipProvider. This ResponseEvent once created is passed to SipListener.processResponse(ResponseEvent) method of the SipListener for application processing.

Parameters:
source - - the source of ResponseEvent i.e. the SipProvider
listeningPoint - - the listening point over which the response was received by the stack.
clientTransaction - - client transaction upon which this Response was sent
response - - the Response message received by the SipProvider
Method Detail

getClientTransaction

public ClientTransaction getClientTransaction()
Gets the client transaction associated with this ResponseEvent

Returns:
client transaction associated with this ResponseEvent

getResponse

public Response getResponse()
Gets the Response message encapsulated in this ResponseEvent.

Returns:
the response associated with this ResponseEvent.

getDialog

public Dialog getDialog()
Gets the Dialog associated with the event or null if no dialog exists. This method separates transaction support from dialog support. This enables application developers to access the dialog associated to this event without having to query the transaction associated to the event. For example the transaction associated with the event may return 'null' because the final response for the transaction has already been received and the stack has no more record of the transaction. This situation can occur when a UAC sends requests out through a forking proxy. Responses that all refer to the same transaction may be sent by the targets of the fork but each response may be stamped with a different To tag, thus referring to different Dialogs on the UAC. The first final response terminates the transaction but the UAC may want to create a Dialog on a subsequent response.

Returns:
the dialog associated with the response event or null if there is no dialog.
Since:
v1.2

setForkedResponse

public void setForkedResponse(boolean forked)
Set true if this is a forked response. This field is only to be set by the implementation (not the application).

Parameters:
forked - - a boolean that is set in the response event indicating that the response is a forked response.
Since:
2.0

isForkedResponse

public boolean isForkedResponse()
Return true if this is a forked response. This query function is used by applications to test if a received response is a forked response.

Returns:
true if the response event is for a forked response.
Since:
2.0

setOriginalTransaction

public void setOriginalTransaction(ClientTransaction originalTransaction)
Set the original transaction for a forked response. This is set by the stack implementation and can be retrieved by the application later.

Parameters:
originalTransaction - - the original transaction for which this response event. is a fork.
Since:
2.0

getOriginalTransaction

public ClientTransaction getOriginalTransaction()
Get the original transaction for which this is a forked response. Note that this transaction can be in a TERMINATED state. The Original transaction contains the context corresponding to the forked response. This is useful for applications during response processing. If a forked response is received by the stack after the MAX_FORK_TIME setting for the SIP Stack, this field can be set to null when the response is delivered to the application.

Returns:
the original clientTx for which this is a forked response.
Since:
2.0

getListeningPoint

public ListeningPoint getListeningPoint()
Get the listening point over which this response was receieved.

Returns:
the listening point over which the response was received.
Since:
2.0

setRemotePort

public void setRemotePort(int remotePort)
Set the remote port from which response was received. Applications should not use this method. This method is reserved for use by applications which may use it to set the remote port.

Since:
2.0

getRemotePort

public int getRemotePort()
Get the remote port from which response was received.

Returns:
the remote Port as read from the inbound packet/connection.
Since:
2.0

getRemoteIpAddress

public String getRemoteIpAddress()
Get the remote IP addr. from which request was received.

Returns:
the remoteIp address as read from the inbound packet/connection.
Since:
2.0

setRemoteIpAddress

public void setRemoteIpAddress(String remoteIpAddress)
Set the remote IP addr. from which request was received. Applications should not use this method. This method is expected to be used by implementations to set the remote IP address.

Since:
2.0

JAIN-SIP 2.0 API


See conditions of use.
Submit a bug report or feature request.