Search code examples
javaservletssip

SIP servlets, chatserver


I'm trying to get a SIP servlet chat server working, together with the textclient found here.

When I use 2 clients to send messages to eachother (peer to peer), everything goes well. But when I use one or more clients together with my server, I have to wait exactly 32 seconds before the server picks up any new messages in the doMessage() method. I'm using Netbeans together with Sailfin as my SIP server. Is there some kind of limitation or configurable delay or timeout between requests or responses in Sailfin I'm looking over?

I can post the server code, if needed.

Thanks


Solution

  • To answer my own question, if someone ever encounters the same problem, i found this is a bug in the textclient against the following section 8.1.1.7 of RFC 3261.

    The branch parameter value MUST be unique across space and time for all requests sent by the UA. The exceptions to this rule are CANCEL and ACK for non-2xx responses. As discussed below, a CANCEL request will have the same value of the branch parameter as the request it cancels. As discussed in Section 17.1.1.3, an ACK for a non-2xx response will also have the same branch ID as the INVITE whose response it acknowledges.

    The uniqueness property of the branch ID parameter, to facilitate its use as a transaction ID, was not part of RFC 2543.

    The branch ID inserted by an element compliant with this specification MUST always begin with the characters "z9hG4bK".

    The following line in SipLayer.java

    ViaHeader viaHeader = headerFactory.createViaHeader(getHost(),
    getPort(), "udp", "branch1");
    

    Will create every message with the "branch1" parameter. Making this parameter unique fixes the problem.