I need to move an application (using jain-sip) to a JBoss cluster.
I would like to use Mobicents and jain-sip-ha to be able to replicate
the javax.sip.Dialog.
I installed a two nodes Mobicents (mss-1.2-
jboss-5.1.0.GA-1001281339.zip) cluster using POJO cache to share the
data between nodes.
My problem is that the following is not working:
1) Node 1 is doing a SUBSCRIBE:
ClientTransaction clientTransaction =
SipHelper.getInstance().getSipProvider().getNewClientTransaction(request);
Dialog dialog = clientTransaction.getDialog();
clientTransaction.sendRequest();
2) Node 1 puts the dialog into the POJO cache.
3) Node 2 gets the dialog from the POJO cache
4) The dialog retrieved by Node 2 is not valid:
dialog.toString() is "gov.nist.javax.sip.stack.SIPDialog@4c1d89f"
dialog.getState() is null !!!
dialog.getDialogId() is null !!!
and, if I try to send a SUBSCRIBE refresh, I get the following:
2010-03-10 18:06:36,697 ERROR [IPS_PROVIDER] (Thread-25) ERROR: Dialog
not yet established -- no response!
javax.sip.SipException: Dialog not yet established -- no response!
at gov.nist.javax.sip.stack.SIPDialog.createRequest(SIPDialog.java:
1860)
at
it.italtel.ipif.providers.ips.helper.IPSMediator.doSubscribe(IPSMediator.java:
264)
Could someone tell me what is wrong in my procedure?
Thanks and best regards, Michele
----------------------------------------------------------------------------------------------------------------
PS This is how the SIP Stack is initialized on both JBoss Cluster
Nodes :
public class SipHelper {
private SipStackImpl sipStack;
private SipProvider sipProvider;
private MessageFactory messageFactory;
private HeaderFactory headerFactory;
private AddressFactory addressFactory;
private SipListenerImpl sipListener;
private ListeningPoint lp;
private ListeningPoint lp2;
private void initSipStack(SipResultListener sipResultListener,
SipNotifyListener sipNotifyListener) throws Exception
{
Properties properties = new Properties();
properties.setProperty("javax.sip.STACK_NAME",
"italtel.ipif.ips");
properties.setProperty(ManagedMobicentsSipCache.STANDALONE,
"false");
properties.setProperty("javax.sip.OUTBOUND_PROXY",
getServerAddress() + ":" + getServerPort() + "/"+
getTransportProtocol());
// log
properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL",
String.valueOf(ServerLog.TRACE_MESSAGES));
properties.setProperty("gov.nist.javax.sip.SERVER_LOG", LOG_PATH +
"jain_server.log");
properties.setProperty("gov.nist.javax.sip.BAD_MESSAGE_LOG",
LOG_PATH + "jain_unprocessed.log");
properties.setProperty("gov.nist.javax.sip.DEBUG_LOG", LOG_PATH +
"jain_debug.log");
properties.setProperty("gov.nist.javax.sip.LOG_LIFETIME", "3600");
properties.setProperty("gov.nist.javax.sip.LOG_MESSAGE_CONTENT",
"true");
try {
properties.load(new FileInputStream(CONF_PATH + "jain-
sip.properties"));
} catch (FileNotFoundException e) {
if (log.isEnabledFor(Priority.WARN)) {
log.warn(CONF_PATH + "jain-sip.properties" + ":
Configuration file not found for jain-sip!");
}
} catch (IOException e) {
if (log.isEnabledFor(Priority.WARN)) {
log.warn("load " + CONF_PATH + "jain-sip.properties
Error!!");
}
if (log.isDebugEnabled()) {
log.debug("This is the stackTrace: ", e );
}
}
// Create SipStack object
SipFactory sipFactory = SipFactory.getInstance();
sipFactory.setPathName("org.mobicents.ha");
sipStack = sipFactory.createSipStack(properties);
headerFactory = sipFactory.createHeaderFactory();
addressFactory = sipFactory.createAddressFactory();
messageFactory = sipFactory.createMessageFactory();
lp = sipStack.createListeningPoint(getClientAddress(),
getClientPort(), getTransportProtocol());
lp2 = sipStack.createListeningPoint(getClientAddress(),
getClientPort(), getOtherTransportProtocol());
sipProvider = sipStack.createSipProvider(lp);
sipProvider.addListeningPoint(lp2);
sipListener = new SipListenerImpl(log, sipResultListener,
sipNotifyListener);
sipProvider.addSipListener((SipListener)sipListener);
sipStack.start();
}
and this id the jain-sip.properties configuration file:
#Configurazione con proxy
#javax.sip.OUTBOUND_PROXY=<ip_address>:<port>/<transport_protocol>
#Parametri per il LOG
gov.nist.javax.sip.TRACE_LEVEL=32
gov.nist.javax.sip.LOG_MESSAGE_CONTENT=true
gov.nist.javax.sip.LOG_LIFETIME=3600
gov.nist.javax.sip.ACCESS_LOG_VIA_RMI=false
gov.nist.javax.sip.RMI_PORT=8177
#Parametri per ottimizzare le connessioni TCP
gov.nist.javax.sip.CACHE_SERVER_CONNECTIONS=true
gov.nist.javax.sip.CACHE_CLIENT_CONNECTIONS=true
#gov.nist.javax.sip.MAX_CONNECTIONS=numero massimo di socket TCP
contemporanee
gov.nist.javax.sip.MAX_CONNECTIONS=5048576
#Parametri per ottimizzare le transazioni sip
javax.sip.AUTOMATIC_DIALOG_SUPPORT=off
gov.nist.javax.sip.DELIVER_UNSOLICITED_NOTIFY=true
#gov.nist.javax.sip.THREAD_POOL_SIZE=64
gov.nist.javax.sip.REENTRANT_LISTENER=true
# setting up the buffer size to reduce retransmissions and avoid
loosing messages
gov.nist.javax.sip.RECEIVE_UDP_BUFFER_SIZE=65536
gov.nist.javax.sip.SEND_UDP_BUFFER_SIZE=65536
#cache used by jain sip ha to replicate dialogs
#org.mobicents.ha.javax.sip.cache.MobicentsSipCache.cacheName=standard-
session-cache
org.mobicents.ha.javax.sip.cache.MobicentsSipCache.cacheName=ha-
partition
> To unsubscribe from this group, send email to
> mobicents-public+unsubscribegooglegroups.com or reply to this email with the
> words "REMOVE ME" as the subject.
>
About the replication issue that returns null, did you double check
that the HA is really in use like Jean says?
Sorry, I don't have fully understood.My scenario:1) Node0 is doing SUBSCRIBE for us...@ipifserver.comSIPClientTransaction clientTransaction =sipProvider.getNewClientTransaction(request);dialog = SipHelper.getInstance().getSipProvider().getNewDialog(clientTransaction);This is creating a dialog
2) Node1 wants to refresh the SUBSCRIBE for us...@ipifserver.comHow can I get the dialog created in point 1?
My solution was:A) Node0 puts us...@ipifserver.com/dialog in the POJO CacheB) Node1 gets dialog from POJO Cache using se...@ipifserver.com as key
/ {} /MSS_FT_SAS_Timers23a3d117 {} /MSS_FT_Timers6f97354c {} /MSS_FT_Timers23a3d117 {} /MSS_FT_SAS_Timers6f97354c {} /jain-sip-ha {} /Dialogs {} /2ebf20732b306b954a80b934d5ddf562@sip:nome.cogn...@ipifserver.com:2d6595e0:6297377e {ir=false, stf=false, is=false, lr=SIP/2.0 202 Accepted To: ;tag=6297377e Expires: 3600 Via: SIP/2.0/UDP 138.132.115.113:5061;branch=z9hG4bK8f5e676ea02013ead2e11a9aa1ec6acd353834 CSeq: 1 SUBSCRIBE Call-ID: 2ebf20732b306b954a80b934d5ddf562@sip:nome.cogn...@ipifserver.com From: ;tag=2d6595e0 Contact: Content-Length: 0 , rl=[Ljava.lang.String;@30cd076c, ftid=z9hG4bK8f5e676ea02013ead2e11a9aa1ec6acd353834, ftm=SUBSCRIBE, tob=true, b2b=false, eh=Event: presence , fts=false, rt=, ch=Contact: }
/ {} /MSS_FT_SAS_Timers23a3d117 {} /MSS_FT_Timers6f97354c {} /MSS_FT_Timers23a3d117 {} /MSS_FT_SAS_Timers6f97354c {} /jain-sip-ha {} /Dialogs {} /2ebf20732b306b954a80b934d5ddf562@sip:nome.cogn...@ipifserver.com:2d6595e0:6297377e {ir=false, stf=false, is=false, lr=SIP/2.0 202 Accepted To: ;tag=6297377e Expires: 3600 Via: SIP/2.0/UDP 138.132.115.113:5061;branch=z9hG4bK8f5e676ea02013ead2e11a9aa1ec6acd353834 CSeq: 1 SUBSCRIBE Call-ID: 2ebf20732b306b954a80b934d5ddf562@sip:nome.cogn...@ipifserver.com From: ;tag=2d6595e0 Contact: Content-Length: 0 , rl=[Ljava.lang.String;@30cd076c, ftid=z9hG4bK8f5e676ea02013ead2e11a9aa1ec6acd353834, ftm=SUBSCRIBE, tob=true, b2b=false, eh=Event: presence , fts=false, rt=, ch=Contact: }
SipProvider sp = SipHelper.getInstance().getSipProvider();
make sure you are taking the sip provider for the transport you are
actually using and the one where the dialog is associated.
2010-03-25 17:11:36,846 ERROR [IPS_PROVIDER] (Thread-24) *** MZZ ***
SipProvider gov.nist.javax.sip.SipProviderImpl@cd123c6
2010-03-25 17:11:36,846 ERROR [IPS_PROVIDER] (Thread-24) *** MZZ ***
SipProvider LP getIPAddress() 0 -> 138.132.115.113
2010-03-25 17:11:36,847 ERROR [IPS_PROVIDER] (Thread-24) *** MZZ ***
SipProvider LP getPort() 0 -> 5061
2010-03-25 17:11:36,847 ERROR [IPS_PROVIDER] (Thread-24) *** MZZ ***
SipProvider LP getSentBy() 0 -> 138.132.115.113:5061
2010-03-25 17:11:36,847 ERROR [IPS_PROVIDER] (Thread-24) *** MZZ ***
SipProvider LP getTransport() 0 -> udp
2010-03-25 17:11:36,847 ERROR [IPS_PROVIDER] (Thread-24) *** MZZ ***
SipProvider LP getIPAddress() 1 -> 138.132.115.113
2010-03-25 17:11:36,847 ERROR [IPS_PROVIDER] (Thread-24) *** MZZ ***
SipProvider LP getPort() 1 -> 5061
2010-03-25 17:11:36,847 ERROR [IPS_PROVIDER] (Thread-24) *** MZZ ***
SipProvider LP getSentBy() 1 -> 138.132.115.113:5061
2010-03-25 17:11:36,848 ERROR [IPS_PROVIDER] (Thread-24) *** MZZ ***
SipProvider LP getTransport() 1 -> tcp
We had this problem with TCP and UDP just few weeks ago. Make sure you
are looking up the dialog in the right SipProvider
Issue 1378: |
jain-sip-ha Dialog replication |
On Mar 26, 3:41 pm, Jean Deruelle <jean.derue...@gmail.com> wrote:
> I just fixed in the SVN trunk. Can you retry directly from the sources ?
>
> Thanks
> Jean
>
>
>
> On Fri, Mar 26, 2010 at 3:34 PM, Michele Mazza <mazza...@gmail.com> wrote:
> > Hello,
>
> > Opened an issue:
>
> > Issue 1378 <http://code.google.com/p/mobicents/issues/detail?id=1378>: jain-sip-ha
> > Dialog replication
>
> > Merci et salut, Mic
>
> > 2010/3/26 Jean Deruelle <jean.derue...@gmail.com>
>
> >> Interesting can you open an issue so that we fix this by looking at token
> >> >= 3 ?
>
> >> Thanks for the debugging !
> >> Jean
>
> >> On Fri, Mar 26, 2010 at 3:18 PM, Michele Mazza <mazza...@gmail.com>wrote:
>
> >>> Hello,
>
> >>> I have tested with just the UDP listening point but this didn't fix the
> >>> problem.
>
> >>> Reading the jain-sip-ha source code, I noticed that the recovery Node
> >>> (the one that didn't initiated the dialog), was NOT checking in the
> >>> distributed cache.
>
> >>> Looking at ClusteredSipStackImpl source, there is a check on the number
> >>> of tokens in dialogId:
>
> >>> int nbToken = new StringTokenizer(dialogId,
> >>> Separators.COLON).countTokens();
> >>> // we should only check the cache for dialog Id where the remote tag is
> >>> set since we support only established dialog failover
> >>> if(sipDialog == null && *nbToken == 3*) {sipDialog =
> >>> getDialogFromDistributedCache(dialogId);}
>
> >>> My dialogId is:
>
> >>> 3968c1f4c64570f5493c5830913c1418@sip
> >>> :nome.cognome_000...@ipifserver.com:dc3f1cb:c462172c
>
> >>> and the number of tokens is 4 (probably because I have also 'sip:').
>
> >>> So I have looked manually in the distributed cache:
>
> >>> if (dialog == null) { // dialog NOT found using
> >>> ((ClusteredSipStackImpl) sipStack).getDialog(dialogId)
> >>> dialog = ((ClusteredSipStackImpl) sipStack).*getSipCache()*
> >>> .getDialog(dialogId);
> >>> }
>
> >>> and this seems to work.
>
> >>> From the Node1 I am able to refresh the SUBSCRIBE initiated by the Node0.
> >>> The only difference is that the refresh conditional SUBSRIBE in the Node1
> >>> (replicated) loses the Event header (so I have to re-add it).
>
> >>> Thanks a lot for your great help.
> >>> Michele
>
> >>> 2010/3/25 Vladimir Ralev <vladimir.ra...@gmail.com>
>
> >>>> I noticed you have both TCP and UDP in separate SipProviders. We had
> >>>> an issue with this
> >>>>http://code.google.com/p/mobicents/issues/detail?id=1306which is
> >>>> On Thu, Mar 25, 2010 at 6:32 PM, Michele Mazza <mazza...@gmail.com>
> >>>> wrote:
> >>>> > Hello Jean,
> >>>> > I modified my application according to your explanation.
> >>>> > Now I save in the POJO cache just the dialogId related to a user.
> >>>> > On the replicated Node, I get just the dialogId from my cache and then
> >>>> I get
> >>>> > the dialog this way:
> >>>> > dialog = ((ClusteredSipStackImpl)
> >>>> > SipHelper.getInstance().getSipStack()).getDialog(dialogId);
> >>>> > Form the JBoss console (under jboss.cache) I cas see:
> >>>> > ------------------------------- Node 0
> >>>> > - 138.132.115.113 -------------------------------
>
> >>>> > / {}
> >>>> > /MSS_FT_SAS_Timers23a3d117 {}
> >>>> > /MSS_FT_Timers6f97354c {}
> >>>> > /MSS_FT_Timers23a3d117 {}
> >>>> > /MSS_FT_SAS_Timers6f97354c {}
> >>>> > /jain-sip-ha {}
> >>>> > /Dialogs {}
>
> >>>> > /2ebf20732b306b954a80b934d5ddf562@sip
> >>>> :nome.cognome_000...@ipifserver.com:2d6595e0:6297377e
> >>>> > {ir=false, stf=false, is=false, lr=SIP/2.0 202 Accepted
> >>>> > To: ;tag=6297377e
> >>>> > Expires: 3600
> >>>> > Via: SIP/2.0/UDP
> >>>> > 138.132.115.113:5061
> >>>> ;branch=z9hG4bK8f5e676ea02013ead2e11a9aa1ec6acd353834
> >>>> > CSeq: 1 SUBSCRIBE
> >>>> > Call-ID:
> >>>> > 2ebf20732b306b954a80b934d5ddf562@sip:
> >>>> nome.cognome_000...@ipifserver.com
> >>>> > From: ;tag=2d6595e0
> >>>> > Contact:
> >>>> > Content-Length: 0
>
> >>>> > , rl=[Ljava.lang.String;@30cd076c,
> >>>> > ftid=z9hG4bK8f5e676ea02013ead2e11a9aa1ec6acd353834, ftm=SUBSCRIBE,
> >>>> tob=true,
> >>>> > b2b=false, eh=Event: presence
> >>>> > , fts=false, rt=, ch=Contact:
> >>>> > }
>
> >>>> > ------------------------------- Node 1
> >>>> > - 138.132.115.118 -------------------------------
>
> >>>> > / {}
> >>>> > /MSS_FT_SAS_Timers23a3d117 {}
> >>>> > /MSS_FT_Timers6f97354c {}
> >>>> > /MSS_FT_Timers23a3d117 {}
> >>>> > /MSS_FT_SAS_Timers6f97354c {}
> >>>> > /jain-sip-ha {}
> >>>> > /Dialogs {}
>
> >>>> > /2ebf20732b306b954a80b934d5ddf562@sip
> >>>> :nome.cognome_000...@ipifserver.com:2d6595e0:6297377e
> >>>> > {ir=false, stf=false, is=false, lr=SIP/2.0 202 Accepted
> >>>> > To: ;tag=6297377e
> >>>> > Expires: 3600
> >>>> > Via: SIP/2.0/UDP
> >>>> > 138.132.115.113:5061
> >>>> ;branch=z9hG4bK8f5e676ea02013ead2e11a9aa1ec6acd353834
> >>>> > CSeq: 1 SUBSCRIBE
> >>>> > Call-ID:
> >>>> > 2ebf20732b306b954a80b934d5ddf562@sip:
> >>>> nome.cognome_000...@ipifserver.com
> >>>> > From: ;tag=2d6595e0
> >>>> > Contact:
> >>>> > Content-Length: 0
>
> >>>> > , rl=[Ljava.lang.String;@30cd076c,
> >>>> > ftid=z9hG4bK8f5e676ea02013ead2e11a9aa1ec6acd353834, ftm=SUBSCRIBE,
> >>>> tob=true,
> >>>> > b2b=false, eh=Event: presence
> >>>> > , fts=false, rt=, ch=Contact:
> >>>> > }
>
> >>>> > So it seems the dialog was correctly replicated!
>
> >>>> > But from my log:
>
> >>>> > ------------------------------- Node 0
> >>>> > - 138.132.115.113 -------------------------------
> >>>> > 2010-03-25 17:11:36,834 DEBUG [IPS_PROVIDER] (Thread-24) Refresh
> >>>> SUBSCRIBE
> >>>> > for nome.cognome_000...@ipifserver.com
> >>>> > 2010-03-25 17:11:36,835 ERROR [IPS_PROVIDER] (Thread-24) *** MZZ ***
> >>>> DIALOG
> >>>> > ID FOUND in dialogReplicationMap:
> >>>> sip:nome.cognome_000...@ipifserver.com<sip%3Anome.cognome_000...@ipifserver.com>
> >>>> > 2ebf20732b306b954a80b934d5ddf562@sip
> >>>> :nome.cognome_000...@ipifserver.com:2d6595e0:6297377e
> >>>> > 2010-03-25 17:11:36,835 DEBUG [italtel.ipif.ips] (Thread-24)
>
> >>>> org.mobicents.ha.javax.sip.ClusteredSipStackImpl.getDialog(ClusteredSipStac kImpl.java:224)
> >>>> > [checking if the dialog
> >>>> > 2ebf20732b306b954a80b934d5ddf562@sip
> >>>> :nome.cognome_000...@ipifserver.com:2d6595e0:6297377e
> >>>> > is present in the local cache]
> >>>> > 2010-03-25 17:11:36,835 DEBUG [italtel.ipif.ips] (Thread-24)
>
> >>>> gov.nist.javax.sip.stack.SIPTransactionStack.getDialog(SIPTransactionStack. java:836)
> >>>> > [getDialog(2ebf20732b306b954a80b934d5ddf562@sip
> >>>> :nome.cognome_000...@ipifserver.com:2d6595e0:6297377e)
> >>>> > : returning
> >>>> gov.nist.javax.sip.stack.ConfirmedReplicationSipDialog@20359260]
> >>>> > 2010-03-25 17:11:36,835 ERROR [IPS_PROVIDER] (Thread-24) *** MZZ ***
> >>>> DIALOG
> >>>> > FOUND in SipStack !!! 0
> >>>> > 2010-03-25 17:11:36,836 ERROR [IPS_PROVIDER] (Thread-24) *** MZZ ***
> >>>> DUMP
> >>>> > SipStack dialog.toString()
> >>>> > gov.nist.javax.sip.stack.ConfirmedReplicationSipDialog@20359260
> >>>> > 2010-03-25 17:11:36,836 ERROR [IPS_PROVIDER] (Thread-24) *** MZZ ***
> >>>> DUMP
> >>>> > SipStack dialog.getDialogId()
> >>>> > 2ebf20732b306b954a80b934d5ddf562@sip
> >>>> :nome.cognome_000...@ipifserver.com:2d6595e0:6297377e
> >>>> > 2010-03-25 17:11:36,836 ERROR [IPS_PROVIDER] (Thread-24) *** MZZ ***
> >>>> DIALOG
> >>>> > FINALLY FOUND in SipStack !!!
> >>>> > 2010-03-25 17:11:36,845 ERROR [IPS_PROVIDER] (Thread-24) *** MZZ ***
> >>>> etag
> >>>> > HPbyrbIA
> >>>> > 2010-03-25 17:11:36,845 ERROR [IPS_PROVIDER] (Thread-24) *** MZZ ***
> >>>> > toString
> >>>> gov.nist.javax.sip.stack.ConfirmedReplicationSipDialog@20359260
> >>>> > 2010-03-25 17:11:36,845 ERROR [IPS_PROVIDER] (Thread-24) *** MZZ ***
> >>>> > getState Confirmed Dialog
> >>>> > 2010-03-25 17:11:36,845 ERROR [IPS_PROVIDER] (Thread-24) *** MZZ ***
> >>>> > getDialogId
> >>>> > 2ebf20732b306b954a80b934d5ddf562@sip
> >>>> :nome.cognome_000...@ipifserver.com:2d6595e0:6297377e
> >>>> > 2010-03-25 17:11:36,846 ERROR [IPS_PROVIDER] (Thread-24) *** MZZ ***
> >>>> > getLocalSeqNumber 1
> >>>> > 2010-03-25 17:11:36,846 ERROR [IPS_PROVIDER] (Thread-24) *** MZZ ***
> >>>> > getLastResponse SIP/2.0 202 Accepted^M
> >>>> > To: <sip:nome.cognome_000...@ipifserver.com<sip%3Anome.cognome_000...@ipifserver.com>
>
> ...
>
> read more »