[sr-dev] git:master:3e25dce1: rtpengine: Add setid_default modparam

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


Module: kamailio
Branch: master
Commit: 3e25dce1918e007a5db3752143c427a512a08dd2
URL: https://github.com/kamailio/kamailio/commit/3e25dce1918e007a5db3752143c427a512a08dd2

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

rtpengine: Add setid_default modparam

Add option to change the default set id.
If setid_avp is configured, the active set used is the avp value.
If setid_avp is not configured, the active set used is setid_default value.

---

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

---

Diff:  https://github.com/kamailio/kamailio/commit/3e25dce1918e007a5db3752143c427a512a08dd2.diff
Patch: https://github.com/kamailio/kamailio/commit/3e25dce1918e007a5db3752143c427a512a08dd2.patch

---

diff --git a/modules/rtpengine/doc/rtpengine_admin.xml b/modules/rtpengine/doc/rtpengine_admin.xml
index 4fd0481..8333378 100644
--- a/modules/rtpengine/doc/rtpengine_admin.xml
+++ b/modules/rtpengine/doc/rtpengine_admin.xml
@@ -294,7 +294,7 @@ modparam("rtpengine", "extra_id_pv", "$avp(extra_id)")
 		</example>
 	</section>
 
-	<section id="rtpengine.p.setid_pv">
+	<section id="rtpengine.p.setid_avp">
 		<title><varname>setid_avp</varname> (string)</title>
 		<para>
 			The parameter defines an AVP that, if set,
@@ -597,8 +597,29 @@ modparam("rtpengine", "disabled_col", "disabled_column_name")
 	</section>
 
 
+	<section id="rtpengine.p.setid_default">
+		<title><varname>setid_default</varname> (string)</title>
+		<para>
+			The default set of nodes to be used.
+		</para>
+		<para>
+			By default, the setid is 0.
+		</para>
+		<para>
+			NOTE that if setid_avp is configured, this value will be ignored and
+			the active set will be chosen according to the setid_avp.
+		</para>
+		<example>
+		<title>Set <varname>setid_default</varname> parameter</title>
+<programlisting format="linespecific">
+...
+modparam("rtpengine", "setid_default", 11)
+...
+</programlisting>
+		</example>
 	</section>
 
+	</section>
 
 
 
diff --git a/modules/rtpengine/rtpengine.c b/modules/rtpengine/rtpengine.c
index 42646b3..4b84d59 100644
--- a/modules/rtpengine/rtpengine.c
+++ b/modules/rtpengine/rtpengine.c
@@ -235,6 +235,7 @@ static str extra_id_pv_param = {NULL, 0};
 static char *setid_avp_param = NULL;
 static int hash_table_tout = 3600;
 static int hash_table_size = 256;
+static int setid_default = DEFAULT_RTPP_SET_ID;
 
 static char ** rtpp_strings=0;
 static int rtpp_sets=0; /*used in rtpengine_set_store()*/
@@ -340,14 +341,15 @@ static param_export_t params[] = {
 	{"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 },
-	{"setid_avp",             PARAM_STRING, &setid_avp_param },
-	{"force_send_interface",  PARAM_STRING, &force_send_ip_str	},
-	{"rtp_inst_pvar",         PARAM_STR, &rtp_inst_pv_param },
-	{"write_sdp_pv",          PARAM_STR, &write_sdp_pvar_str          },
-	{"read_sdp_pv",           PARAM_STR, &read_sdp_pvar_str          },
+	{"extra_id_pv",           PARAM_STR, &extra_id_pv_param      },
+	{"setid_avp",             PARAM_STRING, &setid_avp_param     },
+	{"force_send_interface",  PARAM_STRING, &force_send_ip_str   },
+	{"rtp_inst_pvar",         PARAM_STR, &rtp_inst_pv_param      },
+	{"write_sdp_pv",          PARAM_STR, &write_sdp_pvar_str     },
+	{"read_sdp_pv",           PARAM_STR, &read_sdp_pvar_str      },
 	{"hash_table_tout",       INT_PARAM, &hash_table_tout        },
 	{"hash_table_size",       INT_PARAM, &hash_table_size        },
+	{"setid_default",         INT_PARAM, &setid_default          },
 	{0, 0, 0}
 };
 
@@ -1505,6 +1507,14 @@ mod_init(void)
 		LM_DBG("rtpengine_hash_table_init(%d) success!\n", hash_table_size);
 	}
 
+	/* select the default set */
+	default_rtpp_set = select_rtpp_set(setid_default);
+	if (!default_rtpp_set) {
+		LM_NOTICE("Default rtpp set %d NOT found\n", setid_default);
+	} else {
+		LM_DBG("Default rtpp set %d found\n", setid_default);
+	}
+
 	return 0;
 }
 




More information about the sr-dev mailing list