# &adminguide;

## Overview

Various checks related to &sip; &uri;.

## Dependencies

### &kamailio; Modules

The following modules must be loaded before this module:

- a &kamailio; database module .

### External Libraries or Applications

The following libraries or applications must be installed before running &kamailio; with this module loaded:

- None.

## Parameters

### `db_url` (string)

&url; of the database to be used.

If the db_url string is empty, the default database URL will be used.

Default value is &defaultrodb;.

#### Set `db_url` parameter

    ...
    modparam("uri_db", "db_url", "mysql://username:password@localhost/kamailio")
    ...

### `db_table` (string)

The DB table that should be used. It is possible to use the subscriber and uri table. If the uri table should be used, an additional parameter use_uri_table) must be set.

Default value is subscriber.

#### Set `db_table` parameter

    ...
    modparam("uri_db", "db_table", "uri")
    ...

### `user_column` (string)

Column holding usernames in the table.

Default value is username.

#### Set `user_column` parameter

    ...
    modparam("uri_db", "user_column", "username")
    ...

### `domain_column` (string)

Column holding domain in the table.

Default value is domain.

#### Set `domain_column` parameter

    ...
    modparam("uri_db", "domain_column", "domain")
    ...

### `uriuser_column` (string)

Column holding &uri; username in the table.

Default value is uri_user.

#### Set `uriuser_column` parameter

    ...
    modparam("uri_db", "uriuser_column", "uri_user")
    ...

### `use_uri_table` (integer)

Specify if the uri table should be used for checking instead of subscriber table. A non-zero value means true.

Default value is 0 (false).

#### Set `use_uri_table` parameter

    ...
    modparam("uri_db", "use_uri_table", 1)
    ...

### `use_domain` (integer)

Specify if the domain part of the URI should be used to identify the users (along with username). This is useful in multi domain setups, a non-zero value means true.

This parameter is only evaluated for calls to does_uri_exist, all other functions checks the digest username and realm against the given username, if the uri table is used.

Default value is 0 (false).

#### Set `use_domain` parameter

    ...
    modparam("uri_db", "use_domain", 1)
    ...

## Functions

### `check_to()`

Check To username against &uri; table (if use_uri_table is set) or digest credentials (no DB backend required).

This function can be used from REQUEST_ROUTE.

#### `check_to` usage

    ...
    if (check_to()) {
    	...
    };
    ...

### `check_from()`

Check From username against &uri; table (if use_uri_table is set) or digest credentials (no DB backend required).

This function can be used from REQUEST_ROUTE.

#### `check_from` usage

    ...
    if (check_from()) {
    	...
    };
    ...

### `check_uri(uri)`

Check the username from the given uri against &uri; table (if use_uri_table is set) or digest credentials (no DB backend required).

Description of parameters:

- uri Has to be a valid SIP URI, used to extract the username from. The parameter can be a static or dynamic (with variables) string.

This function can be used from REQUEST_ROUTE.

#### `check_uri` usage

    ...
    if (check_uri("$var(uri)")) {
    	...
    };
    ...

### `does_uri_exist()`

Check if username in the request &uri; belongs to an existing user.

The checking is done against the &uri; table (if use_uri_table is set) or the subscriber table.

This function can be used from REQUEST_ROUTE.

#### `does_uri_exist` usage

    ...
    if (does_uri_exist()) {
    	...
    };
    ...