diff --git a/src/modules/sanity/README b/src/modules/sanity/README index 027725f1501..4493c7f3cdb 100644 --- a/src/modules/sanity/README +++ b/src/modules/sanity/README @@ -19,10 +19,12 @@ Nils Ohlmeier 3.2. uri_checks (integer) 3.3. proxy_require (string) 3.4. autodrop (integer) + 3.5. noreply (int) 4. Functions 4.1. sanity_check([msg_checks [, uri_checks]]) + 4.2. sanity_reply() List of Examples @@ -30,9 +32,11 @@ Nils Ohlmeier 1.2. Set uri_checks parameter 1.3. Set proxy_require parameter 1.4. Set autodrop parameter - 1.5. sanity_check usage - 1.6. sanity_check usage with parameter - 1.7. sanity_check usage with two parameters + 1.5. Set noreply parameter + 1.6. sanity_check usage + 1.7. sanity_check usage with parameter + 1.8. sanity_check usage with two parameters + 1.9. sanity_reply usage Chapter 1. Admin Guide @@ -46,10 +50,12 @@ Chapter 1. Admin Guide 3.2. uri_checks (integer) 3.3. proxy_require (string) 3.4. autodrop (integer) + 3.5. noreply (int) 4. Functions 4.1. sanity_check([msg_checks [, uri_checks]]) + 4.2. sanity_reply() 1. Overview @@ -111,6 +117,7 @@ Chapter 1. Admin Guide 3.2. uri_checks (integer) 3.3. proxy_require (string) 3.4. autodrop (integer) + 3.5. noreply (int) 3.1. default_checks (integer) @@ -169,9 +176,24 @@ modparam("sanity", "proxy_require", "foo, bar") modparam("sanity", "autodrop", 1) ... +3.5. noreply (int) + + If set to 1, then the module does not send a SIP reply internally in + case there is an error detected when performing the sanity checks. + There is the option to send the reply from config file with functions + from sl or tm module as well as sanity_reply() from this module. + + Default value: 0. + + Example 1.5. Set noreply parameter +... +modparam("sanity", "noreply", 1) +... + 4. Functions 4.1. sanity_check([msg_checks [, uri_checks]]) + 4.2. sanity_reply() 4.1. sanity_check([msg_checks [, uri_checks]]) @@ -186,7 +208,7 @@ modparam("sanity", "autodrop", 1) The parameters can be static integers or variables holding integer values. - Example 1.5. sanity_check usage + Example 1.6. sanity_check usage ... if (!sanity_check()) { exit; @@ -199,7 +221,7 @@ if (!sanity_check()) { of the checks (like for the module parameter) which should be executed at this function call. - Example 1.6. sanity_check usage with parameter + Example 1.7. sanity_check usage with parameter ... if (method=="REGISTER" && !sanity_check("256")) { /* the register contains an invalid expires value and is replied with a @@ -212,7 +234,7 @@ if (method=="REGISTER" && !sanity_check("256")) { overwrites the global module parameter uri_checks and thus determines which URIs will be checked if the parse uri test will be executed. - Example 1.7. sanity_check usage with two parameters + Example 1.8. sanity_check usage with two parameters ... if (method=="INVITE" && !sanity_check("1024", "6")) { /* the INVITE contains an invalid From or To header and is replied with @@ -220,3 +242,18 @@ a 400 */ exit; } ... + +4.2. sanity_reply() + + Send a SIP reply using the code and reason text set internally by the + module when detecting errors while performing the sanity checks. It is + done only when parameter noreply is set to 1. + + Example 1.9. sanity_reply usage +... +if(!sanity_check("1024", "6")) { + xdbg("sanity checks failed\n"); + sanity_reply(); + exit; +} +...