From 3e25dce1918e007a5db3752143c427a512a08dd2 Mon Sep 17 00:00:00 2001 From: Stefan Mititelu Date: Tue, 17 Nov 2015 16:45:00 +0200 Subject: [PATCH] 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. --- modules/rtpengine/doc/rtpengine_admin.xml | 23 ++++++++++++++++++++++- modules/rtpengine/rtpengine.c | 22 ++++++++++++++++------ 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/modules/rtpengine/doc/rtpengine_admin.xml b/modules/rtpengine/doc/rtpengine_admin.xml index 4fd04815ae6..83333780356 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)") -
+
<varname>setid_avp</varname> (string) The parameter defines an AVP that, if set, @@ -597,8 +597,29 @@ modparam("rtpengine", "disabled_col", "disabled_column_name")
+
+ <varname>setid_default</varname> (string) + + The default set of nodes to be used. + + + By default, the setid is 0. + + + NOTE that if setid_avp is configured, this value will be ignored and + the active set will be chosen according to the setid_avp. + + + Set <varname>setid_default</varname> parameter + +... +modparam("rtpengine", "setid_default", 11) +... + +
+
diff --git a/modules/rtpengine/rtpengine.c b/modules/rtpengine/rtpengine.c index 42646b339f1..4b84d5939fd 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; }