Revision: 15611
Author: [email protected]
Date: Thu Dec 2 13:36:06 2010
Log: Update Issue 1874
for non regression B2BUA test case forwarding ACK => able to forward the
200 OK using B2BUAHelper.getPendingMessages() method, still some exceptions
on retrans though
http://code.google.com/p/mobicents/source/detail?r=15611
Modified:
/trunk/servers/sip-servlets/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipApplicationSessionImpl.java
/trunk/servers/sip-servlets/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/B2buaHelperImpl.java
/trunk/servers/sip-servlets/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/TransactionApplicationData.java
/trunk/servers/sip-servlets/sip-servlets-jboss5/src/main/java/org/jboss/web/tomcat/service/session/ClusteredSipSession.java
=======================================
---
/trunk/servers/sip-servlets/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipApplicationSessionImpl.java
Mon Nov 22 06:08:04 2010
+++
/trunk/servers/sip-servlets/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipApplicationSessionImpl.java
Thu Dec 2 13:36:06 2010
@@ -666,8 +666,10 @@
private void cancelExpirationTimer() {
sipContext.getSipApplicationSessionTimerService().cancel(expirationTimerTask);
- expirationTimerTask.setSipApplicationSession(null);
- expirationTimerTask = null;
+ if(expirationTimerTask != null) {
+ expirationTimerTask.setSipApplicationSession(null);
+ expirationTimerTask = null;
+ }
}
/*
=======================================
---
/trunk/servers/sip-servlets/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/B2buaHelperImpl.java
Wed Nov 17 02:43:37 2010
+++
/trunk/servers/sip-servlets/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/B2buaHelperImpl.java
Thu Dec 2 13:36:06 2010
@@ -570,8 +570,8 @@
if (mode.equals(UAMode.UAC)) {
final Set<Transaction> ongoingTransactions =
sipSessionImpl.getOngoingTransactions();
if(ongoingTransactions != null) {
- for ( Transaction transaction:
ongoingTransactions) {
- if ( transaction instanceof
ClientTransaction) {
+ for (Transaction transaction:
ongoingTransactions) {
+ if (transaction instanceof
ClientTransaction) {
final TransactionApplicationData tad = (TransactionApplicationData)
transaction.getApplicationData();
// Issue1571
http://code.google.com/p/mobicents/issues/detail?id=1571
// NullPointerException in
SipServletResponseImpl.isCommitted
@@ -598,17 +598,19 @@
}
}
}
-
} else {
- for ( Transaction transaction: sipSessionImpl.getOngoingTransactions())
{
- if ( transaction instanceof ServerTransaction) {
- final TransactionApplicationData tad = (TransactionApplicationData)
transaction.getApplicationData();
- final SipServletMessage sipServletMessage =
tad.getSipServletMessage();
- //not specified if ACK is a committed message in the spec but it
seems not since Proxy api test
- //testCanacel101 method adds a header to the ACK and it cannot be on
a committed message
- //so we don't want to return ACK as pending messages here. related to
TCK test B2BUAHelper.testCreateRequest002
- if (!sipServletMessage.isCommitted()
&& !Request.ACK.equals(sipServletMessage.getMethod())) {
- retval.add(sipServletMessage);
+ final Set<Transaction> ongoingTransactions =
sipSessionImpl.getOngoingTransactions();
+ if(ongoingTransactions != null) {
+ for (Transaction transaction:
ongoingTransactions) {
+ if (transaction instanceof
ServerTransaction) {
+ final TransactionApplicationData tad = (TransactionApplicationData)
transaction.getApplicationData();
+ final SipServletMessage sipServletMessage =
tad.getSipServletMessage();
+ //not specified if ACK is a committed message in the spec but it
seems not since Proxy api test
+ //testCanacel101 method adds a header to the ACK and it cannot be on
a committed message
+ //so we don't want to return ACK as pending messages here. related
to TCK test B2BUAHelper.testCreateRequest002
+ if (!sipServletMessage.isCommitted()
&& !Request.ACK.equals(sipServletMessage.getMethod())) {
+
retval.add(sipServletMessage);
+ }
}
}
}
=======================================
---
/trunk/servers/sip-servlets/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/TransactionApplicationData.java
Fri Jul 23 10:23:25 2010
+++
/trunk/servers/sip-servlets/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/TransactionApplicationData.java
Thu Dec 2 13:36:06 2010
@@ -37,7 +37,7 @@
private static final long serialVersionUID = 9170581635026591070L;
private static final Logger logger =
Logger.getLogger(TransactionApplicationData.class);
- private transient ProxyBranchImpl proxyBranch;
+ private ProxyBranchImpl proxyBranch;
private SipServletMessageImpl sipServletMessage;
// private SipSessionKey sipSessionKey;
private transient Set<SipServletResponseImpl> sipServletResponses;
=======================================
---
/trunk/servers/sip-servlets/sip-servlets-jboss5/src/main/java/org/jboss/web/tomcat/service/session/ClusteredSipSession.java
Thu Dec 2 08:11:40 2010
+++
/trunk/servers/sip-servlets/sip-servlets-jboss5/src/main/java/org/jboss/web/tomcat/service/session/ClusteredSipSession.java
Thu Dec 2 13:36:06 2010
@@ -43,7 +43,9 @@
import javax.servlet.sip.SipSessionEvent;
import javax.servlet.sip.SipSessionListener;
import javax.sip.Dialog;
+import javax.sip.ServerTransaction;
import javax.sip.SipStack;
+import javax.sip.Transaction;
import org.apache.catalina.Container;
import org.apache.catalina.Context;
@@ -64,6 +66,7 @@
import
org.jboss.web.tomcat.service.session.notification.ClusteredSipSessionNotificationPolicy;
import org.mobicents.ha.javax.sip.ClusteredSipStack;
import org.mobicents.ha.javax.sip.HASipDialog;
+import org.mobicents.ha.javax.sip.ReplicationStrategy;
import
org.mobicents.servlet.sip.core.session.MobicentsSipApplicationSession;
import org.mobicents.servlet.sip.core.session.SessionManagerUtil;
import org.mobicents.servlet.sip.core.session.SipApplicationSessionKey;
@@ -90,6 +93,9 @@
protected static final String B2B_SESSION_MAP = "b2bsm";
protected static final String B2B_SESSION_SIZE = "b2bss";
+ protected static final String TXS_SIZE = "txm";
+ protected static final String TXS_IDS= "txid";
+ protected static final String TXS_TYPE= "txt";
protected static final String PROXY = "prox";
protected static final String DIALOG_ID = "did";
protected static final String READY_TO_INVALIDATE = "rti";
@@ -877,7 +883,28 @@
b2buaHelper.setSipManager(getManager());
}
b2buaHelper.setSessionMap(sessionMap);
- }
+ }
+
if(((ClusteredSipStack)StaticServiceHolder.sipStandardService.getSipStack()).getReplicationStrategy()
== ReplicationStrategy.EarlyDialog) {
+ Integer txsSize = (Integer) metaData.get(TXS_SIZE);
+ if(txsSize != null) {
+ String[] txIds =
(String[])metaData.get(TXS_IDS);
+ Boolean[] txTypes =
(Boolean[])metaData.get(TXS_TYPE);
+ if(logger.isDebugEnabled()) {
+ logger.debug("tx array size = " + txsSize +
", value = " + txIds);
+ }
+ if(txsSize != null && txIds != null) {
+ for (int i = 0; i < txsSize; i++) {
+ String txId = txIds[i];
+ Boolean txType = txTypes[i];
+ if(logger.isDebugEnabled()) {
+ logger.debug("trying to find tx with id = " + txId + ", type = " +
txType + " locally or in the distributed cache");
+ }
+ Transaction transaction =
((ClusteredSipStack)StaticServiceHolder.sipStandardService.getSipStack()).findTransaction(txId,
txType);
+
addOngoingTransaction(transaction);
+ }
+ }
+ }
+ }
if(logger.isDebugEnabled()) {
logger.debug("dialog to inject " +
sessionCreatingDialogId);
if(sessionCreatingDialogId != null) {
@@ -941,7 +968,28 @@
logger.debug("storing b2bua session array
" + sessionArray);
}
metaData.put(B2B_SESSION_MAP, sessionArray);
- }
+ }
+
if(((ClusteredSipStack)StaticServiceHolder.sipStandardService.getSipStack()).getReplicationStrategy()
== ReplicationStrategy.EarlyDialog) {
+ final Set<Transaction> ongoingTransactions =
getOngoingTransactions();
+ final int size = ongoingTransactions.size();
+ final String[] txIdArray = new String[size];
+ final Boolean[] txTypeArray = new Boolean[size];
+ int i = 0;
+ for (Transaction transaction :
ongoingTransactions) {
+ txIdArray[i] =
transaction.getBranchId();
+ txTypeArray[i] = transaction instanceof ServerTransaction ?
Boolean.TRUE : Boolean.FALSE;
+ i++;
+ }
+ metaData.put(TXS_SIZE, size);
+ if(logger.isDebugEnabled()) {
+ logger.debug("storing transaction ids array
" + txIdArray);
+ }
+ metaData.put(TXS_IDS, txIdArray);
+ if(logger.isDebugEnabled()) {
+ logger.debug("storing transaction type array
" + txTypeArray);
+ }
+ metaData.put(TXS_TYPE, txTypeArray);
+ }
}
distributedCacheManager.storeSipSessionData(outgoingData);