Skip to main content

OpenSIPS CLI (Command Line Interface)

OpenSIPS CLI is an interactive command line tool that can be used to control and monitor OpenSIPS SIP servers. It uses the Management Interface exported by OpenSIPS over JSON-RPC to gather raw information from OpenSIPS and display it in a nicer, more structured manner to the user.

The tool is very flexible and has a modular design, consisting of multiple modules that implement different features. New modules can be easily added by creating a new module that implements the OpenSIPS CLI Module Interface.

OpenSIPS CLI is an interactive console that features auto-completion and reverse/forward command history search, but can also be used to execute one-liners for automation purposes.

OpenSIPS CLI can communicate with an OpenSIPS server using different transport methods, such as fifo or http.

Compatibility

This tool uses the new JSON-RPC interface added in OpenSIPS 3.0, therefore it can only be used with OpenSIPS versions higher than or equal to 3.0. For older versions of OpenSIPS, use the classic opensipsctl tool from the opensips project.

Usage

Tool

Simply run opensips-cli tool directly in your cli. By default the tool will start in interactive mode.

OpenSIPS CLI accepts the following arguments:

  • -h|--help - used to display information about running opensips-cli
  • -v|--version - displays the version of the running tool
  • -d|--debug - starts the opensips-cli tool with debugging enabled
  • -f|--config - specifies a configuration file (see Configuration Section for more information)
  • -i|--instance INSTANCE - changes the configuration instance (see Instance Module Documentation for more information)
  • -o|--option KEY=VALUE - sets/overwrites the KEY configuration parameter with the specified VALUE. Works for both core and modules parameters. Can be used multiple times, for different options
  • -x|--execute - executes the command specified and exits

In order to run opensips-cli without installing it, you have to export the PYTHONPATH variable to the root of the opensips-cli and python-opensips packages. If you installed the two packages under /usr/local/src, simply do:

export PYTHONPATH=/usr/local/src/opensips-cli:/usr/local/src/python-opensips
/usr/local/src/opensips-cli/bin/opensips-cli

Python Module

The module can be used as a python module as well. A simple snippet of running an MI command using the tool is:

from opensipscli import cli

opensipscli = cli.OpenSIPSCLI()
print(opensipscli.mi('ps'))

The OpenSIPSCLI object can receive a set of arguments/modifiers through the OpenSIPSCLIArgs class, i.e.:

from opensipscli import args
...
args = args.OpenSIPSCLIArgs(debug=True)
opensipscli = cli.OpenSIPSCLI(args)
...

Custom settings can be provided through the arguments, i.e.:

# run commands over http
args = args.OpenSIPSCLIArgs(communication_type = "http",
                       url="http://127.0.0.1:8080/mi")
...

Docker Image

The OpenSIPS CLI tool can be run in a Docker container. The image is available on Docker Hub at opensips/opensips-cli. For more information on how to run the tool in a Docker container, please refer to the OpenSIPS CLI Docker Image documentation.

Configuration

OpenSIPS CLI accepts a configuration file, formatted as an ini or cfg file, that can store certain parameters that influence the behavior of the OpenSIPS CLI tool. You can find here an example of a configuration file that behaves exactly as the default parameters. The set of default values used, when no configuration file is specified, can be found here.

The configuration file can have multiple sections/instances, managed by the Instance module. One can choose different instances from the configuration file by specifying the -i INSTANCE argument when starting the cli tool.

If no configuration file is specified by the -f|--config argument, OpenSIPS CLI searches for one in the following locations:

  • ~/.opensips-cli.cfg (highest precedence)
  • /etc/opensips-cli.cfg
  • /etc/opensips/opensips-cli.cfg (lowest precedence)

If no file is found, it starts with the default configuration.

