Module: sems
Branch: 1.4
Commit: 51cae30c0c7e0d8b53aa5c76359cc1b3ab370b20
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=51cae30c0c7e0d8b53aa5c76359cc1b3ab370b20

Author: Stefan Sayer <[email protected]>
Committer: Stefan Sayer <[email protected]>
Date:   Wed Jun 22 17:33:41 2011 +0200

add wait_for_bye_transaction config parameter, fixes auth of BYE

---

 core/AmConfig.cpp         |    6 ++++++
 core/AmConfig.h           |    2 ++
 core/AmSipDialog.cpp      |   10 +++++++++-
 core/etc/sems.conf.sample |   10 ++++++++++
 4 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/core/AmConfig.cpp b/core/AmConfig.cpp
index c52c798..1e060a0 100644
--- a/core/AmConfig.cpp
+++ b/core/AmConfig.cpp
@@ -105,6 +105,8 @@ AmSipDialog::provisional_100rel AmConfig::rel100      = 
REL100_SUPPORTED;
 
 vector <string> AmConfig::CodecOrder;
 
+bool AmConfig::WaitForByeTransaction = false;
+
 Dtmf::InbandDetectorType 
 AmConfig::DefaultDTMFDetector     = Dtmf::SEMSInternal;
 bool AmConfig::IgnoreSIGCHLD      = true;
@@ -452,6 +454,10 @@ int AmConfig::readConfiguration()
     }
   }
 
+  if(cfg.hasParameter("wait_for_bye_transaction")){
+    WaitForByeTransaction = (cfg.getParameter("wait_for_bye_transaction") == 
"yes");
+  }
+
   // single codec in 200 OK
   if(cfg.hasParameter("single_codec_in_ok")){
     SingleCodecInOK = (cfg.getParameter("single_codec_in_ok") == "yes");
diff --git a/core/AmConfig.h b/core/AmConfig.h
index 4e610dc..a8bf0f1 100644
--- a/core/AmConfig.h
+++ b/core/AmConfig.h
@@ -143,6 +143,8 @@ struct AmConfig
   /** If 200 OK reply should be limited to preferred codec only */
   static bool SingleCodecInOK;
   static vector <string> CodecOrder;
+
+  static bool WaitForByeTransaction;
   
   enum ApplicationSelector {
     App_RURIUSER,
diff --git a/core/AmSipDialog.cpp b/core/AmSipDialog.cpp
index 5bbb4e8..5a37e87 100644
--- a/core/AmSipDialog.cpp
+++ b/core/AmSipDialog.cpp
@@ -363,6 +363,11 @@ void AmSipDialog::updateStatus(const AmSipReply& reply)
        // there is nothing we can do anymore...
       }
     }
+
+    if((trans_method == "BYE") && (reply.code >= 200)){
+      // final reply to BYE: Disconnecting -> Disconnected
+      status = Disconnected;
+    }
     break;
 
   case Pending:
@@ -795,7 +800,10 @@ int AmSipDialog::bye(const string& hdrs, int flags)
            send_200_ack(it->second);
          }
        }
-       status = Disconnected;
+       if (AmConfig::WaitForByeTransaction)
+         status = Disconnecting;
+       else
+         status = Disconnected;
        return sendRequest("BYE", "", "", hdrs, flags);
 
     case Pending:
diff --git a/core/etc/sems.conf.sample b/core/etc/sems.conf.sample
index dd3042b..e6e01e5 100644
--- a/core/etc/sems.conf.sample
+++ b/core/etc/sems.conf.sample
@@ -426,6 +426,16 @@ use_default_signature=yes
 #
 # dtmf_detector=spandsp
 
+# optional parameter: wait_for_bye_transaction={yes|no}
+#
+# when SEMS stops a call sending BYE as UAC, this option sets whether
+# SEMS waits for the BYE transaction to finish before forgetting the call.
+# This may be necessary e.g. to authenticate the BYE request.
+#
+# default: no
+#
+# wait_for_bye_transaction=yes
+
 # optional parameter: unhandled_reply_loglevel={error|warn|info|debug|no}
 # 
 # the default application logic implemented in the applications is to stop 

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

Reply via email to