SipListener but
+ * with the addition of signaling whether the specified event was indeed handled
+ * in the processor and needs no further processing in other processors
+ * registered for the same method.
+ *
+ * @author Lubomir Marinov
+ */
+public interface MethodProcessor
+{
+
+ /**
+ * Process an asynchronously reported DialogTerminatedEvent. When a dialog
+ * transitions to the Terminated state, the stack keeps no further records
+ * of the dialog. This notification can be used by applications to clean up
+ * any auxiliary data that is being maintained for the given dialog.
+ *
+ * @param dialogTerminatedEvent an event that indicates that the dialog has
+ * transitioned into the terminated state
+ * @return true if the specified event has been handled by this
+ * processor and shouldn't be offered to other processors registered
+ * for the same method; false, otherwise
+ */
+ boolean processDialogTerminated(DialogTerminatedEvent dialogTerminatedEvent);
+
+ /**
+ * Process an asynchronously reported IO Exception. Asynchronous IO
+ * Exceptions may occur as a result of errors during retransmission of
+ * requests. The transaction state machine requires to report IO Exceptions
+ * to the application immediately (according to RFC 3261). This method
+ * enables an implementation to propagate the asynchronous handling of IO
+ * Exceptions to the application.
+ *
+ * @param exceptionEvent the Exception event that is reported to the
+ * application
+ * @return true if the specified event has been handled by this
+ * processor and shouldn't be offered to other processors registered
+ * for the same method; false, otherwise
+ */
+ boolean processIOException(IOExceptionEvent exceptionEvent);
+
+ /**
+ * Processes a Request received on a
+ * ProtocolProviderServiceSipImpl upon which this processor is
+ * registered.
+ *
+ * @param requestEvent requestEvent fired from the
+ * ProtocolProviderServiceSipImpl to the processor
+ * representing a Request received from the network
+ * @return true if the specified event has been handled by this
+ * processor and shouldn't be offered to other processors registered
+ * for the same method; false, otherwise
+ */
+ boolean processRequest(RequestEvent requestEvent);
+
+ /**
+ * Processes a Response received on a
+ * ProtocolProviderServiceSipImpl upon which this processor is
+ * registered.
+ *
+ * @param responseEvent the responseEvent fired from the
+ * ProtocolProviderServiceSipImpl to the processor
+ * representing a Response received from the network
+ * @return true if the specified event has been handled by this
+ * processor and shouldn't be offered to other processors registered
+ * for the same method; false, otherwise
+ */
+ boolean processResponse(ResponseEvent responseEvent);
+
+ /**
+ * Processes a retransmit or expiration Timeout of an underlying
+ * {@link Transaction} handled by this SipListener. This Event notifies the
+ * application that a retransmission or transaction Timer expired in the
+ * SipProvider's transaction state machine. The TimeoutEvent encapsulates
+ * the specific timeout type and the transaction identifier either client or
+ * server upon which the timeout occurred. The type of Timeout can by
+ * determined by:
+ * timeoutType = timeoutEvent.getTimeout().getValue();
+ *
+ * @param timeoutEvent the timeoutEvent received indicating either the
+ * message retransmit or transaction timed out
+ * @return true if the specified event has been handled by this
+ * processor and shouldn't be offered to other processors registered
+ * for the same method; false, otherwise
+ */
+ boolean processTimeout(TimeoutEvent timeoutEvent);
+
+ /**
+ * Process an asynchronously reported TransactionTerminatedEvent. When a
+ * transaction transitions to the Terminated state, the stack keeps no
+ * further records of the transaction. This notification can be used by
+ * applications to clean up any auxiliary data that is being maintained for
+ * the given transaction.
+ *
+ * @param transactionTerminatedEvent an event that indicates that the
+ * transaction has transitioned into the terminated state
+ * @return true if the specified event has been handled by this
+ * processor and shouldn't be offered to other processors registered
+ * for the same method; false, otherwise
+ */
+ boolean processTransactionTerminated(
+ TransactionTerminatedEvent transactionTerminatedEvent);
+}
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicInstantMessagingSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicInstantMessagingSipImpl.java
index 6631373d6..e07f2a4fc 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicInstantMessagingSipImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicInstantMessagingSipImpl.java
@@ -95,7 +95,7 @@ public class OperationSetBasicInstantMessagingSipImpl
offlineMessageSupported = true;
sipProvider.registerMethodProcessor(Request.MESSAGE,
- new SipMessageListener());
+ new BasicInstantMessagingMethodProcessor());
this.sipStatusEnum = sipProvider.getSipStatusEnum();
}
@@ -686,31 +686,34 @@ else if (evt instanceof MessageDeliveryFailedEvent)
/**
* Class for listening incoming packets.
*/
- private class SipMessageListener
- implements SipListener
+ private class BasicInstantMessagingMethodProcessor
+ implements MethodProcessor
{
- public void processDialogTerminated(
+ public boolean processDialogTerminated(
DialogTerminatedEvent dialogTerminatedEvent)
{
// never fired
+ return false;
}
- public void processIOException(IOExceptionEvent exceptionEvent)
+ public boolean processIOException(IOExceptionEvent exceptionEvent)
{
// never fired
+ return false;
}
- public void processTransactionTerminated(
+ public boolean processTransactionTerminated(
TransactionTerminatedEvent transactionTerminatedEvent)
{
// nothing to do
+ return false;
}
/**
*
* @param timeoutEvent TimeoutEvent
*/
- public void processTimeout(TimeoutEvent timeoutEvent)
+ public boolean processTimeout(TimeoutEvent timeoutEvent)
{
synchronized (messageProcessors)
{
@@ -721,7 +724,7 @@ public void processTimeout(TimeoutEvent timeoutEvent)
= (SipMessageProcessor)iter.next();
if(!listener.processTimeout(timeoutEvent, sentMsg))
- return;
+ return true;
}
}
@@ -730,7 +733,7 @@ public void processTimeout(TimeoutEvent timeoutEvent)
if (timeoutEvent.isServerTransaction()) {
logger.warn("The sender has probably not received our OK");
- return;
+ return false;
}
Request req = timeoutEvent.getClientTransaction().getRequest();
@@ -753,7 +756,7 @@ public void processTimeout(TimeoutEvent timeoutEvent)
if (toHeader == null)
{
logger.error("received a request without a to header");
- return;
+ return false;
}
Contact to = opSetPersPresence.resolveContactID(
@@ -797,15 +800,20 @@ public void processTimeout(TimeoutEvent timeoutEvent)
MessageDeliveryFailedEvent.INTERNAL_ERROR,
new Date());
fireMessageEvent(evt);
+
+ return true;
}
/**
* Process a request from a distant contact
- *
+ *
* @param requestEvent the RequestEvent containing the newly
- * received request.
+ * received request.
+ * @return true if the specified event has been handled by this
+ * processor and shouldn't be offered to other processors
+ * registered for the same method; false, otherwise
*/
- public void processRequest(RequestEvent requestEvent)
+ public boolean processRequest(RequestEvent requestEvent)
{
synchronized (messageProcessors)
{
@@ -816,7 +824,7 @@ public void processRequest(RequestEvent requestEvent)
= (SipMessageProcessor)iter.next();
if(!listener.processMessage(requestEvent))
- return;
+ return true;
}
}
@@ -841,7 +849,7 @@ public void processRequest(RequestEvent requestEvent)
if (fromHeader == null)
{
logger.error("received a request without a from header");
- return;
+ return false;
}
Contact from = opSetPersPresence.resolveContactID(
@@ -910,15 +918,20 @@ public void processRequest(RequestEvent requestEvent)
= new MessageReceivedEvent(
newMessage, from, new Date());
fireMessageEvent(msgReceivedEvt);
+
+ return true;
}
/**
* Process a response from a distant contact.
- *
+ *
* @param responseEvent the ResponseEvent containing the newly
- * received SIP response.
+ * received SIP response.
+ * @return true if the specified event has been handled by this
+ * processor and shouldn't be offered to other processors
+ * registered for the same method; false, otherwise
*/
- public void processResponse(ResponseEvent responseEvent)
+ public boolean processResponse(ResponseEvent responseEvent)
{
synchronized (messageProcessors)
{
@@ -929,7 +942,7 @@ public void processResponse(ResponseEvent responseEvent)
= (SipMessageProcessor)iter.next();
if(!listener.processResponse(responseEvent, sentMsg))
- return;
+ return true;
}
}
@@ -956,7 +969,7 @@ public void processResponse(ResponseEvent responseEvent)
{
// should never happen
logger.error("send a request without a to header");
- return;
+ return false;
}
Contact to = opSetPersPresence.resolveContactID(toHeader.getAddress()
@@ -981,7 +994,7 @@ public void processResponse(ResponseEvent responseEvent)
new Date());
fireMessageEvent(evt);
- return;
+ return false;
}
// we retrieve the original message
@@ -1005,7 +1018,7 @@ public void processResponse(ResponseEvent responseEvent)
new Date());
fireMessageEvent(evt);
- return;
+ return true;
}
// status 401/407 = proxy authentification
@@ -1083,6 +1096,8 @@ else if (status >= 200)
// we don't need this message anymore
sentMsg.remove(key);
}
+
+ return true;
}
/**
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java
index 389658411..918b9fbfa 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java
@@ -28,8 +28,8 @@
*/
public class OperationSetBasicTelephonySipImpl
extends AbstractOperationSetBasicTelephony
- implements OperationSetAdvancedTelephony,
- SipListener
+ implements MethodProcessor,
+ OperationSetAdvancedTelephony
{
private static final Logger logger =
Logger.getLogger(OperationSetBasicTelephonySipImpl.class);
@@ -475,8 +475,11 @@ private void throwOperationFailedException(String message, int errorCode,
* @param requestEvent requestEvent fired from the SipProvider to the
* SipListener representing a Request received from the
* network.
+ * @return true if the specified event has been handled by this
+ * processor and shouldn't be offered to other processors registered
+ * for the same method; false, otherwise
*/
- public void processRequest(RequestEvent requestEvent)
+ public boolean processRequest(RequestEvent requestEvent)
{
ServerTransaction serverTransaction =
requestEvent.getServerTransaction();
@@ -497,7 +500,7 @@ public void processRequest(RequestEvent requestEvent)
logger.error("Failed to create a new server"
+ "transaction for an incoming request\n"
+ "(Next message contains the request)", ex);
- return;
+ return false;
}
catch (TransactionUnavailableException ex)
{
@@ -505,10 +508,12 @@ public void processRequest(RequestEvent requestEvent)
logger.error("Failed to create a new server"
+ "transaction for an incoming request\n"
+ "(Next message contains the request)", ex);
- return;
+ return false;
}
}
+ boolean processed = false;
+
// INVITE
if (requestMethod.equals(Request.INVITE))
{
@@ -521,6 +526,7 @@ public void processRequest(RequestEvent requestEvent)
logger.debug("request is an INVITE. Dialog state="
+ dialogState);
processInvite(jainSipProvider, serverTransaction, request);
+ processed = true;
}
else
{
@@ -532,29 +538,35 @@ public void processRequest(RequestEvent requestEvent)
else if (requestMethod.equals(Request.ACK))
{
processAck(serverTransaction, request);
+ processed = true;
}
// BYE
else if (requestMethod.equals(Request.BYE))
{
processBye(serverTransaction, request);
+ processed = true;
}
// CANCEL
else if (requestMethod.equals(Request.CANCEL))
{
processCancel(serverTransaction, request);
+ processed = true;
}
// REFER
else if (requestMethod.equals(Request.REFER))
{
logger.debug("received REFER");
processRefer(serverTransaction, request, jainSipProvider);
+ processed = true;
}
// NOTIFY
else if (requestMethod.equals(Request.NOTIFY))
{
logger.debug("received NOTIFY");
- processNotify(serverTransaction, request);
+ processed = processNotify(serverTransaction, request);
}
+
+ return processed;
}
/**
@@ -562,11 +574,15 @@ else if (requestMethod.equals(Request.NOTIFY))
*
* @param transactionTerminatedEvent -- an event that indicates that the
* transaction has transitioned into the terminated state.
+ * @return true if the specified event has been handled by this
+ * processor and shouldn't be offered to other processors registered
+ * for the same method; false, otherwise
*/
- public void processTransactionTerminated(
+ public boolean processTransactionTerminated(
TransactionTerminatedEvent transactionTerminatedEvent)
{
// nothing to do here.
+ return false;
}
/**
@@ -575,8 +591,11 @@ public void processTransactionTerminated(
*
* @param responseEvent the responseEvent that we received
* ProtocolProviderService.
+ * @return true if the specified event has been handled by this
+ * processor and shouldn't be offered to other processors registered
+ * for the same method; false, otherwise
*/
- public void processResponse(ResponseEvent responseEvent)
+ public boolean processResponse(ResponseEvent responseEvent)
{
ClientTransaction clientTransaction =
responseEvent.getClientTransaction();
@@ -595,6 +614,7 @@ public void processResponse(ResponseEvent responseEvent)
SipProvider sourceProvider = (SipProvider) responseEvent.getSource();
int responseStatusCode = response.getStatusCode();
+ boolean processed = false;
switch (responseStatusCode)
{
@@ -603,6 +623,7 @@ public void processResponse(ResponseEvent responseEvent)
if (method.equals(Request.INVITE))
{
processInviteOK(clientTransaction, response);
+ processed = true;
}
else if (method.equals(Request.BYE))
{
@@ -613,21 +634,25 @@ else if (method.equals(Request.BYE))
// Ringing
case Response.RINGING:
processRinging(clientTransaction, response);
+ processed = true;
break;
// Session Progress
case Response.SESSION_PROGRESS:
processSessionProgress(clientTransaction, response);
+ processed = true;
break;
// Trying
case Response.TRYING:
processTrying(clientTransaction, response);
+ processed = true;
break;
// Busy here.
case Response.BUSY_HERE:
processBusyHere(clientTransaction, response);
+ processed = true;
break;
// Accepted
@@ -635,6 +660,7 @@ else if (method.equals(Request.BYE))
if (Request.REFER.equals(method))
{
processReferAccepted(clientTransaction, response);
+ processed = true;
}
break;
@@ -643,6 +669,7 @@ else if (method.equals(Request.BYE))
case Response.PROXY_AUTHENTICATION_REQUIRED:
processAuthenticationChallenge(clientTransaction, response,
sourceProvider);
+ processed = true;
break;
// errors
@@ -659,10 +686,13 @@ else if (method.equals(Request.BYE))
if (callParticipant != null)
callParticipant.setState(CallParticipantState.FAILED);
+
+ processed = true;
}
// ignore everything else.
break;
}
+ return processed;
}
/**
@@ -1159,14 +1189,17 @@ private void processAuthenticationChallenge(
*
* @param timeoutEvent the timeoutEvent received indicating either the
* message retransmit or transaction timed out.
+ * @return true if the specified event has been handled by this
+ * processor and shouldn't be offered to other processors registered
+ * for the same method; false, otherwise
*/
- public void processTimeout(TimeoutEvent timeoutEvent)
+ public boolean processTimeout(TimeoutEvent timeoutEvent)
{
Transaction transaction;
if (timeoutEvent.isServerTransaction())
{
// don't care. or maybe a stack bug?
- return;
+ return false;
}
else
{
@@ -1179,13 +1212,14 @@ public void processTimeout(TimeoutEvent timeoutEvent)
if (callParticipant == null)
{
logger.debug("Got a headless timeout event." + timeoutEvent);
- return;
+ return false;
}
// change status
callParticipant.setState(CallParticipantState.FAILED,
"The remote party has not replied!"
+ "The call will be disconnected");
+ return true;
}
/**
@@ -1198,11 +1232,15 @@ public void processTimeout(TimeoutEvent timeoutEvent)
*
* @param exceptionEvent The Exception event that is reported to the
* application.
+ * @return true if the specified event has been handled by this
+ * processor and shouldn't be offered to other processors registered
+ * for the same method; false, otherwise
*/
- public void processIOException(IOExceptionEvent exceptionEvent)
+ public boolean processIOException(IOExceptionEvent exceptionEvent)
{
logger.error("Got an asynchronous exception event. host="
+ exceptionEvent.getHost() + " port=" + exceptionEvent.getPort());
+ return true;
}
/**
@@ -1210,8 +1248,11 @@ public void processIOException(IOExceptionEvent exceptionEvent)
*
* @param dialogTerminatedEvent -- an event that indicates that the dialog
* has transitioned into the terminated state.
+ * @return true if the specified event has been handled by this
+ * processor and shouldn't be offered to other processors registered
+ * for the same method; false, otherwise
*/
- public void processDialogTerminated(
+ public boolean processDialogTerminated(
DialogTerminatedEvent dialogTerminatedEvent)
{
CallParticipantSipImpl callParticipant =
@@ -1220,11 +1261,12 @@ public void processDialogTerminated(
if (callParticipant == null)
{
- return;
+ return false;
}
// change status
callParticipant.setState(CallParticipantState.DISCONNECTED);
+ return true;
}
/**
@@ -2005,7 +2047,7 @@ && referToCallStateChanged(referToCallListenerSource,
* @param notifyRequest the Request.NOTIFY request to be
* processed
*/
- private void processNotify(ServerTransaction serverTransaction,
+ private boolean processNotify(ServerTransaction serverTransaction,
Request notifyRequest)
{
@@ -2018,7 +2060,7 @@ private void processNotify(ServerTransaction serverTransaction,
if ((eventHeader == null)
|| !"refer".equals(eventHeader.getEventType()))
{
- return;
+ return false;
}
SubscriptionStateHeader ssHeader =
@@ -2028,7 +2070,7 @@ private void processNotify(ServerTransaction serverTransaction,
{
logger
.error("NOTIFY of refer event type with no Subscription-State header.");
- return;
+ return false;
}
Dialog dialog = serverTransaction.getDialog();
@@ -2037,7 +2079,7 @@ private void processNotify(ServerTransaction serverTransaction,
if (participant == null)
{
logger.debug("Received a stray refer NOTIFY request.");
- return;
+ return false;
}
// OK
@@ -2053,7 +2095,7 @@ private void processNotify(ServerTransaction serverTransaction,
logger.error(message, ex);
participant.setState(CallParticipantState.DISCONNECTED, message);
- return;
+ return false;
}
try
{
@@ -2066,7 +2108,7 @@ private void processNotify(ServerTransaction serverTransaction,
logger.error(message, ex);
participant.setState(CallParticipantState.DISCONNECTED, message);
- return;
+ return false;
}
if (SubscriptionStateHeader.TERMINATED.equals(ssHeader.getState())
@@ -2096,6 +2138,8 @@ private void processNotify(ServerTransaction serverTransaction,
participant.setState(CallParticipantState.DISCONNECTED);
}
}
+
+ return true;
}
/**
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetDTMFSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetDTMFSipImpl.java
index 9113d1976..e28c2011e 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetDTMFSipImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetDTMFSipImpl.java
@@ -21,15 +21,15 @@
* tested.
*
* It should actually only be considered as a draft, since it was not heavily
- * tested, and just developped enough to get the DTMF function work I copied
+ * tested, and just developed enough to get the DTMF function work I copied
* and adapted code of the OpSetBasicTelephony implementation for SIP to make
* this code.
*
* @author JM HEITZ
*/
public class OperationSetDTMFSipImpl
- implements SipListener,
- OperationSetDTMF
+ implements MethodProcessor,
+ OperationSetDTMF
{
/**
* logger for the class
@@ -143,35 +143,42 @@ private void sayInfo(CallParticipantSipImpl callParticipant,
/**
* Does nothing
- *
+ *
* @param requestEvent the event request
+ * @return true if the specified event has been handled by this
+ * processor and shouldn't be offered to other processors registered
+ * for the same method; false, otherwise
*/
- public void processRequest(RequestEvent requestEvent)
+ public boolean processRequest(RequestEvent requestEvent)
{
if (requestEvent == null)
{
logger.debug("requestEvent null");
}
logger.error("We don't cope with requests" + requestEvent);
+ return false;
}
/**
* Just look if the DTMF signal was well received, and log it
- *
+ *
* @param responseEvent the response event
+ * @return true if the specified event has been handled by this
+ * processor and shouldn't be offered to other processors registered
+ * for the same method; false, otherwise
*/
- public void processResponse(ResponseEvent responseEvent)
+ public boolean processResponse(ResponseEvent responseEvent)
{
if (responseEvent == null)
{
logger.debug("null responseEvent");
- return;
+ return false;
}
Response response = responseEvent.getResponse();
if (response == null)
{
logger.debug("null response");
- return;
+ return false;
}
int code = response.getStatusCode();
logger.debug("DTMF status code=" + code);
@@ -183,59 +190,74 @@ public void processResponse(ResponseEvent responseEvent)
{
logger.debug("DTMF succeeded");
}
+ return true;
}
/**
* In case of timeout, just terminate the transaction
- *
+ *
* @param timeoutEvent the timeout event
+ * @return true if the specified event has been handled by this
+ * processor and shouldn't be offered to other processors registered
+ * for the same method; false, otherwise
*/
- public void processTimeout(TimeoutEvent timeoutEvent)
+ public boolean processTimeout(TimeoutEvent timeoutEvent)
{
//we do nothing
logger.error("ioexception :" + timeoutEvent);
-
+ return false;
}
/**
* Just log the exception
- *
+ *
* @param exceptionEvent the event we have to handle
+ * @return true if the specified event has been handled by this
+ * processor and shouldn't be offered to other processors registered
+ * for the same method; false, otherwise
*/
- public void processIOException(IOExceptionEvent exceptionEvent)
+ public boolean processIOException(IOExceptionEvent exceptionEvent)
{
//we do nothing
if (exceptionEvent == null)
{
logger.debug("ioexception null");
- return;
+ return false;
}
logger.error("ioexception :" + exceptionEvent);
+ return false;
}
/**
* Just log the end of the transaction
- *
+ *
* @param transactionTerminatedEvent the event we have to handle
+ * @return true if the specified event has been handled by this
+ * processor and shouldn't be offered to other processors registered
+ * for the same method; false, otherwise
*/
- public void processTransactionTerminated(
+ public boolean processTransactionTerminated(
TransactionTerminatedEvent transactionTerminatedEvent)
{
//we do nothing
logger.info("Transaction Terminated :" + transactionTerminatedEvent);
+ return false;
}
/**
* Just log the end of the dialog
- *
+ *
* @param dialogTerminatedEvent the event we have to handle
+ * @return true if the specified event has been handled by this
+ * processor and shouldn't be offered to other processors registered
+ * for the same method; false, otherwise
*/
-
- public void processDialogTerminated(
+ public boolean processDialogTerminated(
DialogTerminatedEvent dialogTerminatedEvent)
{
//we do nothing
logger.info("Dialog Terminated :" + dialogTerminatedEvent);
+ return false;
}
/**
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetPresenceSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetPresenceSipImpl.java
index e28cbd488..170a9878a 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetPresenceSipImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetPresenceSipImpl.java
@@ -39,7 +39,7 @@
*/
public class OperationSetPresenceSipImpl
extends AbstractOperationSetPersistentPresencetimeoutType = timeoutEvent.getTimeout().getValue();
*
@@ -1110,18 +1117,23 @@ public void processTimeout(TimeoutEvent timeoutEvent)
//find the object that is supposed to take care of responses with the
//corresponding method
- SipListener processor
- = (SipListener)methodProcessors.get(request.getMethod());
+ String method = request.getMethod();
+ List+ * * @param requestEvent requestEvent fired from the SipProvider to the - * SipListener representing a Request received from the network. + * SipListener representing a Request received from the network. + * @return true if the specified event has been handled by this + * processor and shouldn't be offered to other processors registered + * for the same method; false, otherwise */ - public void processRequest(RequestEvent requestEvent) + public boolean processRequest(RequestEvent requestEvent) { /** @todo send not implemented */ + return false; } /** * Processes a retransmit or expiration Timeout of an underlying * {@link Transaction}handled by this SipListener. - * + * * @param timeoutEvent the timeoutEvent received indicating either the - * message retransmit or transaction timed out. + * message retransmit or transaction timed out. + * @return true if the specified event has been handled by this + * processor and shouldn't be offered to other processors registered + * for the same method; false, otherwise */ - public void processTimeout(TimeoutEvent timeoutEvent) + public boolean processTimeout(TimeoutEvent timeoutEvent) { - //don't alert the user if we're already off - if(getRegistrationState().equals(RegistrationState.UNREGISTERED)) - return; - - setRegistrationState( - RegistrationState.CONNECTION_FAILED - , RegistrationStateChangeEvent.REASON_NOT_SPECIFIED - , "A timeout occurred while trying to connect to the server."); + // don't alert the user if we're already off + if (getRegistrationState().equals(RegistrationState.UNREGISTERED) == false) + { + setRegistrationState(RegistrationState.CONNECTION_FAILED, + RegistrationStateChangeEvent.REASON_NOT_SPECIFIED, + "A timeout occurred while trying to connect to the server."); + } + return true; } /** - * Process an asynchronously reported TransactionTerminatedEvent. - * When a transaction transitions to the Terminated state, the stack - * keeps no further records of the transaction. - * + * Process an asynchronously reported TransactionTerminatedEvent. When a + * transaction transitions to the Terminated state, the stack keeps no + * further records of the transaction. + * * @param transactionTerminatedEvent an event that indicates that the - * transaction has transitioned into the terminated state. + * transaction has transitioned into the terminated state. + * @return true if the specified event has been handled by this + * processor and shouldn't be offered to other processors registered + * for the same method; false, otherwise */ - public void processTransactionTerminated(TransactionTerminatedEvent + public boolean processTransactionTerminated(TransactionTerminatedEvent transactionTerminatedEvent) { //doesn't mean anything. we do failure handling in processTimeout + return false; } /** * Process an asynchronously reported IO Exception. - * + * * @param exceptionEvent The Exception event that is reported to the - * application. + * application. + * @return true if the specified event has been handled by this + * processor and shouldn't be offered to other processors registered + * for the same method; false, otherwise */ - public void processIOException(IOExceptionEvent exceptionEvent) + public boolean processIOException(IOExceptionEvent exceptionEvent) { setRegistrationState( RegistrationState.CONNECTION_FAILED @@ -1120,6 +1149,7 @@ public void processIOException(IOExceptionEvent exceptionEvent) + "[" + exceptionEvent.getHost() + "]:" + exceptionEvent.getPort() + "/" + exceptionEvent.getTransport()); + return true; } /**