Skip to content

Commit

Permalink
Fix bad modparam names and doc examples caused by mi modules rename
Browse files Browse the repository at this point in the history
(cherry picked from commit 4af34c0)
  • Loading branch information
rvlad-patrascu committed Apr 17, 2019
1 parent 9d90c75 commit 4128ca8
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 61 deletions.
32 changes: 16 additions & 16 deletions modules/mi_html/doc/mi_html_admin.xml
Expand Up @@ -7,8 +7,8 @@
<section id="overview" xreflabel="Overview">
<title>Overview</title>
<para>
This module provides an HTTP transport layer implementation
for &osips;'s Management Interface.
This module provides a minimal web user interface for the &osips;'s
Management Interface.
</para>
</section>

Expand Down Expand Up @@ -43,28 +43,28 @@

<section id="exported_parameters" xreflabel="Exported Parameters">
<title>Exported Parameters</title>
<section id="param_mi_http_root" xreflabel="mi_http_root">
<title><varname>mi_http_root</varname>(string)</title>
<section id="param_root" xreflabel="root">
<title><varname>root</varname>(string)</title>
<para>
Specifies the root path for mi http requests.
Specifies the root path for the HTTP requests.
The link to the mi web interface must be constructed
using the following patern:
http://[opensips_IP]:[opensips_mi_port]/[mi_http_root]
http://[opensips_IP]:[opensips_mi_port]/[root]
</para>
<para>
<emphasis>The default value is "mi".</emphasis>
</para>
<example>
<title>Set <varname>mi_http_root</varname> parameter</title>
<title>Set <varname>root</varname> parameter</title>
<programlisting format="linespecific">
...
modparam("mi_http", "mi_http_root", "opensips_mi")
modparam("mi_html", "root", "opensips_mi")
...
</programlisting>
</example>
</section>
<section id="param_mi_http_method" xreflabel="mi_http_method">
<title><varname>mi_http_method</varname>(integer)</title>
<section id="param_http_method" xreflabel="http_method">
<title><varname>http_method</varname>(integer)</title>
<para>
Specifies the HTTP request method to be used:
<itemizedlist>
Expand All @@ -76,10 +76,10 @@ modparam("mi_http", "mi_http_root", "opensips_mi")
<emphasis>The default value is 0.</emphasis>
</para>
<example>
<title>Set <varname>mi_http_method</varname> parameter</title>
<title>Set <varname>http_method</varname> parameter</title>
<programlisting format="linespecific">
...
modparam("mi_http", "mi_http_method", 1)
modparam("mi_html", "http_method", 1)
...
</programlisting>
</example>
Expand Down Expand Up @@ -108,7 +108,7 @@ modparam("mi_http", "mi_http_method", 1)
...
modparam("proto_hep", "trace_destination", "[hep_dest]10.0.0.2;transport=tcp;version=3")

modparam("mi_http", "trace_destination", "hep_dest")
modparam("mi_html", "trace_destination", "hep_dest")
...
</programlisting>
</example>
Expand Down Expand Up @@ -148,11 +148,11 @@ modparam("mi_http", "trace_destination", "hep_dest")
...
## blacklist ps and which mi commands
## all the other commands shall be traced
modparam("mi_http", "trace_bwlist", "b: ps, which")
modparam("mi_html", "trace_bwlist", "b: ps, which")
...
## allow only sip_trace mi command
## all the other commands will not be traced
modparam("mi_http", "trace_bwlist", "w: sip_trace")
modparam("mi_html", "trace_bwlist", "w: sip_trace")
...
</programlisting>
</example>
Expand All @@ -177,7 +177,7 @@ modparam("mi_http", "trace_bwlist", "w: sip_trace")
enough pkg memory configured).
</para>
<para>
Future realeases of the httpd and mi_httpd modules will address this issue.
Future realeases of the httpd module will address this issue.
</para>
</section>

