uri_db Module

Jan Janak

FhG FOKUS

Edited by

Jan Janak

Bogdan-Andrei Iancu


Table of Contents

1. Admin Guide
1. Overview
2. Dependencies
2.1. Kamailio Modules
2.2. External Libraries or Applications
3. Parameters
3.1. db_url (string)
3.2. db_table (string)
3.3. user_column (string)
3.4. domain_column (string)
3.5. uriuser_column (string)
3.6. use_uri_table (integer)
3.7. use_domain (integer)
4. Functions
4.1. check_to()
4.2. check_from()
4.3. check_uri(uri)
4.4. does_uri_exist()

List of Examples

1.1. Set db_url parameter
1.2. Set uri_table parameter
1.3. Set user_column parameter
1.4. Set domain_column parameter
1.5. Set uriuser_column parameter
1.6. Set use_uri_table parameter
1.7. Set use_domain parameter
1.8. check_to usage
1.9. check_from usage
1.10. check_uri usage
1.11. does_uri_exist usage

Chapter 1. Admin Guide

1. Overview

Various checks related to SIP URI.

2. Dependencies

2.1. Kamailio Modules

The following modules must be loaded before this module:

  • a Kamailio database module .

2.2. External Libraries or Applications

The following libraries or applications must be installed before running Kamailio with this module loaded:

  • None.

3. Parameters

3.1. 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 mysql://kamailioro:kamailioro@localhost/kamailio.

Example 1.1. Set db_url parameter

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

3.2. db_table (string)

The DB table that should be used. Its 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.

Example 1.2. Set uri_table parameter

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

3.3. user_column (string)

Column holding usernames in the table.

Default value is username.

Example 1.3. Set user_column parameter

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

3.4. domain_column (string)

Column holding domain in the table.

Default value is domain.

Example 1.4. Set domain_column parameter

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

3.5. uriuser_column (string)

Column holding URI username in the table.

Default value is uri_user.

Example 1.5. Set uriuser_column parameter

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

3.6. 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).

Example 1.6. Set use_uri_table parameter

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

3.7. 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).

Example 1.7. Set use_domain parameter

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

4. Functions

4.1.  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.

Example 1.8. check_to usage

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

4.2.  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.

Example 1.9. check_from usage

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

4.3.  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.

Example 1.10. check_uri usage

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

4.4.  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.

Example 1.11. does_uri_exist usage

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