VOIPTEST_220_delete delay

Im Moment wurden die sessions ja nach 30 sekunden hardcoded abgeräumt.
Dieser patch macht das konfigurabel.

ersetzt den letzten patch "added_delete_delay_for_memory_cleanup.patch".

Author:    Frederic-Philippe Metz <Frederic.Metz@1und1.de>
pull/60/head
Frederic-Philippe Metz 11 years ago committed by Richard Fuchs
parent 0e531ebdf2
commit 59329ddd04

@ -181,6 +181,7 @@ option and which are reproduced below:
-E, --log-stderr Log on stderr instead of syslog
-x, --xmlrpc-format=INT XMLRPC timeout request format to use. 0: SEMS DI, 1: call-id only
--num-threads=INT Number of worker threads to create
-d, --delete-delay Delay for deleting a session from memory.
--sip-source Use SIP source address by default
--dtls-passive Always prefer DTLS passive role
@ -345,6 +346,10 @@ The options are described in more detail below.
Enabled the `DTLS=passive` flag for all calls unconditionally.
* -d, --delete-delay
Delete the call from memory after the specified delay from memory.
* -r, --redis, -R, --redis-db, -b, --b2b-url
NGCP-specific options

@ -36,10 +36,6 @@
#ifndef DELETE_DELAY
#define DELETE_DELAY 30
#endif
#ifndef PORT_RANDOM_MIN
#define PORT_RANDOM_MIN 6
#define PORT_RANDOM_MAX 20
@ -1093,6 +1089,9 @@ next:
if (good)
goto out;
if (c->ml_deleted)
goto out;
for (i = c->monologues; i; i = i->next) {
ml = i->data;
memset(&ml->terminated,0,sizeof(struct timeval));
@ -2902,15 +2901,15 @@ int call_delete_branch(struct callmaster *m, const str *callid, const str *branc
*/
ilog(LOG_INFO, "Scheduling deletion of call branch '"STR_FORMAT"' in %d seconds",
STR_FMT(&ml->tag), DELETE_DELAY);
ml->deleted = poller_now + DELETE_DELAY;
STR_FMT(&ml->tag), m->conf.delete_delay);
ml->deleted = poller_now + m->conf.delete_delay;
if (!c->ml_deleted || c->ml_deleted > ml->deleted)
c->ml_deleted = ml->deleted;
goto success_unlock;
del_all:
ilog(LOG_INFO, "Scheduling deletion of entire call in %d seconds", DELETE_DELAY);
c->deleted = poller_now + DELETE_DELAY;
ilog(LOG_INFO, "Scheduling deletion of entire call in %d seconds", m->conf.delete_delay);
c->deleted = poller_now + m->conf.delete_delay;
rwlock_unlock_w(&c->master_lock);
goto success;

@ -370,6 +370,7 @@ struct callmaster_config {
int port_max;
unsigned int timeout;
unsigned int silent_timeout;
unsigned int delete_delay;
struct redis *redis;
char *b2b_url;
unsigned char default_tos;

@ -107,6 +107,7 @@ static int redis_db = -1;
static char *b2b_url;
static enum xmlrpc_format xmlrpc_fmt = XF_SEMS;
static int num_threads;
static int delete_delay = 30;
static void sighandler(gpointer x) {
@ -340,10 +341,11 @@ static void options(int *argc, char ***argv) {
{ "b2b-url", 'b', 0, G_OPTION_ARG_STRING, &b2b_url, "XMLRPC URL of B2B UA" , "STRING" },
{ "log-level", 'L', 0, G_OPTION_ARG_INT, (void *)&log_level,"Mask log priorities above this level","INT" },
{ "log-facility",0, 0, G_OPTION_ARG_STRING, &log_facility_s, "Syslog facility to use for logging", "daemon|local0|...|local7"},
{ "log-facility-cdr",0, 0, G_OPTION_ARG_STRING, &log_facility_cdr_s, "Syslog facility to use for logging CDRs", "daemon|local0|...|local7"},
{ "log-facility-cdr",0, 0, G_OPTION_ARG_STRING, &log_facility_cdr_s, "Syslog facility to use for logging CDRs", "daemon|local0|...|local7"},
{ "log-stderr", 'E', 0, G_OPTION_ARG_NONE, &_log_stderr, "Log on stderr instead of syslog", NULL },
{ "xmlrpc-format",'x', 0, G_OPTION_ARG_INT, &xmlrpc_fmt, "XMLRPC timeout request format to use. 0: SEMS DI, 1: call-id only", "INT" },
{ "num-threads", 0, 0, G_OPTION_ARG_INT, &num_threads, "Number of worker threads to create", "INT" },
{ "delete-delay", 'd', 0, G_OPTION_ARG_INT, &delete_delay, "Delay for deleting a session from memory.", "INT" },
{ "sip-source", 0, 0, G_OPTION_ARG_NONE, &sip_source, "Use SIP source address by default", NULL },
{ "dtls-passive", 0, 0, G_OPTION_ARG_NONE, &dtls_passive_def,"Always prefer DTLS passive role", NULL },
{ NULL, }
@ -608,6 +610,7 @@ no_kernel:
mc.port_max = port_max;
mc.timeout = timeout;
mc.silent_timeout = silent_timeout;
mc.delete_delay = delete_delay;
mc.default_tos = tos;
mc.b2b_url = b2b_url;
mc.fmt = xmlrpc_fmt;

@ -22,3 +22,4 @@ TABLE=0
# LOG_FACILITY=daemon
# LOG_FACILITY_CDR=daemon
# NUM_THREADS=5
# DELETE_DELAY=30

@ -71,6 +71,7 @@ OPTIONS="$OPTIONS --table=$TABLE"
[ -z "$LOG_FACILITY" ] || OPTIONS="$OPTIONS --log-facility=$LOG_FACILITY"
[ -z "$LOG_FACILITY_CDR" ] || OPTIONS="$OPTIONS --log-facility-cdr=$LOG_FACILITY_CDR"
[ -z "$NUM_THREADS" ] || OPTIONS="$OPTIONS --num-threads=$NUM_THREADS"
[ -z "$DELETE_DELAY" ] || OPTIONS="$OPTIONS --delete-delay=$DELETE_DELAY"
if test "$FORK" = "no" ; then
OPTIONS="$OPTIONS --foreground"
fi

@ -152,6 +152,11 @@ build_opts() {
OPTS+=" --num-threads=$NUM_THREADS"
fi
if [[ -n "$DELETE_DELAY" ]]
then
OPTS+=" --delete-delay=$DELETE_DELAY"
fi
if [[ -n "$LOG_FACILITY_CDR" ]]
then
OPTS+=" --log-facility-cdr=$LOG_FACILITY_CDR"

@ -37,6 +37,7 @@ LISTEN_UDP=127.0.0.1:2222 # IP address and port combination for UDP
#LOG_FACILITY=daemon # Syslog facility to use
#LOG_FACILITY_CDR=daemon # Syslog facility to write CDRs
#NUM_THREADS=5 # How many worker threads to launch
#DELETE_DELAY=30 # Delay to delete session from memory
# The following items are for use with NGCP
#REDIS=127.0.0.1:6379

Loading…
Cancel
Save