makes log level of unhandled (positive) replies configurable

git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@1231 8eb893ce-cfd4-0310-b710-fb5ebe64c474
sayer/1.4-spce2.6
Stefan Sayer 18 years ago
parent 4318da87eb
commit 79f015916c

@ -63,6 +63,7 @@ string AmConfig::Application = "";
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 @@ int AmConfig::readConfiguration()
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)") {

@ -125,6 +125,8 @@ struct AmConfig
static bool LogSessions;
static int UnhandledReplyLoglevel;
/** Init function. Resolves SMTP server address. */
static int init();

@ -42,12 +42,18 @@ AmSipDispatcher* AmSipDispatcher::instance()
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)

@ -250,7 +250,8 @@ loglevel=2
#
# - 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 @@ loglevel=2
#
# 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

Loading…
Cancel
Save