URI module
Admin Guide
Section titled “Admin Guide”Overview
Section titled “Overview”Various checks related to SIP URI.
This module implements some URI related AAA or DB based tests.
Dependencies
Section titled “Dependencies”OpenSIPS Modules
Section titled “OpenSIPS Modules”At least one of the following modules must be loaded before this module:
- a OpenSIPS database module.
- an aaa protocol module.
External Libraries or Applications
Section titled “External Libraries or Applications”The following libraries or applications must be installed before running OpenSIPS with this module loaded:
- None.
Exported Parameters
Section titled “Exported Parameters”aaa_url (string)
Section titled “aaa_url (string)”This is the url representing the AAA protocol used and the location of the configuration file of this protocol.
...modparam("uri", "aaa_url", "radius:/etc/radiusclient-ng/radiusclient.conf")...service_type (integer)
Section titled “service_type (integer)”AAA service type used in
aaa_does_uri_exist and aaa_does_uri_user_exist checks.
Default value is 10 (Call-Check).
...modparam("uri", "service_type", 11)...use_sip_uri_host (integer)
Section titled “use_sip_uri_host (integer)”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.
...modparam("uri", "use_sip_uri_host", 1)...db_url (string)
Section titled “db_url (string)”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”.
...modparam("uri", "db_url", "mysql://username:password@localhost/opensips")...db_table (string)
Section titled “db_table (string)”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 (use uri table) must be set.
Default value is “subscriber”.
...modparam("uri", "db_table", "uri")...user_column (string)
Section titled “user_column (string)”Column holding usernames in the table.
Default value is “username”.
...modparam("uri", "user_column", "username")...domain_column (string)
Section titled “domain_column (string)”Column holding domain in the table.
Default value is “domain”.
...modparam("uri", "domain_column", "domain")...uriuser_column (string)
Section titled “uriuser_column (string)”Column holding URI username in the table.
Default value is “uri_user”.
...modparam("uri", "uriuser_column", "uri_user")...use_uri_table (integer)
Section titled “use_uri_table (integer)”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)“.
...modparam("uri", "use_uri_table", 1)...use_domain (integer)
Section titled “use_domain (integer)”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)”.
...modparam("uri", "use_domain", 1)...Exported Functions
Section titled “Exported Functions”db_check_to()
Section titled “db_check_to()”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.
...if (db_check_to()) { ...};...db_check_from()
Section titled “db_check_from()”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.
...if (db_check_from()) { ...};...db_does_uri_exist()
Section titled “db_does_uri_exist()”Check if username in the request URI belongs to an existing user.
Matching is done against the URI table (if use_uri_table is set) or the subscriber table.
This function can be used from REQUEST_ROUTE.
...if (db_does_uri_exist()) { ...};...db_get_auth_id(string, var, var)
Section titled “db_get_auth_id(string, var, var)”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.
...if (db_get_auth_id("$ru", "$avp(auth_id)", "$avp(auth_realm)")) { ...};...aaa_does_uri_exist([pvar])
Section titled “aaa_does_uri_exist([pvar])”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.
...if (aaa_does_uri_exist()) { ...};...aaa_does_uri_user_exist([pvar])
Section titled “aaa_does_uri_user_exist([pvar])”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.
...if (aaa_does_uri_user_exist()) { ...};...is_user(username)
Section titled “is_user(username)”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.
...if (is_user("john")) { ...};...has_totag()
Section titled “has_totag()”Check if To header field uri contains tag parameter.
This function can be used from REQUEST_ROUTE.
...if (has_totag()) { ...};...uri_param(param)
Section titled “uri_param(param)”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.
...if (uri_param("param1")) { ...};...uri_param(param,value)
Section titled “uri_param(param,value)”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.
...if (uri_param("param1","value1")) { ...};...add_uri_param(param)
Section titled “add_uri_param(param)”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.
...add_uri_param("nat=yes");...tel2sip()
Section titled “tel2sip()”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.
...tel2sip();...is_uri_user_e164(pseudo-variable)
Section titled “is_uri_user_e164(pseudo-variable)”Checks if userpart of URI stored in pseudo variable is E164 number.
This function can be used from REQUEST_ROUTE and FAILURE_ROUTE.
...if (is_uri_user_e164("$fu")) { # Check From header URI user part ...}if (is_uri_user_e164("$avp(uri)") { # Check user part of URI stored in avp uri ...};...Contributors
Section titled “Contributors”By Commit Statistics
Section titled “By Commit Statistics”Top contributors by DevScore(1), authored commits(2) and lines added/removed(3)
| # | Name | DevScore | Commits | Lines++ | Lines— |
|---|---|---|---|---|---|
| 1. | Jan Janak (@janakj) | 49 | 20 | 1473 | 923 |
| 2. | Irina-Maria Stanescu | 23 | 4 | 1857 | 123 |
| 3. | Bogdan-Andrei Iancu (@bogdan-iancu) | 20 | 17 | 82 | 71 |
| 4. | Daniel-Constantin Mierla (@miconda) | 14 | 12 | 46 | 55 |
| 5. | Juha Heinanen (@juha-h) | 13 | 7 | 446 | 71 |
| 6. | Stefan Darius (@dariusstefan) | 9 | 3 | 576 | 59 |
| 7. | Razvan Crainea (@razvancrainea) | 7 | 5 | 8 | 8 |
| 8. | Jiri Kuthan (@jiriatipteldotorg) | 6 | 4 | 41 | 31 |
| 9. | Henning Westerholt (@henningw) | 6 | 3 | 8 | 69 |
| 10. | Liviu Chircu (@liviuchircu) | 4 | 2 | 26 | 25 |
All remaining contributors: Andrei Pelinescu-Onciul, Anca Vamanu, Sergio Gutierrez, Konstantin Bokarius, Dusan Klinec (@ph4r05), Edson Gellert Schubert, Elena-Ramona Modroiu.
(1) DevScore = author_commits + author_lines_added / (project_lines_added / project_commits) + author_lines_deleted / (project_lines_deleted / project_commits)
(2) including any documentation-related commits, excluding merge commits
(3) ignoring whitespace edits, renamed files and auto-generated files
By Commit Activity
Section titled “By Commit Activity”| # | Name | Commit Activity |
|---|---|---|
| 1. | Stefan Darius (@dariusstefan) | Jun 2026 - Jul 2026 |
| 2. | Razvan Crainea (@razvancrainea) | Jun 2011 - Jun 2026 |
| 3. | Dusan Klinec (@ph4r05) | Dec 2015 - Dec 2015 |
| 4. | Bogdan-Andrei Iancu (@bogdan-iancu) | Jan 2006 - Oct 2014 |
| 5. | Liviu Chircu (@liviuchircu) | Oct 2013 - Mar 2014 |
| 6. | Irina-Maria Stanescu | Aug 2009 - Dec 2009 |
| 7. | Sergio Gutierrez | Nov 2008 - Nov 2008 |
| 8. | Daniel-Constantin Mierla (@miconda) | Nov 2006 - Mar 2008 |
| 9. | Konstantin Bokarius | Mar 2008 - Mar 2008 |
| 10. | Edson Gellert Schubert | Feb 2008 - Feb 2008 |
All remaining contributors: Juha Heinanen (@juha-h), Henning Westerholt (@henningw), Anca Vamanu, Elena-Ramona Modroiu, Jiri Kuthan (@jiriatipteldotorg), Jan Janak (@janakj), Andrei Pelinescu-Onciul.
(1) including any documentation-related commits, excluding merge commits
Documentation
Section titled “Documentation”Contributors
Section titled “Contributors”Last edited by: Razvan Crainea (@razvancrainea), Liviu Chircu (@liviuchircu), Bogdan-Andrei Iancu (@bogdan-iancu), Irina-Maria Stanescu, Daniel-Constantin Mierla (@miconda), Konstantin Bokarius, Edson Gellert Schubert, Juha Heinanen (@juha-h), Elena-Ramona Modroiu, Jan Janak (@janakj).
License
Section titled “License”All documentation files (i.e. .md extension) are licensed under the Creative Common License 4.0