Copyright © 2009
Revision History | |
---|---|
Revision $Revision: 5901 $ | $Date: 2009-02-07 18:00:00 -0500$ |
Table of Contents
List of Examples
This module provides functionality which allows to group users using a common field, in such a way that a particular group defines abbreviated codes for users, allowing closed dialing within the group, locating users by their abbreviated code, besides their full identification. This module offers a functionality similar to Centrex. The relationship between users and their abbreviated codes, and their grouping is defined in a database table (see below).
The following modules must be loaded before this module:
A database module, like mysql, postgres or dbtext
URL of the database table to be used.
Default value is “mysql://opensips:opensipsrw@localhost/opensips”.
Example 1.1. Set db_url
parameter
... modparam("closeddial", "db_url", "mysql://username:password@dbhost/opensips") ...
Column of the table which stores the username
Default value is “username”.
Column of the table which stores the domain associated to usernames.
Default value is “domain”.
Column of the table which stores the group_id which groups the usernames.
Default value is “group_id”.
Example 1.4. Set group_id_column
parameter
... modparam("closeddial", "group_id_column", "groupid") ...
Column of the table which stores the closed dial code associated to a username.
Default value is “cd_username”.
Column of the table which stores the domain associated to closed dial usernames.
Default value is “cd_domain”.
Example 1.6. Set cd_domain_column
parameter
... modparam("closeddial", "cd_domain_column", "cddomain") ...
This function is used to lookup in the database the corresponding URI for an abbreviated code dialed, according to group which From user belongs to. After finding the group for From user, the dialed code and found group are used to look for the new URI to rewrite the request. If a positive match is found, R-URI is rewritten; if no match is found, R-URI is not changed.
Meaning of the parameters is as follows:
domain Table where searching is going to be perfomed on.
group Optional parameter which can be used to store the group to be used in searching. This group must be associated to From user.
Both of the parameters can contain pseudovariables.
This function can be used from REQUEST_ROUTE and FAILURE_ROUTE.
Example 1.9. cd_lookup
usage
... # Abbreviated code of two digits if($(rU{s.len}) == 2) { # Group AVP could be loaded at register time. $avp(s:group)="companyA"; cd_lookup("closeddial", "$avp(s:group)"); }; ... # Abbreviated code of three digits if($(rU{s.len}) == 3) { # Group is searched on database, by using # From username. cd_lookup("closeddial"); }; ...