Sfoglia il codice sorgente

Support for auto_inv_100_reason tm parameter.

This patch adds support for auto_inv_100_reason parameter in tm module.
The patch was created originally for kamailio and we merge it into the
sr version of tm module too. The parameter allows to configure the
reason phrase used in 100 replies.
Signed-off-by: Jan Janak <[email protected]>
Andreas Heise 16 anni fa
parent
commit
9d472adf9d
5 ha cambiato i file con 31 aggiunte e 4 eliminazioni
  1. 3 0
      modules/tm/config.c
  2. 1 0
      modules/tm/config.h
  3. 23 2
      modules/tm/doc/params.xml
  4. 1 1
      modules/tm/t_funcs.c
  5. 3 1
      modules/tm/tm.c

+ 3 - 0
modules/tm/config.c

@@ -66,6 +66,7 @@ struct cfg_group_tm	default_tm_cfg = {
 	MAX_NONINV_LIFETIME,	/* tm_max_noninv_lifetime */
 	MAX_NONINV_LIFETIME,	/* tm_max_noninv_lifetime */
 	1,	/* noisy_ctimer */
 	1,	/* noisy_ctimer */
 	1,	/* tm_auto_inv_100 */
 	1,	/* tm_auto_inv_100 */
+	"trying -- your call is important to us",	/* tm_auto_inv_100_r */
 	500,	/* tm_unix_tx_timeout -- 500 ms by default */
 	500,	/* tm_unix_tx_timeout -- 500 ms by default */
 	1,	/* restart_fr_on_each_reply */
 	1,	/* restart_fr_on_each_reply */
 	0,	/* pass_provisional_replies */
 	0,	/* pass_provisional_replies */
@@ -126,6 +127,8 @@ cfg_def_t	tm_cfg_def[] = {
 		"will be always replied"},
 		"will be always replied"},
 	{"auto_inv_100",	CFG_VAR_INT,	0, 1, 0, 0,
 	{"auto_inv_100",	CFG_VAR_INT,	0, 1, 0, 0,
 		"automatically send 100 to an INVITE"},
 		"automatically send 100 to an INVITE"},
