Browse Source

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.
Stefan Mititelu 9 years ago
parent
commit
3e25dce191
2 changed files with 38 additions and 7 deletions
  1. 22 1
      modules/rtpengine/doc/rtpengine_admin.xml
  2. 16 6
      modules/rtpengine/rtpengine.c

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

@@ -294,7 +294,7 @@ modparam("rtpengine", "extra_id_pv", "$avp(extra_id)")
 		</example>
 		</example>
 	</section>
 	</section>
 
 
-	<section id="rtpengine.p.setid_pv">
+	<section id="rtpengine.p.setid_avp">
 		<title><varname>setid_avp</varname> (string)</title>
 		<title><varname>setid_avp</varname> (string)</title>
 		<para>
 		<para>
 			The parameter defines an AVP that, if set,
 			The parameter defines an AVP that, if set,
@@ -597,8 +597,29 @@ modparam("rtpengine", "disabled_col", "disabled_column_name")
 	</section>
 	</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>
 
 
+	</section>
 
 
 
 
 
 

+ 16 - 6
modules/rtpengine/rtpengine.c

@@ -235,6 +235,7 @@ static str extra_id_pv_param = {NULL, 0};
 static char *setid_avp_param = NULL;
 static char *setid_avp_param = NULL;
 static int hash_table_tout = 3600;
 static int hash_table_tout = 3600;
 static int hash_table_size = 256;
 static int hash_table_size = 256;
+static int setid_default = DEFAULT_RTPP_SET_ID;
 
 
 static char ** rtpp_strings=0;
 static char ** rtpp_strings=0;
 static int rtpp_sets=0; /*used in rtpengine_set_store()*/
 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         },
 	{"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 },
-	{"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_tout",       INT_PARAM, &hash_table_tout        },
 	{"hash_table_size",       INT_PARAM, &hash_table_size        },
 	{"hash_table_size",       INT_PARAM, &hash_table_size        },
+	{"setid_default",         INT_PARAM, &setid_default          },
 	{0, 0, 0}
 	{0, 0, 0}
 };
 };
 
 
@@ -1505,6 +1507,14 @@ mod_init(void)
 		LM_DBG("rtpengine_hash_table_init(%d) success!\n", hash_table_size);
 		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;
 	return 0;
 }
 }