Module: sems
Branch: master
Commit: 35f091aeecaf682cc11f1f3c4e6cf551b4f1a55a
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=35f091aeecaf682cc11f1f3c4e6cf551b4f1a55a

Author: Stefan Sayer <[email protected]>
Committer: Stefan Sayer <[email protected]>
Date:   Fri Dec 10 05:24:46 2010 +0100

b2b b/f: only handle replies with same CSeq as INV

---

 core/AmB2BSession.cpp |   58 ++++++++++++++++++++++++------------------------
 1 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/core/AmB2BSession.cpp b/core/AmB2BSession.cpp
index 7e4459d..819098d 100644
--- a/core/AmB2BSession.cpp
+++ b/core/AmB2BSession.cpp
@@ -535,50 +535,50 @@ void AmB2BCallerSession::onB2BEvent(B2BEvent* ev)
       return;
     }
 
-    DBG("reply received from other leg\n");
+    DBG("%u reply received from other leg\n", reply.code);
       
     switch(callee_status){
     case NoReply:
     case Ringing:
-       
-      if(reply.code < 200){
-       if ((!sip_relay_only) && sip_relay_early_media_sdp && 
-           reply.code>=180 && reply.code<=183 && (!reply.body.empty())) {
-         if (reinviteCaller(reply)) {
-           ERROR("re-INVITEing caller for early session - "
-                 "stopping this and other leg\n");
-           terminateOtherLeg();
-           terminateLeg();
+      if (reply.cseq == invite_req.cseq) {
+       if(reply.code < 200){
+         if ((!sip_relay_only) && sip_relay_early_media_sdp &&
+             reply.code>=180 && reply.code<=183 && (!reply.body.empty())) {
+           if (reinviteCaller(reply)) {
+             ERROR("re-INVITEing caller for early session failed - "
+                   "stopping this and other leg\n");
+             terminateOtherLeg();
+             terminateLeg();
+           }
          }
-       }
          
-       callee_status = Ringing;
-      }
-      else if(reply.code < 300){
+         callee_status = Ringing;
+       } else if(reply.code < 300){
          
-       callee_status  = Connected;
+         callee_status  = Connected;
          
-       if (!sip_relay_only) {
-         sip_relay_only = true;
-         if (reinviteCaller(reply)) {
-           ERROR("re-INVITEing caller - stopping this and other leg\n");
-           terminateOtherLeg();
-           terminateLeg();
+         if (!sip_relay_only) {
+           sip_relay_only = true;
+           if (reinviteCaller(reply)) {
+             ERROR("re-INVITEing caller failed - stopping this and other 
leg\n");
+             terminateOtherLeg();
+             terminateLeg();
+           }
          }
-       }
-      }
-      else {
-       //      DBG("received %i from other leg: other_id=%s; 
reply.local_tag=%s\n",
-       //          reply.code,other_id.c_str(),reply.local_tag.c_str());
+       } else {
+         //    DBG("received %i from other leg: other_id=%s; 
reply.local_tag=%s\n",
+         //        reply.code,other_id.c_str(),reply.local_tag.c_str());
          
-       terminateOtherLeg();
+         terminateOtherLeg();
+       }
+
+       processed = onOtherReply(reply);
       }
        
-      processed = onOtherReply(reply);
       break;
        
     default:
-      DBG("reply from callee: %i %s\n",reply.code,reply.reason.c_str());
+      DBG("reply from callee: %u %s\n",reply.code,reply.reason.c_str());
       break;
     }
   }

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to