Author: sayer
Date: 2009-01-20 15:54:10 +0100 (Tue, 20 Jan 2009)
New Revision: 1231
Modified:
trunk/core/AmConfig.cpp
trunk/core/AmConfig.h
trunk/core/AmSipDispatcher.cpp
trunk/core/etc/sems.conf.sample
Log:
makes log level of unhandled (positive) replies configurable
Modified: trunk/core/AmConfig.cpp
===================================================================
--- trunk/core/AmConfig.cpp 2009-01-20 14:52:58 UTC (rev 1230)
+++ trunk/core/AmConfig.cpp 2009-01-20 14:54:10 UTC (rev 1231)
@@ -63,6 +63,7 @@
AmConfig::ApplicationSelector AmConfig::AppSelect =
AmConfig::App_SPECIFIED;
AmConfig::AppMappingVector AmConfig::AppMapping;
bool AmConfig::LogSessions = false;
+int AmConfig::UnhandledReplyLoglevel = 0;
unsigned int AmConfig::SessionLimit = 0;
unsigned int AmConfig::SessionLimitErrCode = 503;
@@ -226,6 +227,17 @@
LogSessions = cfg.getParameter("log_sessions")=="yes";
+ if (cfg.hasParameter("unhandled_reply_loglevel")) {
+ string msglog = cfg.getParameter("unhandled_reply_loglevel");
+ if (msglog == "no") UnhandledReplyLoglevel = -1;
+ else if (msglog == "error") UnhandledReplyLoglevel = 0;
+ else if (msglog == "warn") UnhandledReplyLoglevel = 1;
+ else if (msglog == "info") UnhandledReplyLoglevel = 2;
+ else if (msglog == "debug") UnhandledReplyLoglevel = 3;
+ else ERROR("Could not interpret unhandled_reply_loglevel \"%s\"\n",
+ msglog.c_str());
+ }
+
Application = cfg.getParameter("application");
if (Application == "$(ruri.user)") {
Modified: trunk/core/AmConfig.h
===================================================================
--- trunk/core/AmConfig.h 2009-01-20 14:52:58 UTC (rev 1230)
+++ trunk/core/AmConfig.h 2009-01-20 14:54:10 UTC (rev 1231)
@@ -125,6 +125,8 @@
static bool LogSessions;
+ static int UnhandledReplyLoglevel;
+
/** Init function. Resolves SMTP server address. */
static int init();
Modified: trunk/core/AmSipDispatcher.cpp
===================================================================
--- trunk/core/AmSipDispatcher.cpp 2009-01-20 14:52:58 UTC (rev 1230)
+++ trunk/core/AmSipDispatcher.cpp 2009-01-20 14:54:10 UTC (rev 1231)
@@ -42,12 +42,18 @@
void AmSipDispatcher::handleSipMsg(AmSipReply &reply)
{
- AmSipReplyEvent* ev = new AmSipReplyEvent(reply);
- if(!AmEventDispatcher::instance()->post(reply.local_tag,ev)){
-
- ERROR("could not dispatch reply: %s\n", reply.print().c_str());
- delete ev;
+ AmSipReplyEvent* ev = new AmSipReplyEvent(reply);
+ if(!AmEventDispatcher::instance()->post(reply.local_tag,ev)){
+ if ((reply.code >= 200) && (reply.code < 300)) {
+ if (AmConfig::UnhandledReplyLoglevel >= 0) {
+ _LOG(AmConfig::UnhandledReplyLoglevel,
+ "unhandled positive reply: %s\n", reply.print().c_str());
+ }
+ } else {
+ ERROR("unhandled reply: %s\n", reply.print().c_str());
}
+ delete ev;
+ }
}
void AmSipDispatcher::handleSipMsg(AmSipRequest &req)
Modified: trunk/core/etc/sems.conf.sample
===================================================================
--- trunk/core/etc/sems.conf.sample 2009-01-20 14:52:58 UTC (rev 1230)
+++ trunk/core/etc/sems.conf.sample 2009-01-20 14:54:10 UTC (rev 1231)
@@ -250,7 +250,8 @@
#
# - use a Server/User-Agent header with the SEMS server
# signature and version.
-# Set server_signature=0 in ser_sems.cfg if you use it.
+# Set server_signature=0 in ser_sems.cfg if you use SER
+# as SIP stack.
#
# default=no
#
@@ -305,3 +306,16 @@
#
# dtmf_detector=spandsp
+# optional parameter: unhandled_reply_loglevel={error|warn|info|debug|no}
+#
+# the default application logic implemented in the applications is to stop
+# the session right after sending BYE, without waiting for a reply. this
+# leads to many log entries of the form
+# ERROR: [b6fa6bb0] handleSipMsg (AmSipDispatcher.cpp:48): unhandled
+# reply: [code:200;phrase:[OK];... ]
+#
+# This parameter sets the log lovel of unhandled positive (200 class) replies.
+#
+# default: error
+#
+# unhandled_reply_loglevel=info
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev