Documentation |
Documentation -> Manuals -> Manual devel -> Management InterfacePages for other versions: devel 3.5 3.4 Older versions: 3.3 3.2 3.1 3.0 2.4 2.3 2.2 2.1 1.11 1.10 1.9 1.8 1.7 1.6 1.5 1.4
The Management Interface (or MI) is an OpenSIPS interface that allows external applications to trigger predefined commands inside OpenSIPS. OverviewSuch commands typically allows an external app to :
The MI commands are provided by the OpenSIPS core (see full list) and also by modules (check the commands provided by each module). ProtocolsThe protocols available in order to connect (from external apps) to the OpenSIPS MI are JSON-RPC over several transports and XML-RPC. While the interface itself (tailored around the JSON format) is provided by the OpenSIPS core, each actual transport protocol is provided by a separate OpenSIPS module. You can load multiple MI modules in order to use multiple MI transport protocols at the same time. The majority of the MI backend modules only provide the transport, while the command parsing and response formatting (as JSON-RPC) is done by the OpenSIPS core. The only exceptions are the mi_html and mi_xmlrpc_ng modules, which use a different format. The available MI modules are :
All protocols do allow multiple applications (clients) to connect at the same time to the MI interface. ExamplesA few examples of JSON-RPC calls for OpenSIPS: # Request with no parameters: { "jsonrpc": "2.0", "method": "ps", "id": 10 } # Response: { "jsonrpc": "2.0", "result": { "Processes": [{ "ID": 0, "PID": 9467, "Type": "attendant" }, { "ID": 1, "PID": 9468, "Type": "HTTPD 127.0.0.1:8008" }, { "ID": 3, "PID": 9470, "Type": "time_keeper" }, { "ID": 4, "PID": 9471, "Type": "timer" }, { "ID": 5, "PID": 9472, "Type": "SIP receiver udp:127.0.0.1:5060 " }, { "ID": 7, "PID": 9483, "Type": "Timer handler" }, ] }, "id": 10 } # Request with positional parameters: { "jsonrpc": "2.0", "method": "log_level", "params": [4, 9472], "id": 11 } # Request with named parameters: { "jsonrpc": "2.0", "method": "log_level", "params": { "level": 4, "pid": 9472 }, "id": 11 } # Request with an array type of parameter: { "jsonrpc": "2.0", "method": "get_statistics", "params": { "statistics": ["shmem:", "core:"] }, "id": 11 } A simple example of interacting with OpenSIPS via MI interfaces is the opensips-cli utility - it uses FIFO to push MI commands into OpenSIPS: opensips-cli -x mi ps opensips-cli -x mi log_level 4 9472 Example of sending a JSON-RPC OpenSIPS MI command from the command-line, using curl: $ curl -X POST localhost:8888/mi -H 'Content-Type: application/json' -d '{"jsonrpc": "2.0", "id": "1", "method": "ps"}' |