ALIAS_DB Module

Daniel-Constantin Mierla

Edited by

Daniel-Constantin Mierla


Table of Contents
1. User's Guide
1.1. Overview
1.2. Dependencies
1.2.1. OpenSER Modules
1.2.2. External Libraries or Applications
1.3. Exported Parameters
1.3.1. db_url (str)
1.3.2. user_column (str)
1.3.3. domain_column (str)
1.3.4. alias_user_column (str)
1.3.5. alias_domain_column (str)
1.3.6. use_domain (int)
1.3.7. domain_prefix (str)
1.4. Exported Functions
1.4.1. alias_db_lookup(table_name)
1.5. Installation & Running
1.5.1. Database setup
2. Developer's Guide
3. Frequently Asked Questions
List of Examples
1-1. Set db_url parameter
1-2. Set user_column parameter
1-3. Set domain_column parameter
1-4. Set alias_user_column parameter
1-5. Set alias_domain_column parameter
1-6. Set use_domain parameter
1-7. Set domain_prefix parameter
1-8. alias_db_lookup() usage
1-9. alias_db sql script

Chapter 1. User's Guide

1.1. Overview

ALIAS_DB module can be used as an alternative for user aliases via usrloc. The main feature is that it does not store all addiacent data as for user location and always uses database for search (no memory caching).

Having no memory caching the speed of search can decrease but the provisioning is easier. With very fast databases like MySQL the speed penalty can be lowered. Also, the search can be performed on different tables in the same script.


1.2. Dependencies

1.2.1. OpenSER Modules

The following modules must be loaded before this module:

  • database module (mysql, dbtext, ...).


1.2.2. External Libraries or Applications

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

  • None.


1.3. Exported Parameters

1.3.1. db_url (str)

Database URL.

Default value is "DEFAULT_RODB_URL".

Example 1-1. Set db_url parameter

...
modparam("alias_db", "db_url", "mysql://user:passwd@localhost/openser")
...

1.3.2. user_column (str)

Name of the column storing username.

Default value is "username".

Example 1-2. Set user_column parameter

...
modparam("alias_db", "user_column", "susername")
...

1.3.3. domain_column (str)

Name of the column storing user's domain.

Default value is "domain".

Example 1-3. Set domain_column parameter

...
modparam("alias_db", "domain_column", "sdomain")
...

1.3.4. alias_user_column (str)

Name of the column storing alias username.

Default value is "alias_username".

Example 1-4. Set alias_user_column parameter

...
modparam("alias_db", "alias_user_column", "auser")
...

1.3.5. alias_domain_column (str)

Name of the column storing alias domain.

Default value is "alias_domain".

Example 1-5. Set alias_domain_column parameter

...
modparam("alias_db", "alias_domain_column", "adomain")
...

1.3.6. use_domain (int)

Specifies whether to use or not the domain from R-URI when searching for alias. If set to 0, the domain from R-URI is not used, if set to 1 the domain from R-URI is used.

Default value is "o".

Example 1-6. Set use_domain parameter

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

1.3.7. domain_prefix (str)

Specifies the prefix to be stripped from the domain in R-URI before doing the search.

Default value is "NULL".

Example 1-7. Set domain_prefix parameter

...
modparam("alias_db", "domain_prefix", "sip.")
...

1.4. Exported Functions

1.4.1. alias_db_lookup(table_name)

The function takes the R-URI and search to see whether it is an alias or not. If it is an alias for a local user, the R-URI is replaced with user's SIP uri.

The function returns TRUE if R-URI is alias and it was replaced by user's SIP uri.

Meaning of the parameters is as follows:

  • table_name - the name of the table where to search for alias.

This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.

Example 1-8. alias_db_lookup() usage

...
alias_db_lookup("dbaliases");
...

1.5. Installation & Running

1.5.1. Database setup

The table structure used by alias_db module is defined by next SQL script (good for MySQL).

Example 1-9. alias_db sql script

...
create table dbaliases (
  alias_username varchar(64) not null default '',
  alias_domain varchar(128) not null default '',
  username varchar(64) not null default '',
  domain varchar(128) not null default '',
  unique key alias_key(alias_username, alias_domain)
);

...

The table "dbaliases" is create by default.


Chapter 2. Developer's Guide

The module does not provide any API to use in other OpenSER modules.


Chapter 3. Frequently Asked Questions

3.1. Where can I find more about OpenSER?
3.2. Where can I post a question about this module?
3.3. How can I report a bug?

3.1. Where can I find more about OpenSER?

Take a look at http://openser.org/.

3.2. Where can I post a question about this module?

First at all check if your question was already answered on one of our mailing lists:

E-mails regarding any stable OpenSER release should be sent to and e-mails regarding development versions should be sent to .

If you want to keep the mail private, send it to .

3.3. How can I report a bug?

Please follow the guidelines provided at: http://sourceforge.net/tracker/?group_id=139143.