group: This module export functions necesarry for group membership checking. There is a database table that contains list of users and groups they belong to. The table is used by functions of this module.
A typical use is to check whether the user is the member of a particular group (such as LongDistance), in order to control access to a particular facility.
The is_user_in(URI, group) function allows checking whether the user is a member of a specifiic group. The ‘URI’ parameter specifies the field which contains the URI. It can be one of the following values:
- Request-URI
- To
- From
- Credentials
Configuration
The Group module must be loaded after a database module (such as mysql). It nneds to be told the tables and columns to use when checking group membership.
- “db_url” specifies the database connection to use. Default ‘sql://serro:47serro11@localhost/ser”‘
modparam("group", "db_url", "sql://username:password@dbhost/ser")
- “table” specifies the database table to use. Default ‘grp’
modparam("group", "table", "grp")
- “user_column” specifies the column which conatins the username. Default ‘username’
modparam("group", "user_column", "username")
- “domain_column” specifies the column which contains the SIP domain. Default ‘domain’
modparam("group", "domain_column", "domain")
- “group_column” specifies the column which contains the group name. Default ‘grp’
modparam("group", "group_column", "grp")
- “use_domain” is an integer. ‘1’ specifies match “user@domain”, while ‘0’ specifies match ‘user’
modparam("group", "use_domain", 1)
Example
Check whether a user is allowed access to long-distance calls. Since the user URI is being extracted from “credentials” it means that they have already been authenticated.
if (!is_user_in("credentials", "ld")) {
sl_send_reply("403", "Local calls only");
break;
};
Back to SIP Express Router