diff --git a/debian/patches/series b/debian/patches/series index b1439a570..65de1f77a 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -50,3 +50,4 @@ upstream/topos_execute_event_route_topos_sending.patch sipwise/rtpengine-tcp-forwarding.patch sipwise/rtpengine-play-media.patch sipwise/registrar_add_path.patch +upstream/limit_the_execution_of_dialplan_reload.patch diff --git a/debian/patches/upstream/limit_the_execution_of_dialplan_reload.patch b/debian/patches/upstream/limit_the_execution_of_dialplan_reload.patch new file mode 100644 index 000000000..dfb8b8c0d --- /dev/null +++ b/debian/patches/upstream/limit_the_execution_of_dialplan_reload.patch @@ -0,0 +1,94 @@ +From 926a97f4eb741401b193fb711e6c439555c646ab Mon Sep 17 00:00:00 2001 +From: Marco Capetta +Date: Mon, 6 May 2019 11:07:44 +0200 +Subject: [PATCH] dialplan: add reload_delta parameter + +- make the rate limit of maximum allowed dialplan reload configurable +using the new 'reload_delta' paramenter. +--- + +--- a/src/modules/dialplan/dialplan.c ++++ b/src/modules/dialplan/dialplan.c +@@ -87,6 +87,7 @@ dp_param_p default_par2 = NULL; + int dp_fetch_rows = 1000; + int dp_match_dynamic = 0; + int dp_append_branch = 1; ++int dp_reload_delta = 5; + + static time_t *dp_rpc_reload_time = NULL; + +@@ -105,6 +106,7 @@ static param_export_t mod_params[]={ + { "fetch_rows", PARAM_INT, &dp_fetch_rows }, + { "match_dynamic", PARAM_INT, &dp_match_dynamic }, + { "append_branch", PARAM_INT, &dp_append_branch }, ++ { "reload_delta", PARAM_INT, &dp_reload_delta }, + {0,0,0} + }; + +@@ -184,6 +186,9 @@ static int mod_init(void) + if(dp_fetch_rows<=0) + dp_fetch_rows = 1000; + ++ if(dp_reload_delta<0) ++ dp_reload_delta = 5; ++ + if(init_data() != 0) { + LM_ERR("could not initialize data\n"); + return -1; +@@ -621,7 +626,7 @@ static void dialplan_rpc_reload(rpc_t* r + rpc->fault(ctx, 500, "Not ready for reload"); + return; + } +- if(*dp_rpc_reload_time!=0 && *dp_rpc_reload_time > time(NULL) - 5) { ++ if(*dp_rpc_reload_time!=0 && *dp_rpc_reload_time > time(NULL) - dp_reload_delta) { + LM_ERR("ongoing reload\n"); + rpc->fault(ctx, 500, "ongoing reload"); + return; +--- a/src/modules/dialplan/doc/dialplan_admin.xml ++++ b/src/modules/dialplan/doc/dialplan_admin.xml +@@ -410,6 +410,33 @@ modparam("dialplan", "append_branch", 0) + + + ++
++ <varname>reload_delta</varname> (int) ++ ++ The number of seconds that have to be waited before executing a new reload ++ of dialplan rules. By default there is a rate limiting of maximum one reload ++ in five seconds. ++ ++ ++ If set to 0, no rate limit is configured. Note carefully: use this configuration ++ only in tests environments because executing two dialplan reloads at the same ++ time can cause to kamailio to crash. ++ ++ ++ ++ Default value is 5. ++ ++ ++ ++ Set <varname>reload_delta</varname> parameter ++ ++... ++modparam("dialplan", "reload_delta", 1) ++... ++ ++ ++
++ + + + +@@ -620,8 +647,9 @@ xlog("translated to var $var(y) \n"); + dp_reload() + + +- Reload the translation rules from the database. Note that there is +- a rate limiting of maximum one reload in five seconds. ++ Reload the translation rules from the database. Note that there is a ++ rate limiting defined by 'reload_delta' paramenter. By default is allowed ++ maximum one reload in five seconds. + + + Name: dp_reload