DOMAIN module
Admin Guide
Section titled “Admin Guide”Overview
Section titled “Overview”Domain module implements checks that based on domain table determine if a host part of an URI is “local” or not. A “local” domain is one that the proxy is responsible for.
Domain module operates in caching or non-caching mode depending on
value of module parameter db_mode.
In caching mode domain module reads the contents of domain table into
cache memory when the module is loaded. After that domain table is
re-read only when module is given domain_reload fifo command. Any
changes in domain table must thus be followed by
“domain_reload” command in order to reflect them in
module behavior. In non-caching mode domain module always queries domain
table in the database.
Caching is implemented using a hash table. The size of the hash table is given by HASH_SIZE constant defined in domain_mod.h. Its “factory default” value is 128.
Dependencies
Section titled “Dependencies”The module depends on the following modules (in the other words the listed modules must be loaded before this module):
- database — Any database module
Exported Parameters
Section titled “Exported Parameters”db_url (string)
Section titled “db_url (string)”This is URL of the database to be used.
Default value is “mysql://opensipsro:opensipsro@localhost/opensips”
modparam("domain", "db_url", "mysql://ser:pass@db_host/ser")db_mode (integer)
Section titled “db_mode (integer)”Database mode: 0 means non-caching, 1 means caching.
Default value is 0 (non-caching).
modparam("domain", "db_mode", 1) # Use cachingdomain_table (string)
Section titled “domain_table (string)”Name of table containing names of local domains that the proxy is responsible for. Local users must have in their sip uri a host part that is equal to one of these domains.
Default value is “domain”.
modparam("domain", "domain_table", "new_name")domain_col (string)
Section titled “domain_col (string)”Name of column containing domains in domain table.
Default value is “domain”.
modparam("domain", "domain_col", "domain_name")Exported Functions
Section titled “Exported Functions”is_from_local()
Section titled “is_from_local()”Checks based on domain table if host part of From header uri is one of the local domains that the proxy is responsible for
This function can be used from REQUEST_ROUTE.
...if (is_from_local()) { ...};...is_uri_host_local()
Section titled “is_uri_host_local()”If called from route or failure route block, checks based on domain table if host part of Request-URI is one of the local domains that the proxy is responsible for. If called from branch route, the test is made on host part of URI of first branch, which thus must have been appended to the transaction before is_uri_host_local() is called.
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE.
...if (is_uri_host_local()) { ...};...is_domain_local(pseudo_variable)
Section titled “is_domain_local(pseudo_variable)”This function checks if the domain contained in the pseudo_variable is local.
This function is a generalized form of the is_from_local() and is_uri_host_local() functions, being able to completely replace them and also extends them by allowing the domain to be taken from any of the above mentioned sources. The following equivalences exist:
- is_domain_local(“$rd”) is same as is_uri_host_local()
- is_domain_local(“$fd”) is same as is_from_local()
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE.
...if (is_domain_local("$rd")) { ...};if (is_domain_local("$fd")) { ...};if (is_domain_local("$avp(some_avp_alias)")) { ...};if (is_domain_local("$avp(i:850)")) { ...};if (is_domain_local("$avp(s:some_avp)")) { ...};...Exported MI Functions
Section titled “Exported MI Functions”domain_reload
Section titled “domain_reload”Causes domain module to re-read the contents of domain table into cache memory.
Name: domain_reload
Parameters: none
MI FIFO Command Format:
:domain_reload:_reply_fifo_file__empty_line_domain_dump
Section titled “domain_dump”Causes domain module to dump hash indexes and domain names in its cache memory.
Name: domain_dump
Parameters: none
MI FIFO Command Format:
:domain_dump:_reply_fifo_file__empty_line_Known Limitations
Section titled “Known Limitations”There is an unlikely race condition on domain list update. If a process uses a table, which is reloaded at the same time twice through FIFO, the second reload will delete the original table still in use by the process.
Developer Guide
Section titled “Developer Guide”The module provides is_domain_local API function for use by other OpenSIPS modules.
Available Functions
Section titled “Available Functions”is_domain_local(domain)
Section titled “is_domain_local(domain)”Checks if domain given in str* parameter is local.
The function returns 1 if domain is local and -1 if domain is not local or if an error occurred.
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. | Bogdan-Andrei Iancu (@bogdan-iancu) | 42 | 29 | 385 | 509 |
| 2. | Jan Janak (@janakj) | 33 | 21 | 1036 | 150 |
| 3. | Juha Heinanen (@juha-h) | 32 | 20 | 726 | 259 |
| 4. | Daniel-Constantin Mierla (@miconda) | 18 | 16 | 73 | 58 |
| 5. | Stefan Darius (@dariusstefan) | 9 | 5 | 331 | 54 |
| 6. | Andrei Pelinescu-Onciul | 9 | 4 | 186 | 121 |
| 7. | Dan Pascu (@danpascu) | 8 | 4 | 237 | 106 |
| 8. | Henning Westerholt (@henningw) | 7 | 5 | 25 | 29 |
| 9. | Elena-Ramona Modroiu | 4 | 2 | 28 | 5 |
| 10. | Jiri Kuthan (@jiriatipteldotorg) | 4 | 2 | 3 | 1 |
All remaining contributors: Konstantin Bokarius, Klaus Darilion, Razvan Crainea (@razvancrainea), Norman Brandinger (@NormB), Andreas Granig, Edson Gellert Schubert.
(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 2026 - Jun 2026 |
| 3. | Bogdan-Andrei Iancu (@bogdan-iancu) | Oct 2005 - Mar 2009 |
| 4. | Juha Heinanen (@juha-h) | Jan 2003 - May 2008 |
| 5. | Henning Westerholt (@henningw) | May 2007 - May 2008 |
| 6. | Daniel-Constantin Mierla (@miconda) | Oct 2005 - Mar 2008 |
| 7. | Konstantin Bokarius | Mar 2008 - Mar 2008 |
| 8. | Edson Gellert Schubert | Feb 2008 - Feb 2008 |
| 9. | Elena-Ramona Modroiu | Jan 2007 - Jan 2007 |
| 10. | Dan Pascu (@danpascu) | Aug 2004 - Nov 2006 |
All remaining contributors: Norman Brandinger (@NormB), Andreas Granig, Klaus Darilion, Jan Janak (@janakj), Andrei Pelinescu-Onciul, Jiri Kuthan (@jiriatipteldotorg).
(1) including any documentation-related commits, excluding merge commits
Documentation
Section titled “Documentation”Contributors
Section titled “Contributors”Last edited by: Razvan Crainea (@razvancrainea), Bogdan-Andrei Iancu (@bogdan-iancu), Daniel-Constantin Mierla (@miconda), Konstantin Bokarius, Edson Gellert Schubert, Juha Heinanen (@juha-h), Elena-Ramona Modroiu, Dan Pascu (@danpascu), Klaus Darilion, Jan Janak (@janakj).
License
Section titled “License”All documentation files (i.e. .md extension) are licensed under the Creative Common License 4.0