Explorar o código

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

Alex Hermann %!s(int64=6) %!d(string=hai) anos
pai
achega
62c7a4b35d
Modificáronse 3 ficheiros con 34 adicións e 1 borrados
  1. 30 0
      src/modules/tm/doc/params.xml
  2. 3 1
      src/modules/tm/t_reply.c
  3. 1 0
      src/modules/tm/tm.c

+ 30 - 0
src/modules/tm/doc/params.xml

@@ -1485,4 +1485,34 @@ modparam("tm", "relay_100", 1)
 		</example>
 	</section>
 
+	<section id="tm.p.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>
+...
+modparam("tm", "rich_redirect", 3)
+....
+			</programlisting>
+		</example>
+	</section>
+
 </section>

+ 3 - 1
src/modules/tm/t_reply.c

@@ -102,6 +102,8 @@ int goto_on_sl_reply=0;
 
 /* remap 503 response code to 500 */
 extern int tm_remap_503_500;
+/* send path and flags in 3xx class reply */
+int tm_rich_redirect = 0;
 
 /* how to deal with winning branch reply selection in failure_route
  * can be overwritten per transaction with t_drop_replies(...)
@@ -640,7 +642,7 @@ static int _reply( struct cell *trans, struct sip_msg* p_msg,
 
 	/* if that is a redirection message, dump current message set to it */
 	if (code>=300 && code<400) {
-		dset=print_dset(p_msg, &dset_len, 0);
+		dset=print_dset(p_msg, &dset_len, tm_rich_redirect);
 		if (dset) {
 			add_lump_rpl(p_msg, dset, dset_len, LUMP_RPL_HDR);
 		}

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

@@ -475,6 +475,7 @@ static param_export_t params[]={
 	{"xavp_contact",        PARAM_STR, &ulattrs_xavp_name                    },
 	{"event_callback",      PARAM_STR, &tm_event_callback                    },
 	{"relay_100",           PARAM_INT, &default_tm_cfg.relay_100             },
+	{"rich_redirect" ,      PARAM_INT, &tm_rich_redirect                     },
 	{0,0,0}
 };