[sr-dev] git:master:55734eb2: rtpengine: Add setid_col modparam

Stefan Mititelu stefan.mititelu at 1and1.ro
Tue Jan 26 18:34:09 CET 2016


Module: kamailio
Branch: master
Commit: 55734eb2ea6dfcda679570f08b3bf331a4f44f76
URL: https://github.com/kamailio/kamailio/commit/55734eb2ea6dfcda679570f08b3bf331a4f44f76

Author: Stefan Mititelu <stefan.mititelu at 1and1.ro>
Committer: Stefan Mititelu <stefan.mititelu at 1and1.ro>
Date: 2015-12-10T14:21:12+02:00

rtpengine: Add setid_col modparam

Allow setid column name. Updated doku.

---

Modified: modules/rtpengine/doc/rtpengine_admin.xml
Modified: modules/rtpengine/rtpengine.c
Modified: modules/rtpengine/rtpengine.h
Modified: modules/rtpengine/rtpengine_db.c

---

Diff:  https://github.com/kamailio/kamailio/commit/55734eb2ea6dfcda679570f08b3bf331a4f44f76.diff
Patch: https://github.com/kamailio/kamailio/commit/55734eb2ea6dfcda679570f08b3bf331a4f44f76.patch

---

diff --git a/modules/rtpengine/doc/rtpengine_admin.xml b/modules/rtpengine/doc/rtpengine_admin.xml
index b29a108..d2b28bd 100644
--- a/modules/rtpengine/doc/rtpengine_admin.xml
+++ b/modules/rtpengine/doc/rtpengine_admin.xml
@@ -458,12 +458,33 @@ modparam("rtpengine", "hash_table_tout", "300")
         </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">
 		<title><varname>disabled_col</varname> (string)</title>
 		<para>
 			Column name in the rtpproxy table. If database mode is activated,
 			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>
 			By default, the column name is "disabled".
diff --git a/modules/rtpengine/rtpengine.c b/modules/rtpengine/rtpengine.c
index 016d82c..42646b3 100644
--- a/modules/rtpengine/rtpengine.c
+++ b/modules/rtpengine/rtpengine.c
@@ -337,6 +337,7 @@ static param_export_t params[] = {
 	{"queried_nodes_limit",   INT_PARAM, &queried_nodes_limit    },
 	{"db_url",                PARAM_STR, &rtpp_db_url            },
 	{"table_name",            PARAM_STR, &rtpp_table_name        },
+	{"setid_col",             PARAM_STR, &rtpp_setid_col         },
 	{"url_col",               PARAM_STR, &rtpp_url_col           },
 	{"disabled_col",          PARAM_STR, &rtpp_disabled_col      },
 	{"extra_id_pv",           PARAM_STR, &extra_id_pv_param },
diff --git a/modules/rtpengine/rtpengine.h b/modules/rtpengine/rtpengine.h
index 5d46b5b..48eeaf1 100644
--- a/modules/rtpengine/rtpengine.h
+++ b/modules/rtpengine/rtpengine.h
@@ -69,6 +69,7 @@ int init_rtpproxy_db(void);
 
 extern str rtpp_db_url;
 extern str rtpp_table_name;
+extern str rtpp_setid_col;
 extern str rtpp_url_col;
 extern str rtpp_disabled_col;
 
diff --git a/modules/rtpengine/rtpengine_db.c b/modules/rtpengine/rtpengine_db.c
index bd4f08f..87cdc60 100644
--- a/modules/rtpengine/rtpengine_db.c
+++ b/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_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_disabled_col = str_init("disabled");
 
@@ -64,10 +64,10 @@ static int rtpp_load_db(void)
 	db1_res_t *res = NULL;
 	db_val_t *values = 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;
-	int set_id;
+	int setid;
 	int disabled;
 	unsigned int ticks;
 
@@ -102,7 +102,7 @@ static int rtpp_load_db(void)
 	{
 		values = ROW_VALUES(rows + i);
 
-		set_id = VAL_INT(values);
+		setid = VAL_INT(values);
 		url.s = VAL_STR(values+1).s;
 		url.len = strlen(url.s);
 		disabled = VAL_INT(values+2);
@@ -115,16 +115,16 @@ static int rtpp_load_db(void)
 		weight = VAL_INT(values+2);
 		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;
 		}
 
 		if (add_rtpengine_socks(rtpp_list, url.s, disabled, ticks) !=  0)
 		{
 			LM_ERR("error inserting '%.*s' into set %d disabled=%d\n",
-				url.len, url.s, set_id, disabled);
+				url.len, url.s, setid, disabled);
 		}
 	}
 




More information about the sr-dev mailing list