Explorar el Código

tm docs update

Added disable_6xx_block, ruri_matching, via1_matching,
pass_provisional_replies, default_code, default_reason,
t_set_disable_6xx(), t_set_disable_failover().
Andrei Pelinescu-Onciul hace 16 años
padre
commit
d9100ccaad
Se han modificado 5 ficheros con 423 adiciones y 34 borrados
  1. 9 0
      NEWS
  2. 182 33
      modules/tm/README
  3. 1 1
      modules/tm/config.c
  4. 55 0
      modules/tm/doc/functions.xml
  5. 176 0
      modules/tm/doc/params.xml

+ 9 - 0
NEWS

@@ -87,6 +87,15 @@ new script commands:
   set_reply_close() - like set_forward_close(), but it works for replies to
        the current message.
 
+tm:
+  disable_6xx_block parameter - if set, will treat 6xx replies like normal
+       replies (non rfc conformant). Default: off.
+       See also t_set_disable_6xx().
+  t_set_disable_6xx(0|1) - can be used to turn off/on the special 6xx handling
+       on a per transaction basis.
+  t_set_disable_failover(0|1) - can be used to turn off/on dns failover on a
+       per transaction basis.
+
 
 
 2.1.0 changes

+ 182 - 33
modules/tm/README

@@ -49,6 +49,12 @@ Juha Heinanen
         1.3.28. fr_timer_avp (string)
         1.3.29. fr_inv_timer_avp (string)
         1.3.30. unmatched_cancel (string)
+        1.3.31. ruri_matching (integer)
+        1.3.32. via1_matching (integer)
+        1.3.33. pass_provisional_replies (integer)
+        1.3.34. default_code (integer)
+        1.3.35. default_reason (string)
+        1.3.36. disable_6xx_block (integer)
 
    1.4. Functions
 
@@ -93,6 +99,8 @@ Juha Heinanen
         1.4.31. t_load_contacts()
         1.4.32. t_next_contacts()
         1.4.33. t_check_trans()
+        1.4.34. t_set_disable_6xx(0|1)
+        1.4.35. t_set_disable_failover(0|1)
 
    1.5. TM Module API
 
@@ -775,6 +783,113 @@ modparam("tm", "fr_inv_timer_avp", "my_fr_inv_timer")
 modparam("tm", "unmatched_cancel", "2")
 ...
 
+1.3.31. ruri_matching (integer)
+
+   If set it will also try to match the request uri when doing pre-3261
+   transaction matching (the via branch parameter does not contain the
+   3261 cookie).
+
+   The only reason to have it not set is for interoperability with old,
+   broken implementations.
+
+   Default value is 1 (on).
+
+   Can be set at runtime, e.g.:
+        $ sercmd cfg.set_now_int tm ruri_matching 0
+
+   Example 31. Set ruri_matching parameter
+...
+modparam("tm", "ruri_matching", 1)
+...
+
+1.3.32. via1_matching (integer)
+
+   If set it will also try to match the topmost via when doing pre-3261
+   transaction matching (the via branch parameter does not contain the
+   3261 cookie).
+
+   The only reason to have it not set is for interoperability with old,
+   broken implementations.
+
+   Default value is 1 (on).
+
+   Can be set at runtime, e.g.:
+        $ sercmd cfg.set_now_int tm via1_matching 0
+
+   Example 32. Set via1_matching parameter
+...
+modparam("tm", "via1_matching", 1)
+...
+
+1.3.33. pass_provisional_replies (integer)
+
+   If set, TMCB_LOCAL_REPONSE_OUT tm registered callbacks will be called
+   also for provisional replies.
+
+   Default value is 0 (off).
+
+   Can be set at runtime, e.g.:
+        $ sercmd cfg.set_now_int tm pass_provisional_replies 1
+
+   Example 33. Set pass_provisional_replies parameter
+...
+modparam("tm", "pass_provisional_replies", 1)
+...
+
+1.3.34. default_code (integer)
+
+   Default response code sent by t_reply() if it cannot retrieve its
+   parameters (e.g. inexistent avp). Valid values are between 400 and 699.
+
+   Default value is 500.
+
+   Can be set at runtime, e.g.:
+        $ sercmd cfg.set_now_int tm default_code 505
+
+   Example 34. Set default_code parameter
+...
+modparam("tm", "default_code", 501)
+...
+
+1.3.35. default_reason (string)
+
+   Default SIP reason phrase sent by t_reply() if it cannot retrieve its
+   parameters (e.g. inexistent avp).
+
+   Default value is "Server Internal Error".
+
+   Can be set at runtime, e.g.:
+        $ sercmd cfg.set_now_string tm default_reason "Unknown error"
+
+   Example 35. Set default_reason parameter
+...
+modparam("tm", "default_reason", "Unknown reason")
+...
+
+1.3.36. disable_6xx_block (integer)
+
+   If set tm will treat all the 6xx replies like normal replies (warning:
+   this would be non-rfc conformant behaviour).
+
+   If not set (default) receiving a 6xx will cancel all the running
+   parallel branches, will stop dns failover and forking. However serial
+   forking using append_branch() in the failure_route will still work.
+
+   It can be overwritten on a per transaction basis using
+   t_set_disable_6xx().
+
+   Default value is 0 (off, rfc conformant behaviour).
+
+   Can be set at runtime, e.g.:
+        $ sercmd cfg.set_now_int tm disable_6xx_block 0
+
+   See also: t_set_disable_6xx().
+
+   Example 36. Set disable_6xx_block parameter
+...
+modparam("tm", "disable_6xx_block", 1)
+...
+
 1.4. Functions
 
    Revision History