The OpenSIPS CLI core can use the following parameters:

  • prompt_name: The name of the OpenSIPS CLI prompt (Default: opensips-cli)
  • prompt_intro: Introduction message when entering the OpenSIPS CLI
  • prompt_emptyline_repeat_cmd: Repeat the last command on an emptyline (Default: False)
  • history_file: The path of the history file (Default: ~/.opensips-cli.history)
  • history_file_size: The backlog size of the history file (Default: 1000)
  • log_level: The level of the console logging (Default: WARNING)
  • communication_type: Communication transport used by OpenSIPS CLI (Default: fifo)
  • fifo_file: The OpenSIPS FIFO file to which the CLI will write commands (Default: /var/run/opensips/opensips_fifo)
  • fifo_file_fallback: A fallback FIFO file that is being used when the fifo_file is not found - this has been introduces for backwards compatibility when the default fifo_file has been changed from /tmp/opensips_fifo (Default: /tmp/opensips_fifo)
  • fifo_reply_dir: The default directory where opensips-cli will create the fifo used for the reply from OpenSIPS (Default: /tmp)
  • url: The default URL used when http communication_type is used (Default: http://127.0.0.1:8888/mi).
  • datagram_ip: The default IP used when datagram communication_type is used (Default: 127.0.0.1)
  • datagram_port: The default port used when datagram communication_type is used (Default: 8080)
  • datagram_timeout: Timeout for Datagram Socket.
  • datagram_buffer_size: Buffer size for Datagram Socket.
  • datagram_unix_socket: Unix Domain Socket to use instead of UDP.

Each module can use each of the parameters above, but can also declare their own. You can find in each module's documentation page the parameters that they are using.

Configuration parameters can be overwritten using the -o/--option arguments, as described in the Usage section.

It is also possible to set a parameters dynamically, using the set command. This configuration is only available during the current interactive session, and also gets cleaned up when an instance is switched.

Modules

The OpenSIPS CLI tool consists of the following modules:

  • Management Interface - run MI commands
  • Database - commands to create, modify, drop, or migrate an OpenSIPS database
  • Diagnose - instantly diagnose OpenSIPS instances
  • Instance - used to switch through different instances/configuration within the config file
  • User - utility used to add and remove OpenSIPS users
  • Trace - trace calls information from users
  • Trap - use gdb to take snapshots of OpenSIPS workers
  • TLS - utility to generate certificates for TLS

Communication

OpenSIPS CLI can communicate with an OpenSIPS instance through MI using different transports. Supported transports at the moment are:

  • FIFO - communicate over the mi_fifo module
  • HTTP - use JSONRPC over HTTP through the mi_http module
  • DATAGRAM - communicate over UDP using the mi_datagram module

Installation

Please follow the details provided in the Installation section, for a complete guide on how to install opensips-cli as a replacement for the deprecated opensipsctl shell script.

Contribute

Feel free to contribute to this project with any module, or functionality you find useful by opening a pull request.

History

This project was started by Dorin Geman (dorin98) as part of the ROSEdu 2018 program. It has later been adapted to the new OpenSIPS 3.0 MI interface and became the main external tool for managing OpenSIPS.

License

The opensips-cli source code is licensed under the GNU General Public License v3.0

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

Creative Common Logo

© 2018 - 2020 OpenSIPS Solutions

Metadata

Release files for opensipscli 0.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opensipscli 0.4.2
File Size Uploaded Provenance Actions
opensipscli-0.4.2.tar.gz 79.9 kB With provenance Details for opensipscli-0.4.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for opensipscli 0.4.2
File Interpreter ABI Platform Actions
opensipscli-0.4.2-py3-none-any.whl Python 3 none any Details for opensipscli-0.4.2-py3-none-any.whl

Total release size: 156.6 kB

Release files / opensipscli-0.4.2.tar.gz

Download URL opensipscli-0.4.2.tar.gz
Size 79.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e405970734e2b5c1165424dae73978f54d9f84e40d7f288a21d8ad8919220aca
BLAKE2b-256 checksum
How to use checksums
bc49b2c63e2cd3e997e2904c1e4d05b04a15e8f891ddd9b4eb6a1ed162ebcb8e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Release files / opensipscli-0.4.2-py3-none-any.whl

Download URL opensipscli-0.4.2-py3-none-any.whl
Size 76.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c9ffe841b19934b629405a121dd7bfb20197a42520cf342273fc883221a1d8b9
BLAKE2b-256 checksum
How to use checksums
da84f10bfe72b78ced8f7c18f129b22b32ec3ef75e59a0fea2c029113bb03b29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Security for opensipscli 0.4.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for opensipscli-0.4.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page