Revision: 16403
Author: [email protected]
Date: Thu Jan 13 02:56:13 2011
Log: Update Issue 2230
Improving message exception when creating a response on a request on which
a final response has already been sent.
Throw IllegalStateException if one tries to create a subsequent request on
a TERMINATED dialog
http://code.google.com/p/mobicents/source/detail?r=16403
Modified:
/trunk/servers/sip-servlets/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipSessionImpl.java
/trunk/servers/sip-servlets/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/SipServletRequestImpl.java
=======================================
---
/trunk/servers/sip-servlets/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipSessionImpl.java
Thu Jan 6 13:34:01 2011
+++
/trunk/servers/sip-servlets/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipSessionImpl.java
Thu Jan 13 02:56:13 2011
@@ -333,10 +333,10 @@
"Can not create ACK, PRACK or CANCEL
requests with this method");
}
if(!isValid()) {
- throw new IllegalStateException("cannot create a request because the
session " + key + " is invalid");
+ throw new IllegalStateException("cannot create a subsequent request
because the session " + key + " is invalid");
}
if(State.TERMINATED.equals(state)) {
- throw new IllegalStateException("cannot create a request because the
session " + key + " is in TERMINATED state");
+ throw new IllegalStateException("cannot create a subsequent request
because the session " + key + " is in TERMINATED state");
}
// if((State.INITIAL.equals(state) && hasOngoingTransaction())) {
// throw new IllegalStateException("cannot create a request because the
session is in INITIAL state with ongoing transactions");
@@ -346,7 +346,12 @@
sessionCreatingDialog);
}
SipServletRequestImpl sipServletRequest = null;
- if(this.sessionCreatingDialog != null
&& !DialogState.TERMINATED.equals(sessionCreatingDialog.getState())) {
+ if(this.sessionCreatingDialog != null) {
+
if(!DialogState.TERMINATED.equals(sessionCreatingDialog.getState())) {
+ // Fix for Issue
http://code.google.com/p/mobicents/issues/detail?id=2230 BYE is routed to
unexpected IP
+ // MSS should throw an IllegalStateException when a subsequent request
is being created on a TERMINATED dialog
+ throw new IllegalStateException("cannot create a subsequent request
because the dialog " + sessionCreatingDialog + " for session " + key + " is
in TERMINATED state");
+ }
try {
final Request methodRequest =
this.sessionCreatingDialog.createRequest(method);
=======================================
---
/trunk/servers/sip-servlets/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/SipServletRequestImpl.java
Wed Jan 12 06:05:49 2011
+++
/trunk/servers/sip-servlets/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/SipServletRequestImpl.java
Thu Jan 13 02:56:13 2011
@@ -276,11 +276,14 @@
if(RoutingState.CANCELLED.equals(routingState)) {
throw new IllegalStateException("Cannot create a response for the
invite, a CANCEL has been received and the INVITE was replied with a 487!");
}
- if (transaction == null
- || transaction instanceof ClientTransaction) {
- if(validate) {
+ if(validate) {
+ if (transaction == null) {
throw new IllegalStateException(
- "Cannot create a response - not a server
transaction " + transaction);
+ "Cannot create a response for request " + message + " transaction is
null, a final error response has probably already been sent");
+ }
+ if(transaction instanceof ClientTransaction) {
+ throw new IllegalStateException(
+ "Cannot create a response for request " + message + " not a server
transaction " + transaction);
}
}
try {