@@ -800,7 +915,7 @@ t_relay_to_sctp(ip, port) t_relay_to_sctp()
    derived from the message uri (using sip sepcific DNS lookups), but with
    the protocol corresponding to the function name.
 
-   Example 31. t_relay_to_udp usage
+   Example 37. t_relay_to_udp usage
 ...
 if (src_ip==10.0.0.0/8)
         t_relay_to_udp("1.2.3.4", "5060"); # sent to 1.2.3.4:5060 over udp
@@ -827,7 +942,7 @@ else
    Returns a negative value on failure--you may still want to send a
    negative reply upstream statelessly not to leave upstream UAC in lurch.
 
-   Example 32. t_relay usage
+   Example 38. t_relay usage
 ...
 if (!t_relay())
 {
@@ -856,7 +971,7 @@ if (!t_relay())
    Meaning of the parameters is as follows:
      * failure_route - Failure route block to be called.
 
-   Example 33. t_on_failure usage
+   Example 39. t_on_failure usage
 ...
 route {
     t_on_failure("1");
@@ -882,7 +997,7 @@ failure_route[1] {
    Meaning of the parameters is as follows:
      * onreply_route - Onreply route block to be called.
 
-   Example 34. t_on_reply usage
+   Example 40. t_on_reply usage
 ...
 loadmodule "/usr/local/lib/ser/modules/nathelper.so"
 ...
@@ -914,7 +1029,7 @@ es');
    Meaning of the parameters is as follows:
      * branch_route - branch route block to be called.
 
-   Example 35. t_on_branch usage
+   Example 41. t_on_branch usage
 ...
 route {
         t_on_branch("1");
@@ -932,7 +1047,7 @@ branch_route[1] {
    Similarly to t_fork_to, it extends destination set by a new entry. The
    difference is that current URI is taken as new entry.
 
-   Example 36. append_branch usage
+   Example 42. append_branch usage
 ...
 set_user("john");
 t_fork();
@@ -947,7 +1062,7 @@ t_relay();
    the only way a script can add a new transaction in an atomic way.
    Typically, it is used to deploy a UAS.
 
-   Example 37. t_newtran usage
+   Example 43. t_newtran usage
 ...
 if (t_newtran()) {
     log("UAS logic");
@@ -966,7 +1081,7 @@ if (t_newtran()) {
      * code - Reply code number.
      * reason_phrase - Reason string.
 
-   Example 38. t_reply usage
+   Example 44. t_reply usage
 ...
 t_reply("404", "Not found");
 ...
@@ -979,7 +1094,7 @@ t_reply("404", "Not found");
    none was found. However this is safely (atomically) done using
    t_newtran.
 
-   Example 39. t_lookup_request usage
+   Example 45. t_lookup_request usage
 ...
 if (t_lookup_request()) {
     ...
@@ -990,7 +1105,7 @@ if (t_lookup_request()) {
 
    Retransmits a reply sent previously by UAS transaction.
 
-   Example 40. t_retransmit_reply usage
+   Example 46. t_retransmit_reply usage
 ...
 t_retransmit_reply();
 ...
@@ -1000,7 +1115,7 @@ t_retransmit_reply();
    Remove transaction from memory (it will be first put on a wait timer to
    absorb delayed messages).
 
-   Example 41. t_release usage
+   Example 47. t_release usage
 ...
 t_release();
 ...
@@ -1015,7 +1130,7 @@ t_forward_nonack_tls(ip, port) t_forward_nonack_sctp(ip, port)
      * ip - IP address where the message should be sent.
      * port - Port number.
 
-   Example 42. t_forward_nonack usage
+   Example 48. t_forward_nonack usage
 ...
 t_forward_nonack("1.2.3.4", "5060");
 ...
@@ -1038,7 +1153,7 @@ t_forward_nonack("1.2.3.4", "5060");
 
    See also: fr_timer, fr_inv_timer, t_reset_fr().
 
-   Example 43. t_set_fr usage
+   Example 49. t_set_fr usage
 ...
 route {
         t_set_fr(10000); # set only fr invite timeout to 10s
@@ -1065,7 +1180,7 @@ branch_route[1] {
 
    See also: fr_timer, fr_inv_timer, t_set_fr.
 
-   Example 44. t_reset_fr usage
+   Example 50. t_reset_fr usage
 ...
 route {
 ...
@@ -1091,7 +1206,7 @@ route {
 
    See also: max_inv_lifetime, max_noninv_lifetime, t_reset_max_lifetime.
 
-   Example 45. t_set_max_lifetime usage
+   Example 51. t_set_max_lifetime usage
 ...
 route {
     if (src_ip=1.2.3.4)
@@ -1113,7 +1228,7 @@ route {
 
    See also: max_inv_lifetime, max_noninv_lifetime, t_set_max_lifetime.
 
-   Example 46. t_reset_max_lifetime usage
+   Example 52. t_reset_max_lifetime usage
 ...
 route {
 ...
@@ -1151,7 +1266,7 @@ route {
 
    See also: retr_timer1, retr_timer2, t_reset_retr().
 
-   Example 47. t_set_retr usage
+   Example 53. t_set_retr usage
 ...
 route {
         t_set_retr(250, 0); # set only T1 to 250 ms
@@ -1178,7 +1293,7 @@ branch_route[1] {
 
    See also: retr_timer1, retr_timer2, t_set_retr.
 
-   Example 48. t_reset_retr usage
+   Example 54. t_reset_retr usage
 ...
 route {
 ...
@@ -1194,7 +1309,7 @@ route {
 
    See also: auto_inv_100.
 
-   Example 49. t_set_auto_inv_100 usage
+   Example 55. t_set_auto_inv_100 usage
 ...
 route {
 ...
@@ -1208,7 +1323,7 @@ route {
    Returns true if the failure route is executed for a branch that did
    timeout. It can be used only from the failure_route.
 
-   Example 50. t_branch_timeout usage
+   Example 56. t_branch_timeout usage
 ...
 failure_route[0]{
         if (t_branch_timeout()){
@@ -1223,7 +1338,7 @@ failure_route[0]{
    receive at least one reply in the past (the "current" reply is not
    taken into account). It can be used only from the failure_route.
 
-   Example 51. t_branch_replied usage
+   Example 57. t_branch_replied usage
 ...
 failure_route[0]{
         if (t_branch_timeout()){
@@ -1240,7 +1355,7 @@ failure_route[0]{
    Returns true if at least one of the current transactions branches did
    timeout.
 
-   Example 52. t_any_timeout usage
+   Example 58. t_any_timeout usage
 ...
 failure_route[0]{
         if (!t_branch_timeout()){
@@ -1257,7 +1372,7 @@ failure_route[0]{
    receive some reply in the past. If called from a failure or onreply
    route, the "current" reply is not taken into account.
 
-   Example 53. t_any_replied usage
+   Example 59. t_any_replied usage
 ...
 onreply_route[0]{
         if (!t_any_replied()){
@@ -1271,7 +1386,7 @@ onreply_route[0]{
    Returns true if "code" is the final reply received (or locally
    generated) in at least one of the current transactions branches.
 
-   Example 54. t_grep_status usage
+   Example 60. t_grep_status usage
 ...
 onreply_route[0]{
         if (t_grep_status("486")){
@@ -1284,7 +1399,7 @@ onreply_route[0]{
 
    Returns true if the current transaction was canceled.
 
-   Example 55. t_is_canceled usage
+   Example 61. t_is_canceled usage
 ...
 failure_route[0]{
         if (t_is_canceled()){
@@ -1298,7 +1413,7 @@ failure_route[0]{
    Returns true if the current transaction has already been expired, i.e.
    the max_inv_lifetime/max_noninv_lifetime interval has already elapsed.
 
-   Example 56. t_is_expired usage
+   Example 62. t_is_expired usage
 ...
 failure_route[0]{
         if (t_is_expired()){
@@ -1319,7 +1434,7 @@ failure_route[0]{
    CANCELs were successfully sent to the pending branches, true if the
    INVITE was not found, and false in case of any error.
 
-   Example 57. t_relay_cancel usage
+   Example 63. t_relay_cancel usage
 if (method == CANCEL) {
         if (!t_relay_cancel()) {  # implicit drop if relaying was successful,
                                   # nothing to do
@@ -1346,7 +1461,7 @@ if (method == CANCEL) {
    overwritten with the flags of the INVITE. isflagset() can be used to
    check the flags of the previously forwarded INVITE in this case.
 
-   Example 58. t_lookup_cancel usage
+   Example 64. t_lookup_cancel usage
 if (method == CANCEL) {
         if (t_lookup_cancel()) {
                 log("INVITE transaction exists");
@@ -1371,7 +1486,7 @@ if (method == CANCEL) {
    branch is added to the transaction, or it is explicitly replied in the
    script!
 
-   Example 59. t_drop_replies() usage
+   Example 65. t_drop_replies() usage
 ...
 failure_route[0]{
         if (t_check_status("5[0-9][0-9]")){
@@ -1402,7 +1517,7 @@ failure_route[0]{
    The transaction must be created by t_newtran() before calling
    t_save_lumps().
 
-   Example 60. t_save_lumps() usage
+   Example 66. t_save_lumps() usage
 route {
         ...
         t_newtran();
@@ -1438,7 +1553,7 @@ failure_route[1] {
 
    This function can be used from REQUEST_ROUTE.
 
-   Example 61. t_load_contacts usage
+   Example 67. t_load_contacts usage
 ...
 if (!t_load_contacts()) {
         sl_send_reply("500", "Server Internal Error - Cannot load contacts");
@@ -1463,7 +1578,7 @@ if (!t_load_contacts()) {
 
    This function can be used from REQUEST_ROUTE and FAILURE_ROUTE.
 
-   Example 62. t_next_contacts usage
+   Example 68. t_next_contacts usage
 ...
 # First call after t_load_contacts() when transaction does not exist yet
 # and contacts should be available
@@ -1527,11 +1642,45 @@ Note
 
    See also: t_lookup_request(), t_lookup_cancel().
 
-   Example 63. t_check_trans usage
+   Example 69. t_check_trans usage
 if ( method == "CANCEL" && !t_check_trans())
         sl_reply("403", "cancel out of the blue forbidden");
 # note: in this example t_check_trans() can be replaced by t_lookup_cancel()
 
+1.4.34.  t_set_disable_6xx(0|1)
+
+   Turn off/on 6xx replies special rfc conformant handling on a per
+   transaction basis. If turned off (t_set_disable_6xx("1")) 6XXs will be
+   treated like normal replies.
+
+   It overrides the disable_6xx_block value for the current transaction.
+
+   See also: disable_6xx_block.
+
+   Example 70. t_set_disable_6xx usage
+...
+route {
+...
+        if (src_ip==1.2.3.4) # bad user agent that sends 603
+                t_set_disable_6xx(1); # turn off 6xx special handling
+...
+}
+
+1.4.35.  t_set_disable_failover(0|1)
+
+   Turn off/on dns failover on a per transaction basis.
+
+   See also: use_dns_failover.
+
+   Example 71. t_set_disable_failover usage
+...
+route {
+...
+        if (uri=~"@foo.bar$")
+                t_set_disable_failover(1); # turn off dns failover
+...
+}
+
 1.5. TM Module API
 
    Revision History

+ 1 - 1
modules/tm/config.c

@@ -138,7 +138,7 @@ cfg_def_t	tm_cfg_def[] = {
 		"restart final response timer on each provisional reply"},
 	{"pass_provisional_replies",	CFG_VAR_INT | CFG_ATOMIC,	0, 1, 0, 0,
 		"enable/disable passing of provisional replies "
-		"to FIFO applications"},
+		"to TMCB_LOCAL_RESPONSE_OUT callbacks"},
 	{"aggregate_challenges",	CFG_VAR_INT /* not atomic */,	0, 1, 0, 0,
 		"if the final response is a 401 or a 407, aggregate all the "
 		"authorization headers (challenges) "

+ 55 - 0
modules/tm/doc/functions.xml

@@ -1179,4 +1179,59 @@ if ( method == "CANCEL" && !t_check_trans())
 	</example>
 	</section>
 
+	<section id="t_set_disable_6xx">
+	<title>
+		<function>t_set_disable_6xx(0|1)</function>
+	</title>
+	<para>
+		Turn off/on 6xx replies special rfc conformant handling on a per
+		transaction basis. If turned off
+		(<function>t_set_disable_6xx("1")</function>) 6XXs will be treated
+		like normal replies.
+	</para>
+	<para>
+		It overrides the <varname>disable_6xx_block</varname> value for
+		the current transaction.
+	</para>
+	<para>
+		See also: <varname>disable_6xx_block</varname>.
+	</para>
+	<example>
+		<title><function>t_set_disable_6xx</function> usage</title>
+		<programlisting>
+...
+route {
+...
+	if (src_ip==1.2.3.4) # bad user agent that sends 603
+		t_set_disable_6xx(1); # turn off 6xx special handling
+...
+}
+		</programlisting>
+	</example>
+	</section>
+
+	<section id="t_set_disable_failover">
+	<title>
+		<function>t_set_disable_failover(0|1)</function>
+	</title>
+	<para>
+		Turn off/on dns failover on a per transaction basis.
+	</para>
+	<para>
+		See also: <varname>use_dns_failover</varname>.
+	</para>
+	<example>
+		<title><function>t_set_disable_failover</function> usage</title>
+		<programlisting>
+...
+route {
+...
+	if (uri=~"@foo.bar$")
+		t_set_disable_failover(1); # turn off dns failover
+...
+}
+		</programlisting>
+	</example>
+	</section>
+
 </section>

+ 176 - 0
modules/tm/doc/params.xml

@@ -904,4 +904,180 @@ modparam("tm", "unmatched_cancel", "2")
 			</programlisting>
 		</example>
 	</section>
+
+	<section id="ruri_matching">
+	<title><varname>ruri_matching</varname> (integer)</title>
+	<para>
+		If set it will also try to match the request uri  when doing
+		pre-3261 transaction matching (the via branch parameter does
+		not contain the 3261 cookie).
+	</para>
+	<para>
+		The only reason to have it not set is for interoperability with old,
+		broken implementations.
+	</para>
+	<para>
+		Default value is 1 (on).
+	</para>
+	<para>
+		Can be set at runtime, e.g.:
+		<programlisting>
+	$ sercmd cfg.set_now_int tm ruri_matching 0
+		</programlisting>
+	</para>
+	<example>
+		<title>Set <varname>ruri_matching</varname> parameter</title>
+		<programlisting>
+...
+modparam("tm", "ruri_matching", 1)
+...
+	    </programlisting>
+	</example>
+	</section>
+
+	<section id="via1_matching">
+	<title><varname>via1_matching</varname> (integer)</title>
+	<para>
+		If set it will also try to match the topmost via when doing
+		pre-3261 transaction matching (the via branch parameter does
+		not contain the 3261 cookie).
+	</para>
+	<para>
+		The only reason to have it not set is for interoperability with old,
+		broken implementations.
+	</para>
+	<para>
+		Default value is 1 (on).
+	</para>
+	<para>
+		Can be set at runtime, e.g.:
+		<programlisting>
+	$ sercmd cfg.set_now_int tm via1_matching 0
+		</programlisting>
+	</para>
+	<example>
+		<title>Set <varname>via1_matching</varname> parameter</title>
+		<programlisting>
+...
+modparam("tm", "via1_matching", 1)
+...
+	    </programlisting>
+	</example>
+	</section>
+
+	<section id="pass_provisional_replies">
+	<title><varname>pass_provisional_replies</varname> (integer)</title>
+	<para>
+		If set, TMCB_LOCAL_REPONSE_OUT tm registered callbacks will be called
+		also for provisional replies.
+	</para>
+	<para>
+		Default value is 0 (off).
+	</para>
+	<para>
+		Can be set at runtime, e.g.:
+		<programlisting>
+	$ sercmd cfg.set_now_int tm pass_provisional_replies 1
+		</programlisting>
+	</para>
+	<example>
+		<title>Set <varname>pass_provisional_replies</varname> parameter
+		</title>
+		<programlisting>
+...
+modparam("tm", "pass_provisional_replies", 1)
+...
+	    </programlisting>
+	</example>
+	</section>
+
+	<section id="default_code">
+	<title><varname>default_code</varname> (integer)</title>
+	<para>
+		Default response code sent by <function>t_reply()</function> if it
+		cannot retrieve its parameters (e.g. inexistent avp).
+		Valid values are between 400 and 699.
+	</para>
+	<para>
+		Default value is 500.
+	</para>
+	<para>
+		Can be set at runtime, e.g.:
+		<programlisting>
+	$ sercmd cfg.set_now_int tm default_code 505
+		</programlisting>
+	</para>
+	<example>
+		<title>Set <varname>default_code</varname> parameter </title>
+		<programlisting>
+...
+modparam("tm", "default_code", 501)
+...
+	    </programlisting>
+	</example>
+	</section>
+
+	<section id="default_reason">
+	<title><varname>default_reason</varname> (string)</title>
+	<para>
+		Default SIP reason phrase sent by <function>t_reply()</function> if it
+		cannot retrieve its parameters (e.g. inexistent avp).
+	</para>
+	<para>
+		Default value is "Server Internal Error".
+	</para>
+	<para>
+		Can be set at runtime, e.g.:
+		<programlisting>
+	$ sercmd cfg.set_now_string tm default_reason "Unknown error"
+		</programlisting>
+	</para>
+	<example>
+		<title>Set <varname>default_reason</varname> parameter </title>
+		<programlisting>
+...
+modparam("tm", "default_reason", "Unknown reason")
+...
+	    </programlisting>
+	</example>
+	</section>
+
+	<section id="disable_6xx_block">
+	<title><varname>disable_6xx_block</varname> (integer)</title>
+	<para>
+		If set tm will treat all the 6xx replies like normal replies 
+		(warning: this would be non-rfc conformant behaviour).
+	</para>
+	<para>
+		If not set (default) receiving a 6xx will cancel all the running
+		parallel branches, will stop dns failover and forking. However
+		serial forking using <function>append_branch()</function> in the
+		<function>failure_route</function> will still work.
+	</para>
+	<para>
+		It can be overwritten on a per transaction basis using
+		<function>t_set_disable_6xx()</function>.
+	</para>
+	<para>
+		Default value is 0 (off, rfc conformant behaviour).
+	</para>
+	<para>
+		Can be set at runtime, e.g.:
+		<programlisting>
+	$ sercmd cfg.set_now_int tm disable_6xx_block 0
+		</programlisting>
+	</para>
+	<para>
+		See also: <function>t_set_disable_6xx()</function>.
+	</para>
+	<example>
+		<title>Set <varname>disable_6xx_block</varname> parameter</title>
+		<programlisting>
+...
+modparam("tm", "disable_6xx_block", 1)
+...
+	    </programlisting>
+	</example>
+	</section>
+
 </section>