mi_fifo Module
     __________________________________________________________

   Table of Contents

   1. Admin Guide

        1.1. Overview
        1.2. FIFO command syntax
        1.3. Values Returned
        1.4. Dependencies

              1.4.1. OpenSIPS Modules
              1.4.2. External Libraries or Applications

        1.5. Exported Parameters

              1.5.1. fifo_name (string)
              1.5.2. fifo_mode (integer)
              1.5.3. fifo_group (integer) fifo_group (string)
              1.5.4. fifo_user (integer) fifo_group (string)
              1.5.5. reply_dir (string)
              1.5.6. pretty_printing (int)
              1.5.7. trace_destination (string)
              1.5.8. trace_bwlist (string)

        1.6. Exported Functions
        1.7. Example

   2. Contributors

        2.1. By Commit Statistics
        2.2. By Commit Activity

   3. Documentation

        3.1. Contributors

   List of Tables

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

   2.2. Most recently active contributors^(1) to this module

   List of Examples

   1.1. Set fifo_name parameter
   1.2. Set fifo_mode parameter
   1.3. Set fifo_group parameter
   1.4. Set fifo_user parameter
   1.5. Set reply_dir parameter
   1.6. Set pretty_printing parameter
   1.7. Set trace_destination parameter
   1.8. Set trace_destination parameter
   1.9. FIFO request

Chapter 1. Admin Guide

1.1. Overview

   This is a module which provides a FIFO transport layer
   implementation for Management Interface. It receives the
   command over a FIFO file and returns the output through the
   reply_fifo specified.

   The module checks every 30 seconds if the FIFO file exists, and
   if it was deleted, it recreates it. If one wants to force the
   fifo file recreation, it should send a SIGHUP signal to the MI
   process PID.

1.2. FIFO command syntax

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

   request = ':'(reply_fifo)?':'jsonrpc_command

   If the reply_fifo is missing, the MI FIFO module will not send
   any reply back. A similar behavior happens when the
   jsonrpc_command does not contain the id element, and the
   command is considered a JSON-RPC notification.

1.3. Values Returned

   In case of success, a valid JSON-RPC response is replied back
   on the fifo file, containing a successful JSON-RPC response.

   In case of failure of the MI command, a JSON-RPC reply error is
   sent back over the reply fifo file.

   If case of an error generated by the MI engine, mostly internal
   errors, an error cause is sent back over the reply FIFO in
   plain text.

1.4. Dependencies

1.4.1. OpenSIPS Modules

   The following modules must be loaded before this module:
     * No dependencies on other OpenSIPS modules.

1.4.2. External Libraries or Applications

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

1.5. Exported Parameters

1.5.1. fifo_name (string)

   The name of the FIFO file to be created for listening and
   reading external commands.

   NOTE:Starting with Linux kernel 4.19, processes can no longer
   read from FIFO files that are saved in directories with sticky
   bits (such as /tmp) and are not owned by the same user the
   process runs with. This prevents external tools (such as
   opensips-cli) from running MI commands using a different user
   (a Permissions denied error is triggered). If you are getting
   this error while trying to use opensips-cli, you can fix it by
   either store the fifo file in a non-sticky bit directory (such
   as /run/opensips), or disable the fifo protection using sysctl
   fs.protected_fifos = 0 (NOT RECOMMENDED).

   Default value is "/tmp/opensips_fifo".

   Example 1.1. Set fifo_name parameter
...
modparam("mi_fifo", "fifo_name", "/tmp/opensips_b2b_fifo")
...

1.5.2. fifo_mode (integer)

   Permission to be used for creating the listening FIFO file. It
   follows the UNIX conventions.

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

   Example 1.2. Set fifo_mode parameter
...
modparam("mi_fifo", "fifo_mode", 0600)
...

1.5.3. fifo_group (integer) fifo_group (string)

   Group to be used for creating the listening FIFO file.

   Default value is the inherited one.

   Example 1.3. Set fifo_group parameter
...
modparam("mi_fifo", "fifo_group", 0)
modparam("mi_fifo", "fifo_group", "root")
...

1.5.4. fifo_user (integer) fifo_group (string)

   User to be used for creating the listening FIFO file.

   Default value is the inherited one.

   Example 1.4. Set fifo_user parameter
...
modparam("mi_fifo", "fifo_user", 0)
modparam("mi_fifo", "fifo_user", "root")
...

1.5.5. reply_dir (string)

   Directory to be used for creating the reply FIFO files.

   Default value is “/tmp/”

   Example 1.5. Set reply_dir parameter
...
modparam("mi_fifo", "reply_dir", "/home/opensips/tmp/")
...

1.5.6. pretty_printing (int)

   Indicates whether the JSONRPC responses sent through MI should
   be pretty-printed or not.

   Default value is “0 - no pretty-printing”.

   Example 1.6. Set pretty_printing parameter
...
modparam("mi_fifo", "pretty_printing", 1)
...

