Table of Contents
List of Tables
List of Examples
This module provides the means to provision and manage dynamic sockets for OpenSIPS at runtime. The definition of the sockets is stored in an SQL database and can be dynamically changed at runtime.
The module caches the entire table sockets and only adjusts the dynamic socket list after a reload using the sockets_reload MI command.
The sockets_list MI command. can be used to show all the dynamic sockets OpenSIPS is listening on.
The module exclusively handles sockets used for SIP traffic (e.g., UDP, TCP, TLS, WSS). It does not support BIN or HEP listeners, as these cannot be dynamically utilized or enforced in the script.
The management of dynamic sockets is divided into two behaviors, depending on whether the traffic is UDP-based or TCP-based. Based on the nature of your traffic, ensure that your settings are properly tuned to accommodate any sockets you may provision dynamically.
All dynamically added UDP sockets are assigned to a group of dedicated extra processes. The number of these processes can be adjusted using the processes parameter. These processes handle UDP-based socket traffic evenly by balancing requests across the less loaded processes. The difference, however, is that static sockets are bound to designated processes, while dynamic sockets share the pool of extra processes.
Although traffic processing by dynamic workers closely resembles that of static ones, there are certain limitations associated with using dynamic sockets:
UDP socket handling does not currently benefit from the autoscaling feature for the designated extra processes. This means that the number of processes defined at startup will always be forked, and only these processes will handle all traffic associated with dynamically added UDP sockets.
As stated earlier, the module only supports SIP based dynamic listener, no HEP or BIN.
Sockets defined in the database cannot be expanded to more than one listener. This means you cannot use an interface name or an alias that resolves to multiple IPs as a host. Only a single IP:port socket will be created, so provisioning should ideally be done with an explicit IP.
Due to some internal limitations, the dynamic sockets need to be pre-allocated at startup. This means that the number of dynamic sockets used at runtime have to be limited by a static value, defined at startup. This is why it is recommended to use a fairly high value for the sockets in the max_sockets parameter - we're defaulting a confortable 100 sockets.
The sockets defined in the max_sockets are being rotated in a FIFO manner - this way we are trying to avoid overlapping sockets in a short period of time.
The following modules must be loaded before this module:
A database module is needed for fetching the sockets.
The database URL where the sockets are fetched from.
Default value is “mysql://opensips:opensipsrw@localhost/opensips”.
Example 1.1. Set “db_url” parameter
... modparam("sockets_mgm", "db_url", "dbdriver://username:password@dbhost/dbname") ...
The database table name where the sockets are stored.
Default value is “sockets”.
Example 1.2. Set “table_name” parameter
... modparam("sockets_mgm", "table_name", "sockets_def") ...
The database table column where the socket definition is stored.
Default value is “socket”.
The database table column where the advertised definition is stored.
Default value is “advertised”.
Example 1.4. Set “advertised_column” parameter
... modparam("advertiseds_mgm", "advertised_column", "adv") ...
The database table column where the tag definition is stored.
Default value is “tag”.
The database table column where the flags definition is stored.
Default value is “flags”.
The database table column where the tos definition is stored.
Default value is “tos”.
The number of processes designated to handle UDP sockets.
Default value is “8”.
The maximum number of sockets that can be defined dinamically. See the Limitations section for more information.
Default value is “100”.
MI command used to reload the sockets from the database.
MI FIFO Command Format:
## reload sockets from the database opensips-mi sockets_reload opensips-cli -x mi sockets_reload
Table 2.1. Top contributors by DevScore(1), authored commits(2) and lines added/removed(3)
Name | DevScore | Commits | Lines ++ | Lines -- | |
---|---|---|---|---|---|
1. | Razvan Crainea (@razvancrainea) | 33 | 4 | 2207 | 572 |
(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. Regarding imported patches/code, we do our best to count the work on behalf of the proper owner, as per the "fix_authors" and "mod_renames" arrays in opensips/doc/build-contrib.sh. If you identify any patches/commits which do not get properly attributed to you, please submit a pull request which extends "fix_authors" and/or "mod_renames".
(3) ignoring whitespace edits, renamed files and auto-generated files
Table 2.2. Most recently active contributors(1) to this module
Name | Commit Activity | |
---|---|---|
1. | Razvan Crainea (@razvancrainea) | Mar 2025 - May 2025 |
(1) including any documentation-related commits, excluding merge commits
Last edited by: Razvan Crainea (@razvancrainea).
Documentation Copyrights:
Copyright © 2025 OpenSIPS Solutions;