$Revision: 1.3 $
$Date: 2006/05/23 09:57:42 $

# Functions

## `sanity_check()`

This function makes a row of sanity checks on the given request. The function returns true if one of the checks failed. If one of the checks fails the module sends a precise error reply via sl_send_reply. Thus their is no need to reply with a generic error message.

### `sanity_check` usage

    ...
    if (sanity_check()) {
    	break;
    }
    ...

Optionally the function takes an integer argument which overwrites the global module parameter default_checks. This allows to make certain test from script regions. The integer value is again the sum of the checks (like for the module parameter) which should be executed at this function call.

### `sanity_check` usage with parameter

    ...
    if (method=="REGISTER" && sanity_check("256")) {
    	/* the register contains an invalid expires value and is replied with a 400 */
    	break;
    }
    ...

Optionally the function takes a second integer argument which overwrites the global module parameter uri_checks and thus determines which URIs will be checked if the parse uri test will be executed.

### <fucntion>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 a 400 */
    	break;
    }
    ...