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

Author: Stefan Sayer <[email protected]>
Committer: Stefan Sayer <[email protected]>
Date:   Sat Dec 21 19:36:42 2013 +0100

sbc: core_options_handling=yes will make standard OPTIONS processing in the core

thanks to Carsen Bock for reporting

---

 apps/sbc/SBC.cpp      |   11 +++++++++++
 apps/sbc/SBC.h        |    2 ++
 apps/sbc/etc/sbc.conf |    4 ++++
 3 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/apps/sbc/SBC.cpp b/apps/sbc/SBC.cpp
index fd7fac9..94bda93 100644
--- a/apps/sbc/SBC.cpp
+++ b/apps/sbc/SBC.cpp
@@ -149,6 +149,7 @@ SimpleRelayCreator::createGenericRelay(SBCCallProfile& 
call_profile,
 SBCFactory::SBCFactory(const string& _app_name)
   : AmSessionFactory(_app_name), 
     AmDynInvokeFactory(_app_name),
+    core_options_handling(false),
     callLegCreator(new CallLegCreator()),
     simpleRelayCreator(new SimpleRelayCreator())
 {
@@ -230,6 +231,9 @@ int SBCFactory::onLoad()
     INFO("loaded regex mapping '%s'\n", it->c_str());
   }
 
+  core_options_handling = cfg.getParameter("core_options_handling") == "yes";
+  DBG("OPTIONS messages handled by the core: %s\n", 
core_options_handling?"yes":"no");
+
   if (!AmPlugIn::registerApplication(MOD_NAME, this)) {
     ERROR("registering "MOD_NAME" application\n");
     return -1;
@@ -353,6 +357,13 @@ void oodHandlingTerminated(const AmSipRequest &req, 
vector<AmDynInvoke*>& cc_mod
 void SBCFactory::onOoDRequest(const AmSipRequest& req)
 {
   DBG("processing message %s %s\n", req.method.c_str(), req.r_uri.c_str());  
+
+  if (core_options_handling && req.method == SIP_METH_OPTIONS) {
+    DBG("processing OPTIONS in core\n");
+    AmSessionFactory::onOoDRequest(req);
+    return;
+  }
+
   profiles_mut.lock();
 
   ParamReplacerCtx ctx;
diff --git a/apps/sbc/SBC.h b/apps/sbc/SBC.h
index ab1899e..0c7e057 100644
--- a/apps/sbc/SBC.h
+++ b/apps/sbc/SBC.h
@@ -72,6 +72,8 @@ class SBCFactory: public AmSessionFactory,
   vector<string> active_profile;
   AmMutex profiles_mut;
 
+  bool core_options_handling;
+
   auto_ptr<CallLegCreator> callLegCreator;
   auto_ptr<SimpleRelayCreator> simpleRelayCreator;
 
diff --git a/apps/sbc/etc/sbc.conf b/apps/sbc/etc/sbc.conf
index e5dab80..b30b482 100644
--- a/apps/sbc/etc/sbc.conf
+++ b/apps/sbc/etc/sbc.conf
@@ -31,6 +31,10 @@ active_profile=transparent
 # e.g. load_cc_plugins=cc_pcalls;cc_ctl
 #load_cc_plugins=cc_pcalls;cc_ctl
 
+# handle OPTIONS messages in the core? (with limits etc)
+# Default: no
+#core_options_handling=yes
+
 ## RFC4028 Session Timer
 # default configuration - can be overridden by call profiles
 

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

Reply via email to