TT#58562 dialplan: add reload_delta parameter

Backported from upstream commit 926a97f4

Change-Id: I8b594b0ddbb5143016d6e917e025d357d62c2d77
changes/51/29651/1
Marco Capetta 7 years ago
parent da0120ba93
commit 0ebf405316

@ -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

@ -0,0 +1,94 @@
From 926a97f4eb741401b193fb711e6c439555c646ab Mon Sep 17 00:00:00 2001
From: Marco Capetta <mcapetta@sipwise.com>
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)
</example>
</section>
+ <section id="dialplan.p.reload_delta">
+ <title><varname>reload_delta</varname> (int)</title>
+ <para>
+ 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.
+ </para>
+ <para>
+ 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.
+ </para>
+ <para>
+ <emphasis>
+ Default value is <quote>5</quote>.
+ </emphasis>
+ </para>
+ <example>
+ <title>Set <varname>reload_delta</varname> parameter</title>
+ <programlisting format="linespecific">
+...
+modparam("dialplan", "reload_delta", 1)
+...
+ </programlisting>
+ </example>
+ </section>
+
</section>
@@ -620,8 +647,9 @@ xlog("translated to var $var(y) \n");
<function moreinfo="none">dp_reload()</function>
</title>
<para>
- 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.
</para>
<para>
Name: <emphasis>dp_reload</emphasis>
Loading…
Cancel
Save