diff --git a/apps/ivr/Ivr.cpp b/apps/ivr/Ivr.cpp index befdf123..997de6fd 100644 --- a/apps/ivr/Ivr.cpp +++ b/apps/ivr/Ivr.cpp @@ -113,6 +113,19 @@ extern "C" { return PyString_FromString(res.c_str()); } + + static PyObject* ivr_ignoreSigchld(PyObject*, PyObject* args) + { + int* ignore; + if(!PyArg_ParseTuple(args,"i",&ignore)) + return NULL; + + AmConfig::IgnoreSIGCHLD = ignore; + DBG("%sgnoring SIGCHLD.\n", ignore?"I":"Not i"); + + return Py_None; + } + static PyObject* ivr_getSessionParam(PyObject*, PyObject* args) { char* headers; @@ -165,6 +178,7 @@ extern "C" { {"getHeader", (PyCFunction)ivr_getHeader, METH_VARARGS,"Python getHeader wrapper"}, {"getSessionParam", (PyCFunction)ivr_getSessionParam, METH_VARARGS,"Python getSessionParam wrapper"}, {"createThread", (PyCFunction)ivr_createThread, METH_VARARGS, "Create another interpreter thread"}, + {"setIgnoreSigchld", (PyCFunction)ivr_ignoreSigchld, METH_VARARGS, "ignore SIGCHLD signal"}, {NULL} /* Sentinel */ }; } diff --git a/core/AmConfig.cpp b/core/AmConfig.cpp index e48832d0..a1572ef1 100644 --- a/core/AmConfig.cpp +++ b/core/AmConfig.cpp @@ -66,6 +66,7 @@ vector AmConfig::CodecOrder; Dtmf::InbandDetectorType AmConfig::DefaultDTMFDetector = Dtmf::SEMSInternal; +bool AmConfig::IgnoreSIGCHLD = false; AmSessionTimerConfig AmConfig::defaultSessionTimerConfig; diff --git a/core/AmConfig.h b/core/AmConfig.h index c220c8f7..c8b34286 100644 --- a/core/AmConfig.h +++ b/core/AmConfig.h @@ -111,6 +111,8 @@ struct AmConfig static Dtmf::InbandDetectorType DefaultDTMFDetector; + static bool IgnoreSIGCHLD; + /** Init function. Resolves SMTP server address. */ static int init(); diff --git a/core/sems.cpp b/core/sems.cpp index a32e2b0d..9327337d 100644 --- a/core/sems.cpp +++ b/core/sems.cpp @@ -84,6 +84,9 @@ int deamon_mode=1; static void sig_usr_un(int signo) { + if (signo == SIGCHLD && AmConfig::IgnoreSIGCHLD) + return; + WARN("signal %d received\n", signo); if(!main_pid || (main_pid == getpid())){