1.5.7. trace_destination (string)

   Trace destination as defined in the tracing module. Currently
   the only tracing module is proto_hep. This is where traced mi
   messages will go.

   WARNING: A tracing module must be loaded in order for this
   parameter to work. (for example proto_hep).

   Default value is none(not defined).

   Example 1.7. Set trace_destination parameter
...
modparam("proto_hep", "trace_destination", "[hep_dest]10.0.0.2;transport
=tcp;version=3")

modparam("mi_fifo", "trace_destination", "hep_dest")
...

1.5.8. trace_bwlist (string)

   Filter traced mi commands based on a blacklist or a whitelist.
   trace_destination must be defined for this parameter to have
   any purpose. Whitelists can be defined using 'w' or 'W',
   blacklists using 'b' or 'B'. The type is separate by the actual
   blacklist by ':'. The mi commands in the list must be separated
   by ','.

   Defining a blacklists means all the commands that are not
   blacklisted will be traced. Defining a whitelist means all the
   commands that are not whitelisted will not be traced. WARNING:
   One can't define both a whitelist and a blacklist. Only one of
   them is allowed. Defining the parameter a second time will just
   overwrite the first one.

   WARNING: A tracing module must be loaded in order for this
   parameter to work. (for example proto_hep).

   Default value is none(not defined).

   Example 1.8. Set trace_destination parameter
...
## blacklist ps and which mi commands
## all the other commands shall be traced
modparam("mi_fifo", "trace_bwlist", "b: ps, which")
...
## allow only sip_trace mi command
## all the other commands will not be traced
modparam("mi_fifo", "trace_bwlist", "w: sip_trace")
...

1.6. Exported Functions

   No function exported to be used from configuration file.

1.7. Example

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

   Example 1.9. FIFO request

:reply_fifo:{"jsonrpc":"2.0","method":"get_statistics","id":"5672","para
ms":[["dialog:","tm:"]]}


Chapter 2. Contributors

2.1. By Commit Statistics

   Table 2.1. Top contributors by DevScore^(1), authored
   commits^(2) and lines added/removed^(3)
     Name DevScore Commits Lines ++ Lines --
   1. Bogdan-Andrei Iancu (@bogdan-iancu) 62 37 2289 248
   2. Razvan Crainea (@razvancrainea) 42 19 582 1072
   3. Liviu Chircu (@liviuchircu) 17 14 33 72
   4. Daniel-Constantin Mierla (@miconda) 12 10 20 22
   5. Ionut Ionita (@ionutrazvanionita) 7 4 211 22
   6. Maksym Sobolyev (@sobomax) 5 3 16 18
   7. Henning Westerholt (@henningw) 5 2 62 109
   8. Zero King (@l2dy) 3 1 5 3
   9. Jerome Martin 3 1 3 3
   10. Konstantin Bokarius 3 1 2 5

   All remaining contributors: Ovidiu Sas (@ovidiusas), Alexey
   Vasilyev (@vasilevalex), Julián Moreno Patiño, Peter Lemenkov
   (@lemenkov), Edson Gellert Schubert, Dusan Klinec (@ph4r05),
   Alexandra Titoc, Vlad Patrascu (@rvlad-patrascu), Walter Doekes
   (@wdoekes).

   (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

2.2. By Commit Activity

   Table 2.2. Most recently active contributors^(1) to this module
                      Name                   Commit Activity
   1.  Alexandra Titoc                     Sep 2024 - Sep 2024
   2.  Liviu Chircu (@liviuchircu)         Mar 2014 - May 2024
   3.  Maksym Sobolyev (@sobomax)          Feb 2021 - Feb 2023
   4.  Alexey Vasilyev (@vasilevalex)      Mar 2022 - Mar 2022
   5.  Razvan Crainea (@razvancrainea)     Feb 2012 - Jul 2021
   6.  Bogdan-Andrei Iancu (@bogdan-iancu) Oct 2006 - Apr 2021
   7.  Zero King (@l2dy)                   Mar 2020 - Mar 2020
   8.  Peter Lemenkov (@lemenkov)          Jun 2018 - Jun 2018
   9.  Vlad Patrascu (@rvlad-patrascu)     May 2017 - May 2017
   10. Ionut Ionita (@ionutrazvanionita)   Jan 2017 - Feb 2017

   All remaining contributors: Julián Moreno Patiño, Dusan Klinec
   (@ph4r05), Walter Doekes (@wdoekes), Daniel-Constantin Mierla
   (@miconda), Konstantin Bokarius, Edson Gellert Schubert, Ovidiu
   Sas (@ovidiusas), Henning Westerholt (@henningw), Jerome
   Martin.

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

Chapter 3. Documentation

3.1. Contributors

   Last edited by: Alexey Vasilyev (@vasilevalex), Razvan Crainea
   (@razvancrainea), Liviu Chircu (@liviuchircu), Peter Lemenkov
   (@lemenkov), Ionut Ionita (@ionutrazvanionita), Bogdan-Andrei
   Iancu (@bogdan-iancu), Daniel-Constantin Mierla (@miconda),
   Konstantin Bokarius, Edson Gellert Schubert, Jerome Martin.

   Documentation Copyrights:

   Copyright © 2006 Voice Sistem SRL
