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

Author: Stefan Sayer <[email protected]>
Committer: Stefan Sayer <[email protected]>
Date:   Tue Nov 29 15:12:31 2011 +0100

sbc: make session_timer only required if SST used

---

 apps/sbc/SBC.cpp            |   19 +++++++++++++++++--
 apps/sbc/SBCCallProfile.cpp |    6 ++++++
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/apps/sbc/SBC.cpp b/apps/sbc/SBC.cpp
index 6a73ccc..66a2b8f 100644
--- a/apps/sbc/SBC.cpp
+++ b/apps/sbc/SBC.cpp
@@ -79,8 +79,8 @@ int SBCFactory::onLoad()
 
   session_timer_fact = AmPlugIn::instance()->getFactory4Seh("session_timer");
   if(!session_timer_fact) {
-    ERROR("could not load session_timer from session_timer plug-in\n");
-    return -1;
+    WARN("session_timer plug-in not loaded - "
+        "SIP Session Timers will not be supported\n");
   }
 
   vector<string> profiles_names = explode(cfg.getParameter("profiles"), ",");
@@ -268,6 +268,11 @@ AmSession* SBCFactory::onInvite(const AmSipRequest& req, 
const string& app_name,
 #undef SST_CFG_REPLACE_PARAMS
 
     try {
+      if (NULL == session_timer_fact) {
+       ERROR("session_timer module not loaded - unable to create call with 
SST\n");
+       throw AmSession::Exception(500, SIP_REPLY_SERVER_INTERNAL_ERROR);
+      }
+
       if (!session_timer_fact->onInvite(req, sst_a_cfg)) {
        profiles_mut.unlock();
        throw AmSession::Exception(500, SIP_REPLY_SERVER_INTERNAL_ERROR);
@@ -297,6 +302,11 @@ AmSession* SBCFactory::onInvite(const AmSipRequest& req, 
const string& app_name,
   }
 
   if (sst_a_enabled) {
+    if (NULL == session_timer_fact) {
+      ERROR("session_timer module not loaded - unable to create call with 
SST\n");
+      throw AmSession::Exception(500, SIP_REPLY_SERVER_INTERNAL_ERROR);
+    }
+
     AmSessionEventHandler* h = session_timer_fact->getHandler(b2b_dlg);
     if(!h) {
       profiles_mut.unlock();
@@ -1433,6 +1443,11 @@ void SBCDialog::createCalleeSession()
   }
 
   if (call_profile.sst_enabled == "yes") {
+    if (NULL == SBCFactory::session_timer_fact) {
+      ERROR("session_timer module not loaded - unable to create call with 
SST\n");
+      throw AmSession::Exception(500, SIP_REPLY_SERVER_INTERNAL_ERROR);
+    }
+
     AmSessionEventHandler* h = 
SBCFactory::session_timer_fact->getHandler(callee_session);
     if(!h) {
       ERROR("could not get a session timer event handler\n");
diff --git a/apps/sbc/SBCCallProfile.cpp b/apps/sbc/SBCCallProfile.cpp
index 29e536a..3fc6060 100644
--- a/apps/sbc/SBCCallProfile.cpp
+++ b/apps/sbc/SBCCallProfile.cpp
@@ -131,6 +131,12 @@ bool SBCCallProfile::readFromConfiguration(const string& 
name,
     }
 
   if (sst_enabled != "no") {
+    if (NULL == SBCFactory::session_timer_fact) {
+      ERROR("session_timer module not loaded thus SST not supported, but "
+           "required for profile '%s' (%s)\n", name.c_str(), 
profile_file_name.c_str());
+      return false;
+    }
+
     sst_b_cfg.setParameter("enable_session_timer", "yes");
     // create sst_cfg with values from aleg_*
     CP_SST_CFGVAR("", "session_expires", sst_b_cfg);

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

Reply via email to