Author: sayer
Date: 2008-04-30 19:25:42 +0200 (Wed, 30 Apr 2008)
New Revision: 927
Modified:
trunk/core/AmB2BSession.cpp
trunk/core/AmConfig.cpp
trunk/core/AmConfig.h
trunk/core/AmSessionContainer.cpp
trunk/core/etc/sems.conf.sample
Log:
optional INFO logging of sessions created and stopped
Modified: trunk/core/AmB2BSession.cpp
===================================================================
--- trunk/core/AmB2BSession.cpp 2008-04-30 17:16:23 UTC (rev 926)
+++ trunk/core/AmB2BSession.cpp 2008-04-30 17:25:42 UTC (rev 927)
@@ -373,6 +373,11 @@
callee_dlg.remote_party = dlg.local_party;
callee_dlg.remote_uri = dlg.local_uri;
+ if (AmConfig::LogSessions) {
+ INFO("Starting B2B callee session %s app %s\n",
+ callee_session->getLocalTag().c_str(), invite_req.cmd.c_str());
+ }
+
callee_session->start();
AmSessionContainer* sess_cont = AmSessionContainer::instance();
Modified: trunk/core/AmConfig.cpp
===================================================================
--- trunk/core/AmConfig.cpp 2008-04-30 17:16:23 UTC (rev 926)
+++ trunk/core/AmConfig.cpp 2008-04-30 17:25:42 UTC (rev 927)
@@ -62,6 +62,7 @@
string AmConfig::Application = "";
AmConfig::ApplicationSelector AmConfig::AppSelect =
AmConfig::App_SPECIFIED;
AmConfig::AppMappingVector AmConfig::AppMapping;
+bool AmConfig::LogSessions = false;
unsigned int AmConfig::SessionLimit = 0;
unsigned int AmConfig::SessionLimitErrCode = 503;
@@ -221,6 +222,8 @@
}
}
+ LogSessions = cfg.getParameter("log_sessions")=="yes";
+
Application = cfg.getParameter("application");
if (Application == "$(ruri.user)") {
Modified: trunk/core/AmConfig.h
===================================================================
--- trunk/core/AmConfig.h 2008-04-30 17:16:23 UTC (rev 926)
+++ trunk/core/AmConfig.h 2008-04-30 17:25:42 UTC (rev 927)
@@ -123,6 +123,8 @@
static bool IgnoreSIGCHLD;
+ static bool LogSessions;
+
/** Init function. Resolves SMTP server address. */
static int init();
Modified: trunk/core/AmSessionContainer.cpp
===================================================================
--- trunk/core/AmSessionContainer.cpp 2008-04-30 17:16:23 UTC (rev 926)
+++ trunk/core/AmSessionContainer.cpp 2008-04-30 17:25:42 UTC (rev 927)
@@ -116,10 +116,12 @@
void AmSessionContainer::stopAndQueue(AmSession* s)
{
ds_mut.lock();
-
- DBG("session cleaner about to stop %s\n",
- s->getLocalTag().c_str());
+ if (AmConfig::LogSessions) {
+ INFO("session cleaner about to stop %s\n",
+ s->getLocalTag().c_str());
+ }
+
s->stop();
d_sessions.push(s);
_run_cond.set(true);
@@ -193,6 +195,12 @@
as_mut.unlock();
return NULL;
}
+
+ if (AmConfig::LogSessions) {
+ INFO("Starting UAC session %s app %s\n",
+ session->getLocalTag().c_str(), req.cmd.c_str());
+ }
+
session->start();
addSession_unsafe(req.callid,"",req.from_tag,session);
@@ -238,6 +246,12 @@
const string& local_tag = session->getLocalTag();
// by default each session is in its own callgroup
session->setCallgroup(local_tag);
+
+ if (AmConfig::LogSessions) {
+ INFO("Starting UAS session %s app %s\n",
+ session->getLocalTag().c_str(), req.cmd.c_str());
+ }
+
session->start();
addSession_unsafe(req.callid,req.from_tag,local_tag,session);
Modified: trunk/core/etc/sems.conf.sample
===================================================================
--- trunk/core/etc/sems.conf.sample 2008-04-30 17:16:23 UTC (rev 926)
+++ trunk/core/etc/sems.conf.sample 2008-04-30 17:25:42 UTC (rev 927)
@@ -48,6 +48,14 @@
# Example:
# syslog_facility=LOCAL0
+# optional parameter: log_sessions=[yes|no]
+#
+# Default: no
+#
+# If log_sessions=yes is set, INFO level log messages are generated
+# for each session when it is started and stopped.
+#
+# log_sessions=yes
# optional parameter: application
#
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev