Copyright © 2003 FhG FOKUS
Copyright © 2005, 2009 Voice Sistem SRL
| Revision History | |
|---|---|
| Revision $Revision: 8740 $ | $Date: 2013-01-29 13:35:11 +0100 (Tue, 29 Jan 2013) $ |
Table of Contents
db_check_to()
db_check_from()
db_does_uri_exist()
db_get_auth_id(string, var, var)
aaa_does_uri_exist([pvar])
aaa_does_uri_user_exist([pvar])
is_user(username)
has_totag()
uri_param(param)
uri_param(param,value)
add_uri_param(param)
tel2sip()
is_uri_user_e164(pseudo-variable)
List of Examples
aaa_url parameterservice_type parameteruse_sip_uri_host parameterdb_url parameteruri_table parameteruser_column parameterdomain_column parameteruriuser_column parameteruse_uri_table parameteruse_domain parameterdb_check_to usagedb_check_from usagedb_does_uri_exist usagedb_get_auth_id usageaaa_does_uri_exist usageaaa_does_uri_user_exist usageis_user usagehas_totag usageuri_param usageuri_param usageadd_uri_param usagetel2sip usageis_uri_user_e164 usageVarious checks related to SIP URI.
This module implements some URI related AAA or DB based tests.
At least one of the following modules must be loaded before this module:
a OpenSIPS database module .
an aaa protocol module .
This is the url representing the AAA protocol used and the location of the configuration file of this protocol.
Example 1.1. Set aaa_url parameter
...
modparam("uri", "aaa_url", "radius:/etc/radiusclient-ng/radiusclient.conf")
...
AAA service type used in
aaa_does_uri_exist and aaa_does_uri_user_exist checks.
Default value is 10 (Call-Check).
If zero, aaa_does_uri_exist
sends to AAA server Request URI user@host in UserName
attribute. If non-zero, aaa_does_uri_exist
sends to AAA server Request URI user in UserName attribute
and host in SIP-URI-Host attribute.
Default value is 0.
URL of the database to be used.
If the db_url string is not set, you will not be able to use the DB related functions.
Default value is “>NULL”.
Example 1.4. Set db_url parameter
...
modparam("uri", "db_url", "mysql://username:password@localhost/opensips")
...
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
(Section 1.3.9, “use_uri_table (integer)”) must be set.
Default value is “subscriber”.
Column holding usernames in the table.
Default value is “username”.
Column holding domain in the table.
Default value is “domain”.
Column holding URI username in the table.
Default value is “uri_user”.
Specify if the “uri” table should be used for checkings instead of “subscriber” table. A non-zero value means true.
Default value is “0 (false)”.
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)”.
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.
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.
Check if username in the request URI belongs to an existing user.
As the checking is done against URI table (if use_uri_table is set) or subscriber table.
This function can be used from REQUEST_ROUTE.
Checks given uri-string username against URI table (if use_uri_table is set) or subscriber table (database backend required). Returns true if the user exists in the database, and sets the given variables to the authentication id and realm corresponding to the given uri.
This function can be used from REQUEST_ROUTE.
Example 1.14. db_get_auth_id usage
...
if (db_get_auth_id("$ru", "$avp(auth_id)", "$avp(auth_realm)")) {
...
};
...
Checks from Radius if user@host in Request-URI or in URI stored in pseudo variable argument belongs to a local user. Can be used to decide if 404 or 480 should be returned after lookup has failed. If yes, loads AVP based on SIP-AVP reply items returned from Radius. Each SIP-AVP reply item must have a string value of form:
value = SIP_AVP_NAME SIP_AVP_VALUE
SIP_AVP_NAME = STRING_NAME | '#'ID_NUMBER
SIP_AVP_VALUE = ':'STRING_VALUE | '#'NUMBER_VALUE
Returns 1 if Radius returns Access-Accept, -1 if Radius returns Access-Reject, and -2 in case of internal error.
This function can be used from REQUEST_ROUTE.
Similar to aaa_does_uri_exist, but check is done based only on Request-URI user part or user stored in pseudo variable argument. User should thus be unique among all users, such as an E.164 number.
This function can be used from REQUEST_ROUTE.
Check if the username in credentials matches the given username.
Meaning of the parameters is as follows:
username - Username string.
This function can be used from REQUEST_ROUTE.
Check if To header field uri contains tag parameter.
This function can be used from REQUEST_ROUTE.
Find if Request URI has a given parameter with no value
Meaning of the parameters is as follows:
param - parameter name to look for.
This function can be used from REQUEST_ROUTE.
Find if Request URI has a given parameter with matching value
Meaning of the parameters is as follows:
param - parameter name to look for.
value - parameter value to match.
This function can be used from REQUEST_ROUTE.
Add to RURI a parameter (name=value);
Meaning of the parameters is as follows:
param - parameter to be appended in “name=value” format.
This function can be used from REQUEST_ROUTE.
Converts RURI, if it is tel URI, to SIP URI. Returns true, only if conversion succeeded or if no conversion was needed (like RURI was not tel URI.
This function can be used from REQUEST_ROUTE.
Checks if userpart of URI stored in pseudo variable is E164 number.
This function can be used from REQUEST_ROUTE and FAILURE_ROUTE.
Example 1.23. is_uri_user_e164 usage
...
if (is_uri_user_e164("$fu")) { # Check From header URI user part
...
}
if (is_uri_user_e164("$avp(called)") {
# Check user part of URI stored in avp called
...
};
...