Table of Contents
List of Examples
Table of Contents
The 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 the database for search (no memory caching). A common use case is to provide additional user aliases, i.e. to supplement the registration in the location database. Users are this way on a proxy reachable with several request URIs.
As the module use no memory caching the lookup is a bit slower but the data 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.
The following modules must be loaded before this module:
database module (mysql, dbtext, ...).
Database URL.
Default value is “mysql://openserro:openserro@localhost/openser”.
Example 1.1. Set db_url
parameter
... modparam("alias_db", "db_url", "dbdriver://username:password@dbhost/dbname") ...
Name of the column storing username.
Default value is “username”.
Name of the column storing user's domain.
Default value is “domain”.
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") ...
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") ...
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 “0”.
Specifies the prefix to be stripped from the domain in R-URI before doing the search.
Default value is “NULL”.
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. It can include pseudo-variables.
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.
Example 1.9. alias_db_lookup()
usage
... alias_db_lookup("dbaliases"); alias_db_lookup("dba_$(rU{s.substr,0,1})"); ...