Skip to content

MI_DATAGRAM module

This is a module which provides a UNIX/UDP SOCKET transport layer implementation for the Management Interface.

The external commands issued via DATAGRAM interface must follow the following syntax:

  • request = first_line (argument ‘\n’)*
  • first_line = ’:‘command_name’:”\n’
  • argument = (arg_name ’::’ (arg_value)? ) | (arg_value)
  • arg_name = not-quoted_string
  • arg_value = not-quoted_string | ’”’ string ’”’
  • not-quoted_string = string - {’,”,\n,\r}

The following modules must be loaded before this module:

  • No dependencies on other OpenSIPS modules.

The following libraries or applications must be installed before running OpenSIPS with this module loaded:

  • none

The name of a UNIX SOCKET or an IP address. The UNIX datagram or UDP socket will be created using this parameter in order to read the external commands. Both IPv4 and IPv6 are supported.

Default value is NONE.

Set socket_name parameter
...
modparam("mi_datagram", "socket_name", "/tmp/opensips.sock")
...
modparam("mi_datagram", "socket_name", "udp:192.168.2.133:8080")
...

The number of child processes to be created. Each child process will be a datagram server.

Default value is 1.

Set children_count parameter
...
modparam("mi_datagram", "children_count", 3)
...

Permission to be used for creating the listening UNIX datagram socket. Not necessary for a UDP socket. It follows the UNIX conventions.

Default value is 0660 (rw-rw----).

Set unix_socket_mode parameter
...
modparam("mi_datagram", "unix_socket_mode", 0600)
...

unix_socket_group (integer) unix_socket_group (string)

Section titled “unix_socket_group (integer) unix_socket_group (string)”

Group to be used for creating the listening UNIX socket.

Default value is the inherited one.

Set unix_socket_group parameter
...
modparam("mi_datagram", "unix_socket_group", 0)
modparam("mi_datagram", "unix_socket_group", "root")
...

unix_socket_user (integer) unix_socket_group (string)

Section titled “unix_socket_user (integer) unix_socket_group (string)”

User to be used for creating the listening UNIX socket.

Default value is the inherited one.

Set unix_socket_user parameter
...
modparam("mi_datagram", "unix_socket_user", 0)
modparam("mi_datagram", "unix_socket_user", "root")
...

The reply will expire after trying to sent it for socket_timeout miliseconds.

Default value is 2000.

Set socket_timeout parameter
...
modparam("mi_datagram", "socket_timeout", 2000)
...

Strings to be used for line indentation. As the MI data structure is tree oriendeted, the depth level will printed as indentation.

Default value is ""\t” (TAB)”.

Set reply_indent parameter
...
modparam("mi_datagram", "reply_indent", " ")
...

No function exported to be used from configuration file.

This is an example showing the DATAGRAM format for the “get_statistics dialog: tm:” MI commad: response.

DATAGRAM request
:get_statistics:\n
dialog:\n
tm:\n

Q: Both UNIX and UDP type of socket can be created simultaneusly?

This version supports only one kind of socket at a time. If there are more than one value set for socket_name the last one will take effect.

Q: Is there a limit in the datagram request’s size?

The maximum length of a datagram request or reply is 65457 bytes.

Q: Where can I find more about OpenSIPS?

Take a look at http://www.opensips.org/.

Q: Where can I post a question about this module?

First at all check if your question was already answered on one of our mailing lists:

E-mails regarding any stable OpenSIPS release should be sent to users@lists.opensips.org and e-mails regarding development versions should be sent to devel@lists.opensips.org.

If you want to keep the mail private, send it to users@lists.opensips.org.

Q: How can I report a bug?

Please follow the guidelines provided at: https://github.com/OpenSIPS/opensips/issues.

Top contributors by DevScore(1), authored commits(2) and lines added/removed(3)

#NameDevScoreCommitsLines++Lines—
1.Bogdan-Andrei Iancu (@bogdan-iancu)3526349321
2.Ancuta Onofrei2822423252
3.Daniel-Constantin Mierla (@miconda)971816
4.Stefan Darius (@dariusstefan)8427729
5.Henning Westerholt (@henningw)531012
6.Razvan Crainea (@razvancrainea)5326
7.Klaus Darilion3144
8.Konstantin Bokarius3126
9.Edson Gellert Schubert21044

(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

#NameCommit Activity
1.Stefan Darius (@dariusstefan)Jun 2026 - Jul 2026
2.Razvan Crainea (@razvancrainea)Oct 2011 - Jun 2026
3.Bogdan-Andrei Iancu (@bogdan-iancu)Jun 2007 - Dec 2012
4.Henning Westerholt (@henningw)Aug 2007 - Jul 2008
5.Klaus DarilionJul 2008 - Jul 2008
6.Daniel-Constantin Mierla (@miconda)Mar 2008 - Mar 2008
7.Konstantin BokariusMar 2008 - Mar 2008
8.Edson Gellert SchubertFeb 2008 - Feb 2008
9.Ancuta OnofreiJun 2007 - Sep 2007

(1) including any documentation-related commits, excluding merge commits

Last edited by: Razvan Crainea (@razvancrainea), Bogdan-Andrei Iancu (@bogdan-iancu), Klaus Darilion, Daniel-Constantin Mierla (@miconda), Konstantin Bokarius, Edson Gellert Schubert, Ancuta Onofrei.

All documentation files (i.e. .md extension) are licensed under the Creative Common License 4.0