Mobicents disregards UDP retransmissions

74 views Asked by At

I am running a B2BUA application on top of MSS-Tomcat. I have a situation where a BYE request is processed by my application, but retransmissions of the BYE are discarded as duplicates. I expected the retransmission to be processed as we are using UDP.

We managed to reproduce the issue using SIPP in the attached trace. https://drive.google.com/file/d/0B2ZkUreEJkenVU9YQnBYUDBYVTA/view?usp=drivesdk

Here is a part of the Mobicents log:

2017-05-21 17:58:41,242 DEBUG [EventScanner] (Mobicents-SIP-Servlets-UDPMessageChannelThread-9) sipEvent = gov.nist.javax.sip.RequestEventExt[source=gov.nist.javax.sip.SipProviderImpl@21a77f66]source = gov.nist.javax.sip.SipProviderImpl@21a77f66
2017-05-21 17:58:41,242 DEBUG [EventScanner] (Mobicents-SIP-Servlets-UDPMessageChannelThread-9) deliverEvent : BYE sip:[email protected]:39000;transport=UDP SIP/2.0
transaction gov.nist.javax.sip.stack.SIPServerTransactionImpl@58d4e299 sipEvent.serverTx = gov.nist.javax.sip.stack.SIPServerTransactionImpl@58d4e299
2017-05-21 17:58:41,242 DEBUG [SIPTransactionStack] (Mobicents-SIP-Servlets-UDPMessageChannelThread-9) serverTx: looking for key z9hg4bk-10317-1-6 existing={z9hg4bk-10317-1-0=gov.nist.javax.sip.stack.SIPServerTransactionImpl@58d4e293, z9hg4bk-10317-1-6=gov.nist.javax.sip.stack.SIPServerTransactionImpl@58d4e299}
2017-05-21 17:58:41,242 DEBUG [SIPTransactionStack] (Mobicents-SIP-Servlets-UDPMessageChannelThread-9) findTransaction: returning  : gov.nist.javax.sip.stack.SIPServerTransactionImpl@58d4e299
2017-05-21 17:58:41,242 DEBUG [EventScanner] (Mobicents-SIP-Servlets-UDPMessageChannelThread-9) transaction already exists! gov.nist.javax.sip.stack.SIPServerTransactionImpl@58d4e299
2017-05-21 17:58:41,242 DEBUG [EventScanner] (Mobicents-SIP-Servlets-UDPMessageChannelThread-9) Done processing Message BYE sip:[email protected]:39000;transport=UDP SIP/2.0

And here is what we found as the relevant code in EventScanner:

       if (sipEvent instanceof RequestEvent) {
        try {
            // Check if this request has already created a
            // transaction
            SIPRequest sipRequest = (SIPRequest) ((RequestEvent) sipEvent)
                    .getRequest();

            if (logger.isLoggingEnabled(LogLevels.TRACE_DEBUG)) {
                logger.logDebug(
                        "deliverEvent : "
                                + sipRequest.getFirstLine()
                                + " transaction "
                                + eventWrapper.transaction
                                + " sipEvent.serverTx = "
                                + ((RequestEvent) sipEvent)
                                        .getServerTransaction());
            }

            // Discard the duplicate request if a
            // transaction already exists. If the listener chose
            // to handle the request statelessly, then the listener
            // will see the retransmission.
            // Note that in both of these two cases, JAIN SIP will allow
            // you to handle the request statefully or statelessly.
            // An example of the latter case is REGISTER and an example
            // of the former case is INVITE.

            SIPServerTransaction tx = (SIPServerTransaction) sipStack
                    .findTransaction(sipRequest, true);

            if (tx != null && !tx.passToListener()) {

                // JvB: make an exception for a very rare case: some
                // (broken) UACs use
                // the same branch parameter for an ACK. Such an ACK should
                // be passed
                // to the listener (tx == INVITE ST, terminated upon sending
                // 2xx but
                // lingering to catch retransmitted INVITEs)
                if (sipRequest.getMethod().equals(Request.ACK)
                        && tx.isInviteTransaction() &&
                        ( tx.getLastResponseStatusCode() / 100 == 2 ||
                            sipStack.isNon2XXAckPassedToListener())) {

                    if (logger.isLoggingEnabled(LogLevels.TRACE_DEBUG))
                        logger
                                .logDebug(
                                        "Detected broken client sending ACK with same branch! Passing...");
                } else {
                    if (logger.isLoggingEnabled(LogLevels.TRACE_DEBUG))
                        logger.logDebug(
                                "transaction already exists! " + tx);
                    return;
                }
            } else if (sipStack.findPendingTransaction(sipRequest.getTransactionId()) != null) {
                if (logger.isLoggingEnabled(LogLevels.TRACE_DEBUG))
                    logger.logDebug(
                            "transaction already exists!!");

                return;
            }

We are using jain-sip-ri 1.2.242 in Mobicents/Tomcat version mss-4.0.21-apache-tomcat-8.0.26.

Any help would be greatly appreciated!

0

There are 0 answers