[Opalvoip-svn] SF.net SVN: opalvoip:[20786] opal/branches/rjongbloed/BarnardPlus/src/sip
Brought to you by:
csoutheren,
rjongbloed
From: <rjo...@us...> - 2008-08-31 04:59:29
|
Revision: 20786 http://opalvoip.svn.sourceforge.net/opalvoip/?rev=20786&view=rev Author: rjongbloed Date: 2008-08-31 04:59:39 +0000 (Sun, 31 Aug 2008) Log Message: ----------- Compensated for some brain dead server that does not send NOTIFY messages for MWI in the context of the SUBSCRIBE dialog as it should. We get NOTIFY messages with incorrect call-id and random sequence numbers. Ughh! Modified Paths: -------------- opal/branches/rjongbloed/BarnardPlus/src/sip/handlers.cxx opal/branches/rjongbloed/BarnardPlus/src/sip/sipep.cxx Modified: opal/branches/rjongbloed/BarnardPlus/src/sip/handlers.cxx =================================================================== --- opal/branches/rjongbloed/BarnardPlus/src/sip/handlers.cxx 2008-08-31 04:30:59 UTC (rev 20785) +++ opal/branches/rjongbloed/BarnardPlus/src/sip/handlers.cxx 2008-08-31 04:59:39 UTC (rev 20786) @@ -572,23 +572,26 @@ unsigned requestCSeq = request.GetMIME().GetCSeq().AsUnsigned(); - if (lastReceivedCSeq == 0) - lastReceivedCSeq = requestCSeq; - else if (requestCSeq > lastReceivedCSeq) - lastReceivedCSeq = requestCSeq; - else if (requestCSeq == lastReceivedCSeq) - return endpoint.SendResponse(SIP_PDU::Successful_OK, *transport, request); - else - return endpoint.SendResponse(SIP_PDU::Failure_InternalServerError, *transport, request); + // If we received a NOTIFY before + if (lastReceivedCSeq != 0) { + /* And this NOTIFY is older than the last, with a check for server bugs were + the sequence number changes dramatically, then is a retransmission so + simply send teh OK again, but do not process it. */ + if (requestCSeq < lastReceivedCSeq && (lastReceivedCSeq - requestCSeq) < 10) { + PTRACE(3, "SIP\tReceived duplicate NOTIFY"); + return endpoint.SendResponse(SIP_PDU::Successful_OK, *transport, request); + } + PTRACE_IF(3, requestCSeq != lastReceivedCSeq+1, + "SIP\tReceived unexpected NOTIFY sequence number " << requestCSeq << ", expecting " << lastReceivedCSeq+1); + } - PTRACE(3, "SIP\tFound a SUBSCRIBE corresponding to the NOTIFY"); + lastReceivedCSeq = requestCSeq; + // We received a NOTIFY corresponding to an active SUBSCRIBE // for which we have just unSUBSCRIBEd. That is the final NOTIFY. // We can remove the SUBSCRIBE from the list. - if (GetState() != SIPHandler::Subscribed && expire == 0) { - PTRACE(3, "SIP\tFinal NOTIFY received"); - } + PTRACE_IF(3, GetState() != SIPHandler::Subscribed && expire == 0, "SIP\tFinal NOTIFY received"); PString state = request.GetMIME().GetSubscriptionState(); Modified: opal/branches/rjongbloed/BarnardPlus/src/sip/sipep.cxx =================================================================== --- opal/branches/rjongbloed/BarnardPlus/src/sip/sipep.cxx 2008-08-31 04:30:59 UTC (rev 20785) +++ opal/branches/rjongbloed/BarnardPlus/src/sip/sipep.cxx 2008-08-31 04:59:39 UTC (rev 20786) @@ -712,6 +712,7 @@ return PFalse; } + PTRACE(3, "SIP\tFound a SUBSCRIBE corresponding to the NOTIFY"); if (!handler->OnReceivedNOTIFY(pdu)) return PFalse; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |