Module: sems
Branch: rco/offer_answer
Commit: 9e99e087550f582bb026871881ca33a6ddd35a5c
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=9e99e087550f582bb026871881ca33a6ddd35a5c

Author: Raphael Coeffic <[email protected]>
Committer: Raphael Coeffic <[email protected]>
Date:   Thu Apr 21 17:44:31 2011 +0200

handle BYE end-to-end.

---

 apps/sbc/SBC.cpp      |    9 ++++++---
 core/AmB2BSession.cpp |   15 ++++++++++-----
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/apps/sbc/SBC.cpp b/apps/sbc/SBC.cpp
index dd0dc35..1a28135 100644
--- a/apps/sbc/SBC.cpp
+++ b/apps/sbc/SBC.cpp
@@ -799,7 +799,7 @@ void SBCDialog::onSipRequest(const AmSipRequest& req) {
   // todo: this is a hack, replace this by calling proper session 
   // event handler in AmB2BSession
   bool fwd = sip_relay_only &&
-    (req.method != "BYE") &&
+    //(req.method != "BYE") &&
     (req.method != "CANCEL");
   if (fwd) {
       CALL_EVENT_H(onSipRequest,req);
@@ -870,7 +870,10 @@ void SBCDialog::onOtherBye(const AmSipRequest& req)
 
 void SBCDialog::onBye(const AmSipRequest& req)
 {
-  stopCall();
+  DBG("onBye()\n");
+  stopPrepaidAccounting();
+  stopCallTimer();
+  terminateLeg();
 }
 
 
@@ -1147,7 +1150,7 @@ void SBCCalleeSession::onSipRequest(const AmSipRequest& 
req) {
   // todo: this is a hack, replace this by calling proper session 
   // event handler in AmB2BSession
   bool fwd = sip_relay_only &&
-    (req.method != "BYE") &&
+    //(req.method != "BYE") &&
     (req.method != "CANCEL");
   if (fwd) {
       CALL_EVENT_H(onSipRequest,req);
diff --git a/core/AmB2BSession.cpp b/core/AmB2BSession.cpp
index 52550f7..90e4d28 100644
--- a/core/AmB2BSession.cpp
+++ b/core/AmB2BSession.cpp
@@ -130,9 +130,10 @@ void AmB2BSession::onB2BEvent(B2BEvent* ev)
 
        relaySip(req_ev->req);
       }
-      else if( (req_ev->req.method == "BYE") ||
-              (req_ev->req.method == "CANCEL") ) {
-               
+      
+      if( (req_ev->req.method == SIP_METH_BYE) ||
+         (req_ev->req.method == SIP_METH_CANCEL) ) {
+       
        onOtherBye(req_ev->req);
       }
     }
@@ -211,14 +212,18 @@ void AmB2BSession::onB2BEvent(B2BEvent* ev)
 void AmB2BSession::onSipRequest(const AmSipRequest& req)
 {
   bool fwd = sip_relay_only &&
-    (req.method != SIP_METH_BYE) &&
     (req.method != SIP_METH_CANCEL);
 
   if(!fwd)
     AmSession::onSipRequest(req);
   else {
     updateRefreshMethod(req.hdrs);
-    recvd_req.insert(std::make_pair(req.cseq,req));
+
+    if(req.method != SIP_METH_ACK)
+      recvd_req.insert(std::make_pair(req.cseq,req));
+
+    if(req.method == SIP_METH_BYE)
+      onBye(req);
   }
 
   B2BSipRequestEvent* r_ev = new B2BSipRequestEvent(req,fwd);

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

Reply via email to