Pārlūkot izejas kodu

sl: Add option to add path and flags to redirected contacts

Alex Hermann 6 gadi atpakaļ
vecāks
revīzija
ea96ddf5ab

+ 30 - 0
src/modules/sl/doc/sl_params.xml

@@ -61,4 +61,34 @@ modparam("sl", "bind_tm", 0)  # feature disabled
 		</example>
 	</section>
 
+	<section id="rich_redirect">
+		<title><varname>rich_redirect</varname> (int)</title>
+		<para>
+		When sending a 3xx class reply, include additional branch info
+		to the contacts such as path vector and branch flags.
+		</para>
+		<itemizedlist>
+			<listitem><para>
+			<emphasis>0</emphasis> - no extra info is added (default)
+			</para></listitem>
+			<listitem><para>
+			<emphasis>1</emphasis> - include branch flags as contact header parameter
+			</para></listitem>
+			<listitem><para>
+			<emphasis>2</emphasis> - include path as contact uri Route header
+			</para></listitem>
+		</itemizedlist>
+		<para>
+		Values may be combined (added).
+		</para>
+		<example>
+			<title>rich_redirect example</title>
+			<programlisting format="linespecific">
+...
+modparam("sl", "rich_redirect", 3)
+...
+			</programlisting>
+		</example>
+	</section>
+
 </section>

+ 1 - 0
src/modules/sl/sl.c

@@ -116,6 +116,7 @@ static param_export_t params[] = {
 	{"default_code",   PARAM_INT, &default_code},
 	{"default_reason", PARAM_STR, &default_reason},
 	{"bind_tm",        PARAM_INT, &sl_bind_tm},
+	{"rich_redirect",  PARAM_INT, &sl_rich_redirect},
 
 	{0, 0, 0}
 };

+ 4 - 1
src/modules/sl/sl_funcs.c

@@ -55,6 +55,9 @@ static int _sl_filtered_ack_route = -1; /* default disabled */
 
 static int _sl_evrt_local_response = -1; /* default disabled */
 
+/* send path and flags in 3xx class reply */
+int sl_rich_redirect = 0;
+
 /*!
  * lookup sl event routes
  */
@@ -150,7 +153,7 @@ int sl_reply_helper(struct sip_msg *msg, int code, char *reason, str *tag)
 
 	/* if that is a redirection message, dump current message set to it */
 	if (code>=300 && code<400) {
-		dset.s=print_dset(msg, &dset.len, 0);
+		dset.s=print_dset(msg, &dset.len, sl_rich_redirect);
 		if (dset.s) {
 			add_lump_rpl(msg, dset.s, dset.len, LUMP_RPL_HDR);
 		}

+ 2 - 0
src/modules/sl/sl_funcs.h

@@ -30,6 +30,8 @@
 
 #define SL_TOTAG_SEPARATOR '.'
 
+extern int sl_rich_redirect;
+
 int sl_startup();
 int sl_shutdown();