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

Author: Raphael Coeffic <[email protected]>
Committer: Raphael Coeffic <[email protected]>
Date:   Wed Apr 27 12:32:05 2011 +0200

changed from reply(cseq,...) to reply(tt,...).

using only cseq does not work with CANCEL replies.

---

 apps/sbc/SBC.cpp      |    2 +-
 core/AmB2BSession.cpp |    1 -
 core/AmSession.cpp    |    2 +-
 core/AmSipDialog.cpp  |   14 ++++++++------
 core/AmSipDialog.h    |    2 +-
 5 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/apps/sbc/SBC.cpp b/apps/sbc/SBC.cpp
index 1a28135..200f614 100644
--- a/apps/sbc/SBC.cpp
+++ b/apps/sbc/SBC.cpp
@@ -879,7 +879,7 @@ void SBCDialog::onBye(const AmSipRequest& req)
 
 void SBCDialog::onCancel(const AmSipRequest& cancel)
 {
-  dlg.reply(cancel.cseq, 487, "Request terminated");
+  dlg.bye();
   stopCall();
 }
 
diff --git a/core/AmB2BSession.cpp b/core/AmB2BSession.cpp
index d94129d..33d94df 100644
--- a/core/AmB2BSession.cpp
+++ b/core/AmB2BSession.cpp
@@ -1012,7 +1012,6 @@ void AmB2BCallerSession::onInvite(const AmSipRequest& req)
 
 void AmB2BCallerSession::onCancel(const AmSipRequest& cancel)
 {
-  dlg.reply(cancel.cseq, 487, "Request terminated");
   terminateOtherLeg();
   terminateLeg();
 }
diff --git a/core/AmSession.cpp b/core/AmSession.cpp
index 36366fa..a6ea0d7 100644
--- a/core/AmSession.cpp
+++ b/core/AmSession.cpp
@@ -883,7 +883,7 @@ void AmSession::onBye(const AmSipRequest& req)
 
 void AmSession::onCancel(const AmSipRequest& cancel)
 {
-  dlg.reply(cancel.cseq, 487, "Request terminated");
+  dlg.bye();
   setStopped();
 }
 
diff --git a/core/AmSipDialog.cpp b/core/AmSipDialog.cpp
index 1531d89..19bffbe 100644
--- a/core/AmSipDialog.cpp
+++ b/core/AmSipDialog.cpp
@@ -972,10 +972,11 @@ int AmSipDialog::reply(const AmSipRequest& req,
                       const string& hdrs,
                       int flags)
 {
-  return reply(req.cseq,code,reason,content_type,body,hdrs,flags);
+  return reply(AmSipTransaction(req.method,req.cseq,req.tt),
+              code,reason,content_type,body,hdrs,flags);
 }
 
-int AmSipDialog::reply(unsigned int  req_cseq,
+int AmSipDialog::reply(const AmSipTransaction& t,
                       unsigned int  code,
                       const string& reason,
                       const string& content_type,
@@ -983,19 +984,19 @@ int AmSipDialog::reply(unsigned int  req_cseq,
                       const string& hdrs,
                       int flags)
 {
-  TransMap::const_iterator t_it = uas_trans.find(req_cseq);
+  TransMap::const_iterator t_it = uas_trans.find(t.cseq);
   if(t_it == uas_trans.end()){
     ERROR("could not find any transaction matching request cseq\n");
     ERROR("request cseq=%i; reply code=%i; callid=%s; local_tag=%s; "
          "remote_tag=%s\n",
-         req_cseq,code,callid.c_str(),
+         t.cseq,code,callid.c_str(),
          local_tag.c_str(),remote_tag.c_str());
     return -1;
   }
   DBG("reply: transaction found!\n");
     
   string m_hdrs = hdrs;
-  const AmSipTransaction& t = t_it->second;
+  //const AmSipTransaction& t = t_it->second;
   AmSipReply reply;
 
   reply.code = code;
@@ -1139,7 +1140,8 @@ int AmSipDialog::bye(const string& hdrs, int flags)
                 it != uas_trans.end(); it++) {
              if (it->second.method == "INVITE"){
                // let quit this call by sending final reply
-               return reply(it->second.cseq,500,"Internal error");
+               return reply(it->second,
+                            487,"Request terminated");
              }
            }
 
diff --git a/core/AmSipDialog.h b/core/AmSipDialog.h
index 9330c6a..7d7f132 100644
--- a/core/AmSipDialog.h
+++ b/core/AmSipDialog.h
@@ -240,7 +240,7 @@ private:
            int flags = 0);
 
   /** @return 0 on success */
-  int reply(unsigned int  req_cseq,
+  int reply(const AmSipTransaction& t,
            unsigned int  code, 
            const string& reason,
            const string& content_type = "",

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

Reply via email to