Browse Source

rtpengine: Add setid_col modparam

Allow setid column name. Updated doku.
Stefan Mititelu 9 years ago
parent
commit
55734eb2ea

+ 22 - 1
modules/rtpengine/doc/rtpengine_admin.xml

@@ -458,12 +458,33 @@ modparam("rtpengine", "hash_table_tout", "300")
         </section>
         </section>
 
 
 
 
+	<section id="rtpengine.p.setid_col">
+		<title><varname>setid_col</varname> (string)</title>
+		<para>
+			Column name in the rtpproxy table. If database mode is activated,
+			set the setid of rtp nodes according to this column, on startup.
+			The MySQL value for this column should be INT UNSIGNED.
+		</para>
+		<para>
+			By default, the column name is "setid".
+		</para>
+		<example>
+		<title>Set <varname>setid_col</varname> parameter</title>
+<programlisting format="linespecific">
+...
+modparam("rtpengine", "setid_col", "setid_column_name")
+...
+</programlisting>
+		</example>
+	</section>
+
+
 	<section id="rtpengine.p.disabled_col">
 	<section id="rtpengine.p.disabled_col">
 		<title><varname>disabled_col</varname> (string)</title>
 		<title><varname>disabled_col</varname> (string)</title>
 		<para>
 		<para>
 			Column name in the rtpproxy table. If database mode is activated,
 			Column name in the rtpproxy table. If database mode is activated,
 			set the state of rtp nodes according to this column, on startup.
 			set the state of rtp nodes according to this column, on startup.
-			The MySQL value for this column is INT.
+			The MySQL value for this column should be INT.
 		</para>
 		</para>
 		<para>
 		<para>
 			By default, the column name is "disabled".
 			By default, the column name is "disabled".

+ 1 - 0
modules/rtpengine/rtpengine.c

@@ -337,6 +337,7 @@ static param_export_t params[] = {
 	{"queried_nodes_limit",   INT_PARAM, &queried_nodes_limit    },
 	{"queried_nodes_limit",   INT_PARAM, &queried_nodes_limit    },
 	{"db_url",                PARAM_STR, &rtpp_db_url            },
 	{"db_url",                PARAM_STR, &rtpp_db_url            },
 	{"table_name",            PARAM_STR, &rtpp_table_name        },
 	{"table_name",            PARAM_STR, &rtpp_table_name        },
+	{"setid_col",             PARAM_STR, &rtpp_setid_col         },
 	{"url_col",               PARAM_STR, &rtpp_url_col           },
 	{"url_col",               PARAM_STR, &rtpp_url_col           },
 	{"disabled_col",          PARAM_STR, &rtpp_disabled_col      },
 	{"disabled_col",          PARAM_STR, &rtpp_disabled_col      },
 	{"extra_id_pv",           PARAM_STR, &extra_id_pv_param },
 	{"extra_id_pv",           PARAM_STR, &extra_id_pv_param },

+ 1 - 0
modules/rtpengine/rtpengine.h

@@ -69,6 +69,7 @@ int init_rtpproxy_db(void);
 
 
 extern str rtpp_db_url;
 extern str rtpp_db_url;
 extern str rtpp_table_name;
 extern str rtpp_table_name;
+extern str rtpp_setid_col;
 extern str rtpp_url_col;
 extern str rtpp_url_col;
 extern str rtpp_disabled_col;
 extern str rtpp_disabled_col;
 
 

+ 7 - 7
modules/rtpengine/rtpengine_db.c

@@ -32,7 +32,7 @@ static db1_con_t *rtpp_db_handle = NULL;
 
 
 str rtpp_db_url = {NULL, 0};
 str rtpp_db_url = {NULL, 0};
 str rtpp_table_name = str_init("rtpproxy");
 str rtpp_table_name = str_init("rtpproxy");
-str rtpp_set_id_col = str_init("set_id");
+str rtpp_setid_col = str_init("setid");
 str rtpp_url_col = str_init("url");
 str rtpp_url_col = str_init("url");
 str rtpp_disabled_col = str_init("disabled");
 str rtpp_disabled_col = str_init("disabled");
 
 
@@ -64,10 +64,10 @@ static int rtpp_load_db(void)
 	db1_res_t *res = NULL;
 	db1_res_t *res = NULL;
 	db_val_t *values = NULL;
 	db_val_t *values = NULL;
 	db_row_t *rows = NULL;
 	db_row_t *rows = NULL;
-	db_key_t query_cols[] = {&rtpp_set_id_col, &rtpp_url_col, &rtpp_disabled_col};
+	db_key_t query_cols[] = {&rtpp_setid_col, &rtpp_url_col, &rtpp_disabled_col};
 
 
 	str url;
 	str url;
-	int set_id;
+	int setid;
 	int disabled;
 	int disabled;
 	unsigned int ticks;
 	unsigned int ticks;
 
 
@@ -102,7 +102,7 @@ static int rtpp_load_db(void)
 	{
 	{
 		values = ROW_VALUES(rows + i);
 		values = ROW_VALUES(rows + i);
 
 
-		set_id = VAL_INT(values);
+		setid = VAL_INT(values);
 		url.s = VAL_STR(values+1).s;
 		url.s = VAL_STR(values+1).s;
 		url.len = strlen(url.s);
 		url.len = strlen(url.s);
 		disabled = VAL_INT(values+2);
 		disabled = VAL_INT(values+2);
@@ -115,16 +115,16 @@ static int rtpp_load_db(void)
 		weight = VAL_INT(values+2);
 		weight = VAL_INT(values+2);
 		flags = VAL_INT(values+3);
 		flags = VAL_INT(values+3);
 		*/
 		*/
-		if ((rtpp_list = get_rtpp_set(set_id)) == NULL)
+		if ((rtpp_list = get_rtpp_set(setid)) == NULL)
 		{
 		{
-			LM_ERR("error getting rtpp_list for set %d\n", set_id);
+			LM_ERR("error getting rtpp_list for set %d\n", setid);
 			continue;
 			continue;
 		}
 		}
 
 
 		if (add_rtpengine_socks(rtpp_list, url.s, disabled, ticks) !=  0)
 		if (add_rtpengine_socks(rtpp_list, url.s, disabled, ticks) !=  0)
 		{
 		{
 			LM_ERR("error inserting '%.*s' into set %d disabled=%d\n",
 			LM_ERR("error inserting '%.*s' into set %d disabled=%d\n",
-				url.len, url.s, set_id, disabled);
+				url.len, url.s, setid, disabled);
 		}
 		}
 	}
 	}