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

Author: Raphael Coeffic <[email protected]>
Committer: Raphael Coeffic <[email protected]>
Date:   Sat Feb 19 22:57:33 2011 +0100

moves the OPTIONS handling from AmSipDispatcher to AmSessionFactory.

patch by Robert Szokovacs.

---

 core/AmApi.cpp           |   16 ++++++++++++++++
 core/AmApi.h             |    2 +-
 core/AmSipDispatcher.cpp |   16 +---------------
 3 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/core/AmApi.cpp b/core/AmApi.cpp
index 0cce1d7..74489a9 100644
--- a/core/AmApi.cpp
+++ b/core/AmApi.cpp
@@ -76,6 +76,22 @@ void AmSessionFactory::configureSession(AmSession* sess) {
 
 void AmSessionFactory::onOoDRequest(const AmSipRequest& req)
 {
+  if(req.method == "OPTIONS"){
+      
+      // Basic OPTIONS support
+    if (!AmConfig::OptionsSessionLimit || 
+       (AmSession::getSessionNum() < AmConfig::OptionsSessionLimit)) {
+      AmSipDialog::reply_error(req, 200, "OK");
+    } else {
+      // return error code if near to overload
+      AmSipDialog::reply_error(req,
+                              AmConfig::OptionsSessionLimitErrCode, 
+                              AmConfig::OptionsSessionLimitErrReason);
+    }
+      return;
+
+  }
+
     ERROR("sorry, we don't support beginning a new session with "
          "a '%s' message\n", req.method.c_str());
     
diff --git a/core/AmApi.h b/core/AmApi.h
index df7b997..c3358fb 100644
--- a/core/AmApi.h
+++ b/core/AmApi.h
@@ -182,7 +182,7 @@ class AmSessionFactory: public AmPluginFactory
 
   /**
    * Method to receive any out-of-dialog request 
-   * other than INVITE, REFER and OPTIONS
+   * other than INVITE and REFER
    *
    * Warning:
    *   This method should not make any expensive
diff --git a/core/AmSipDispatcher.cpp b/core/AmSipDispatcher.cpp
index 0745c31..ac8dc85 100644
--- a/core/AmSipDispatcher.cpp
+++ b/core/AmSipDispatcher.cpp
@@ -95,21 +95,7 @@ void AmSipDispatcher::handleSipMsg(AmSipRequest &req)
       
       AmSessionContainer::instance()->startSessionUAS(req);
   }
-  else if(req.method == "OPTIONS"){
-      
-      // Basic OPTIONS support
-    if (!AmConfig::OptionsSessionLimit || 
-       (AmSession::getSessionNum() < AmConfig::OptionsSessionLimit)) {
-      AmSipDialog::reply_error(req, 200, "OK");
-    } else {
-      // return error code if near to overload
-      AmSipDialog::reply_error(req,
-                              AmConfig::OptionsSessionLimitErrCode, 
-                              AmConfig::OptionsSessionLimitErrReason);
-    }
-      return;
-
-  } else if( (req.method == "CANCEL") || 
+  else if( (req.method == "CANCEL") || 
             (req.method == "BYE") ){
       
     // CANCEL/BYE of a (here) non-existing dialog

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

Reply via email to