# &adminguide;

## Overview

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

## DATAGRAM command syntax

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}

## Dependencies

### &osips; Modules

The following modules must be loaded before this module:

- No dependencies on other &osips; modules.

### External Libraries or Applications

The following libraries or applications must be installed before running &osips; with this module loaded:

- none

## Exported Parameters

### `socket_name` (string)

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")
    ...

### `children_count` (string)

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)
    ...

### `unix_socket_mode` (integer)

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)

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)

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")
    ...

### `socket_timeout` (integer)

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

Default value is 2000.

#### Set `socket_timeout` parameter

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

### `reply_indent` (string)

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", "    ")
    ...

## Exported Functions

No function exported to be used from configuration file.

## Example

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