Expand Down
4 changes: 2 additions & 2 deletions modules/mi_html/mi_html.c
Expand Up @@ -71,8 +71,8 @@ static str MI_HTTP_U_METHOD_REASON = str_init("500 Unexpected method! Only GET i

/* module parameters */
static param_export_t mi_params[] = {
{"mi_http_root", STR_PARAM, &http_root.s},
{"mi_http_method", INT_PARAM, &http_method},
{"root", STR_PARAM, &http_root.s},
{"http_method", INT_PARAM, &http_method},
{"trace_destination", STR_PARAM, &trace_destination_name.s},
{"trace_bwlist", STR_PARAM, &mi_trace_bwlist_s },
{0,0,0}
Expand Down
62 changes: 21 additions & 41 deletions modules/mi_http/doc/mi_http_admin.xml
Expand Up @@ -7,8 +7,8 @@
<section id="overview" xreflabel="Overview">
<title>Overview</title>
<para>
This module implements a JSON server that handles GET
requests and generates JSON responses.
This module provides a HTTP transport layer implementation
for &osips;'s Management Interface.
</para>
</section>

Expand All @@ -34,20 +34,20 @@

<section id="exported_parameters" xreflabel="Exported Parameters">
<title>Exported Parameters</title>
<section id="param_mi_json_root" xreflabel="mi_json_root">
<title><varname>mi_json_root</varname>(string)</title>
<section id="param_root" xreflabel="root">
<title><varname>root</varname>(string)</title>
<para>
Specifies the root path for JSON requests:
http://[opensips_IP]:[opensips_httpd_port]/[mi_json_root]
Specifies the root path for HTTP requests:
http://[opensips_IP]:[opensips_httpd_port]/[root]
</para>
<para>
<emphasis>The default value is "json".</emphasis>
<emphasis>The default value is "mi".</emphasis>
</para>
<example>
<title>Set <varname>mi_json_root</varname> parameter</title>
<title>Set <varname>root</varname> parameter</title>
<programlisting format="linespecific">
...
modparam("mi_json", "mi_json_root", "opensips_mi_json")
modparam("mi_http", "root", "opensips_mi")
...
</programlisting>
</example>
Expand Down Expand Up @@ -76,7 +76,7 @@ modparam("mi_json", "mi_json_root", "opensips_mi_json")
...
modparam("proto_hep", "trace_destination", "[hep_dest]10.0.0.2;transport=tcp;version=3")

modparam("mi_json", "trace_destination", "hep_dest")
modparam("mi_http", "trace_destination", "hep_dest")
...
</programlisting>
</example>
Expand Down Expand Up @@ -116,11 +116,11 @@ modparam("mi_json", "trace_destination", "hep_dest")
...
## blacklist ps and which mi commands
## all the other commands shall be traced
modparam("mi_json", "trace_bwlist", "b: ps, which")
modparam("mi_http", "trace_bwlist", "b: ps, which")
...
## allow only sip_trace mi command
## all the other commands will not be traced
modparam("mi_json", "trace_bwlist", "w: sip_trace")
modparam("mi_http", "trace_bwlist", "w: sip_trace")
...
</programlisting>
</example>
Expand All @@ -145,53 +145,33 @@ modparam("mi_json", "trace_bwlist", "w: sip_trace")
isn't enough pkg memory configured).
</para>
<para>
Future realeases of the httpd and mi_json modules
will address this issue.
Future realeases of the httpd module will address this issue.
</para>
</section>

<section>
<title>Examples</title>
<para>
This is an example showing the JSON format for the
<quote>get_statistics net: uri:</quote> MI command.
Notice how the parameters are comma-separated then URI-encoded.
This is an example showing the JSON-RPC request and reply over HTTP
for the <quote>ps</quote> MI command.
</para>
<example>
<title>JSON request</title>
<title>JSON-RPC request</title>
<programlisting format="linespecific">
<![CDATA[
GET /json/get_statistics?params=net%3A%2Curi%3A HTTP/1.1
POST /mi HTTP/1.1
Accept: application/json
Host: example.net
HTTP/1.1 200 OK
Content-Length: 49
Content-Type: application/json
Date: Fri, 01 Nov 2013 12:00:00 GMT
["net:waiting_udp = 0", "net:waiting_tcp = 0", "uri:positive checks = 0", "uri:negative_checks = 0"]
]]>
</programlisting>
</example>
<para>
Here is another example showing the JSON format for the
<quote>ps</quote> MI command.
</para>
<example>
<title>JSON request</title>
<programlisting format="linespecific">
<![CDATA[
GET /json/ps HTTP/1.1
Accept: application/json
Host: example.net
{"jsonrpc":"2.0","method":"ps","id":10}
HTTP/1.1 200 OK
Content-Length: 428
Content-Length: 317
Content-Type: application/json
Date: Fri, 01 Nov 2013 12:00:00 GMT
[{"name":"Process", "value":null, "attributes":{"ID": "0", "PID": "7400", "Type": "stand-alone SIP receiver udp:127.0.0.1:5060"}}, {"name":"Process", "value":null, "attributes":{"ID": "1", "PID": "7402", "Type": "HTTPD INADDR_ANY:8888"}}, {"name":"Process", "value":null, "attributes":{"ID": "2", "PID": "7403", "Type": "time_keeper"}}, {"name":"Process", "value":null, "attributes":{"ID": "3", "PID": "7404", "Type": "timer"}}]
{"jsonrpc":"2.0","result":{"Processes":[{"ID":0,"PID":9467,"Type":"attendant"},{"ID":1,"PID":9468,"Type":"HTTPD127.0.0.1:8008"},{"ID":3,"PID":9470,"Type":"time_keeper"},{"ID":4,"PID":9471,"Type":"timer"},{"ID":5,"PID":9472,"Type":"SIPreceiverudp:127.0.0.1:5060"},{"ID":7,"PID":9483,"Type":"Timerhandler"},]},"id":10}
]]>
</programlisting>
</example>
Expand Down
4 changes: 2 additions & 2 deletions modules/mi_http/mi_http.c
Expand Up @@ -44,7 +44,7 @@ int mi_json_answer_to_connection (void *cls, void *connection,
static ssize_t mi_json_flush_data(void *cls, uint64_t pos, char *buf,
size_t max);

str http_root = str_init("json");
str http_root = str_init("mi");
httpd_api_t httpd_api;

static str trace_destination_name = {NULL, 0};
Expand All @@ -70,7 +70,7 @@ static union sockaddr_union* sv_socket = NULL;

/* module parameters */
static param_export_t mi_params[] = {
{"mi_json_root", STR_PARAM, &http_root.s},
{"root", STR_PARAM, &http_root.s},
{"trace_destination", STR_PARAM, &trace_destination_name.s},
{"trace_bwlist", STR_PARAM, &mi_trace_bwlist_s },
{"pretty_printing", INT_PARAM, &pretty_print},
Expand Down

0 comments on commit 4128ca8

Please sign in to comment.