+	{"auto_inv_100_reason",	CFG_VAR_STRING,	0, 0, 0, 0,
+		"reason text of the automatically send 100 to an INVITE"},   
 	{"unix_tx_timeout",	CFG_VAR_INT,	0, 0, 0, 0,
 	{"unix_tx_timeout",	CFG_VAR_INT,	0, 0, 0, 0,
 		"Unix socket transmission timeout, in milliseconds"},
 		"Unix socket transmission timeout, in milliseconds"},
 	{"restart_fr_on_each_reply",	CFG_VAR_INT,	0, 1, 0, 0,
 	{"restart_fr_on_each_reply",	CFG_VAR_INT,	0, 1, 0, 0,

+ 1 - 0
modules/tm/config.h

@@ -111,6 +111,7 @@ struct cfg_group_tm {
 	unsigned int	tm_max_noninv_lifetime;
 	unsigned int	tm_max_noninv_lifetime;
 	int	noisy_ctimer;
 	int	noisy_ctimer;
 	int	tm_auto_inv_100;
 	int	tm_auto_inv_100;
+	char	*tm_auto_inv_100_r;	
 	int	tm_unix_tx_timeout;
 	int	tm_unix_tx_timeout;
 	int	restart_fr_on_each_reply;
 	int	restart_fr_on_each_reply;
 	int	pass_provisional_replies;
 	int	pass_provisional_replies;

+ 23 - 2
modules/tm/doc/params.xml

@@ -332,8 +332,8 @@ modparam("tm", "restart_fr_on_each_reply", 0)
 		Default value is 1 (on).
 		Default value is 1 (on).
 	</para>
 	</para>
 	<para>
 	<para>
-		See also:
-				<function>t_set_auto_inv_100()</function>.
+		See also: <function>t_set_auto_inv_100()</function>
+				  <varname>auto_inv_100_reason</varname>. 
 	</para>
 	</para>
 	<example>
 	<example>
 		<title>Set <varname>auto_inv_100</varname> parameter</title>
 		<title>Set <varname>auto_inv_100</varname> parameter</title>
@@ -345,6 +345,27 @@ modparam("tm", "auto_inv_100", 0)
 	</example>
 	</example>
 	</section>
 	</section>
 
 
+	<section id="auto_inv_100_reason">
+	<title><varname>auto_inv_100_reason</varname> (string)</title>
+	<para>
+		Set reason text of the automatically send 100 to an INVITE.
+	</para>
+	<para>
+		Default value is "trying -- your call is important to us".
+	</para>
+	<para>
+		See also: <varname>auto_inv_100</varname>.
+	</para>
+	<example>
+		<title>Set <varname>auto_inv_100_reason</varname> parameter</title>
+		<programlisting>
+...
+modparam("tm", "auto_inv_100_reason", "Trying")
+...
+	    </programlisting>
+	</example>
+	</section>
+
 	<section id="unix_tx_timeout">
 	<section id="unix_tx_timeout">
 	<title><varname>unix_tx_timeout</varname> (integer)</title>
 	<title><varname>unix_tx_timeout</varname> (integer)</title>
 	<para>
 	<para>

+ 1 - 1
modules/tm/t_funcs.c

@@ -324,7 +324,7 @@ int t_relay_to( struct sip_msg  *p_msg , struct proxy_l *proxy, int proto,
 	{
 	{
 		DBG( "SER: new INVITE\n");
 		DBG( "SER: new INVITE\n");
 		if (!t_reply( t, p_msg , 100 ,
 		if (!t_reply( t, p_msg , 100 ,
-			"trying -- your call is important to us"))
+			cfg_get(tm, tm_cfg, tm_auto_inv_100_r)))
 				DBG("SER: ERROR: t_reply (100)\n");
 				DBG("SER: ERROR: t_reply (100)\n");
 	} 
 	} 
 
 

+ 3 - 1
modules/tm/tm.c

@@ -90,7 +90,8 @@
  *               t_relay_to_{udp,tcp,tls}(<no param>) (force protocol, but 
  *               t_relay_to_{udp,tcp,tls}(<no param>) (force protocol, but 
  *               forward to uri)  (andrei)
  *               forward to uri)  (andrei)
  *  2008-08-11  sctp support: t_relay_to_sctp, t_replicate_sctp,
  *  2008-08-11  sctp support: t_relay_to_sctp, t_replicate_sctp,
- *               t_forward_nonack_sctp (andrei
+ *               t_forward_nonack_sctp (andrei)
+ *  2009-03-18  added a new param: auto_inv_100_reason (aheise) 
  */
  */
 
 
 
 
@@ -425,6 +426,7 @@ static param_export_t params[]={
 	{"max_noninv_lifetime", PARAM_INT, &default_tm_cfg.tm_max_noninv_lifetime},
 	{"max_noninv_lifetime", PARAM_INT, &default_tm_cfg.tm_max_noninv_lifetime},
 	{"noisy_ctimer",        PARAM_INT, &default_tm_cfg.noisy_ctimer          },
 	{"noisy_ctimer",        PARAM_INT, &default_tm_cfg.noisy_ctimer          },
 	{"auto_inv_100",        PARAM_INT, &default_tm_cfg.tm_auto_inv_100       },
 	{"auto_inv_100",        PARAM_INT, &default_tm_cfg.tm_auto_inv_100       },
+	{"auto_inv_100_reason", PARAM_STRING, &default_tm_cfg.tm_auto_inv_100_r  },    
 	{"unix_tx_timeout",     PARAM_INT, &default_tm_cfg.tm_unix_tx_timeout    },
 	{"unix_tx_timeout",     PARAM_INT, &default_tm_cfg.tm_unix_tx_timeout    },
 	{"restart_fr_on_each_reply", PARAM_INT,
 	{"restart_fr_on_each_reply", PARAM_INT,
 									&default_tm_cfg.restart_fr_on_each_reply},
 									&default_tm_cfg.restart_fr_on_each_reply},