CSeq increase on REGISTER ?

17 views
Skip to first unread message

Hauke X

unread,
Oct 17, 2008, 10:28:56 AM10/17/08
to mobicents-public
Hi everyone,

I'm having the problem that when creating requests with
SipSession.createRequest(Request.REGISTER), the CSeq numbers are not
increasing past 2. I.e., I create the request via
SipFactory.createRequest(..., Request.REGISTER, ...), and the CSeq
number of this request is 1. Then, later, I use that request's
getSession() method to get the SipSession, on which I call
createRequest(Request.REGISTER). The first time I do this the CSeq
number is increased to 2, but every subsequent time I do this the CSeq
number is not increased. Here is some pseudocode for what I am doing:

// initially:
SipServletRequest originalReq = SipFactory.createRequest(...,
Request.REGISTER, ...);
originalReq.send();

// later, repeatedly:
SipServletRequest newReq =
originalReq.getSession().createRequest(Request.REGISTER);
newReq.send();
originalReq = newReq;

Although theoretically I should always be working with the same
SipSession object, could my overwriting of originalReq be the problem,
i.e. should I be getting the SipSession once and re-using that session
object?

Also, I should note that because I am testing, the registrations are
only a few (~15) seconds apart; I think that theoretically this should
not be a problem but I know that JAIN always takes a little while to
invalidate transactions, and maybe this has something to do with the
problem?

I have looked into the SipSessionImpl code but have not found anything
obvious; except that possibly the sessionCreatingTransaction field is
not being updated when the new request is sent?

Also, I have a related question. I use the above code in the case
where the registrations go to the same registrar. If I ever get
redirected from one registrar to the next, I understand that
B2buaHelper should be used. Is this (pseudo)code correct?

// repeatedly, on redirects:
newReq = originalReq.getB2buaHelper().createRequest(originalReq);
newReq.setRequestURI(...);
newReq.send();
originalReq = newReq;

Thanks for all the previous help and in advance for any responses :)

Regards,
-- Hauke D

Jean Deruelle

unread,
Oct 17, 2008, 11:37:37 AM10/17/08
to mobicent...@googlegroups.com
I will try to reproduce the problem with a new test in the testsuite.

Not sure the B2BUA purpose is a meant for that, more for having one call leg in and one call leg out in linking the sessions together and passing requests from one leg to another.
In your case you might as well recreate the REGISTER from scratch. Not sure the new registrar will be able to handle the CSeq starting at 5 by example if you get redirected the fifth time... not sure about that though just wild guess, but you can still try.

Jean

Hauke X

unread,
Oct 17, 2008, 11:41:42 AM10/17/08
to mobicents-public
Hi,

I have some more information on this problem.

On Oct 17, 4:28 pm, Hauke X <hau...@zero-g.net> wrote:
> Although theoretically I should always be working with the same
> SipSession object, could my overwriting of originalReq be the problem,
> i.e. should I be getting the SipSession once and re-using that session
> object?

I have now tried re-using the same SipSession object and the result is
the same (CSeq numbers are not increasing).

> Also, I should note that because I am testing, the registrations are
> only a few (~15) seconds apart; I think that theoretically this should
> not be a problem but I know that JAIN always takes a little while to
> invalidate transactions, and maybe this has something to do with the
> problem?

I have now tried waiting longer between re-registrations and am having
some more problems. In some cases, the registrar has now sent back a
400 response indicating a bad CSeq number, and in other cases the
SipSession seems to have been invalidated. I am not yet sure why the
400 responses are only happening sometimes, and I assume that in the
other case the SipSession times out. My understanding with REGISTER
SipSessions is that they stay in the INITIAL state and are used to
send re-registrations to the same registrar, so I would find them
timing out a little strange?

Thanks,
-- Hauke D

Hauke X

unread,
Oct 17, 2008, 11:53:30 AM10/17/08
to mobicents-public
Hi,

Thanks for the quick reply as usual :)

On Oct 17, 5:37 pm, "Jean Deruelle" <jean.derue...@gmail.com> wrote:
> Not sure the B2BUA purpose is a meant for that, more for having one call leg
> in and one call leg out in linking the sessions together and passing
> requests from one leg to another.
> In your case you might as well recreate the REGISTER from scratch. Not sure
> the new registrar will be able to handle the CSeq starting at 5 by example
> if you get redirected the fifth time... not sure about that though just wild
> guess, but you can still try.

I thought I remembered reading somewhere that the B2buaHelper is
useful for redirected REGISTER requests but I actually can't find the
source any more, and you are right that I could create them from
scratch, maybe I will do that instead. I don't think the CSeq number
would be a problem however because the first REGISTER to a registrar
follows most of the general rules for request creation outside of a
dialog, and I believe the CSeq number can be arbitrary.

Thanks,
-- Hauke D

Jean Deruelle

unread,
Oct 17, 2008, 3:41:56 PM10/17/08
to mobicent...@googlegroups.com
Issue created http://code.google.com/p/mobicents/issues/detail?id=418
Will try to fix it ASAP

Jean

Hauke X

unread,
Oct 21, 2008, 3:34:57 AM10/21/08
to mobicents-public

Thank you Jean and Vladimir, I will compare my code to yours so that
hopefully either I can make the issue reproducible or find the problem
with my code ;)

Regards,
-- Hauke D


On Oct 17, 9:41 pm, "Jean Deruelle" <jean.derue...@gmail.com> wrote:
> Issue createdhttp://code.google.com/p/mobicents/issues/detail?id=418
Reply all
Reply to author
Forward
0 new messages