From cdd703dcae172ad0692877addaa9fea80c06defc Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Fri, 11 Nov 2016 14:32:31 +0100 Subject: [PATCH] jsonrpc-s: added section to show examples with rpc commands over jsonrpc --- modules/jsonrpc-s/doc/jsonrpc-s_admin.xml | 60 ++++++++++++++++++++--- 1 file changed, 54 insertions(+), 6 deletions(-) diff --git a/modules/jsonrpc-s/doc/jsonrpc-s_admin.xml b/modules/jsonrpc-s/doc/jsonrpc-s_admin.xml index 4684f521853..a2ce518eedd 100644 --- a/modules/jsonrpc-s/doc/jsonrpc-s_admin.xml +++ b/modules/jsonrpc-s/doc/jsonrpc-s_admin.xml @@ -10,9 +10,9 @@ - + &adminguide; - +
Overview @@ -85,7 +85,7 @@
<varname>pretty_format</varname> (int) - Pretty format for JSON-RPC response document. + Pretty format for JSON-RPC response document. @@ -137,7 +137,7 @@ modparam("jsonrpc-s", "transport", 1)
<varname>fifo_name</varname> (str) - The name of the FIFO file to be created for listening and + The name of the FIFO file to be created for listening and reading external commands. If the given path is not absolute, the fifo file is created relative to run_dir (global parameter). @@ -159,7 +159,7 @@ modparam("jsonrpc-s", "fifo_name", "/tmp/kamailio_jsonrpc_fifo")
<varname>fifo_mode</varname> (int) - Permission to be used for creating the listening FIFO file. It + Permission to be used for creating the listening FIFO file. It follows the UNIX conventions. @@ -321,13 +321,61 @@ jsonrpc_exec({"jsonrpc": "2.0", "method": "dispatcher.reload", "id": 1}');
+
+ JSONRPC Commands + + Here are some examples of RPC commands with the equivalent of running them + with &kamcmd; and the corresponding JSON document for them. It is important + to be aware that the name of the parameters doesn't matter, only the order + of the values must be the one expected by &kamailio; RPC command. + + + JSONRPC Commands - Examples + +... +# kamcmd core.psx + +{ + "jsonrpc": "2.0", + "method": "core.psx", + "id": 1 +} +... +## - prototype: kamcmd dispatcher.set_state _state_ _group_ _address_ +# kamcmd dispatcher.set_state ip 2 sip:127.0.0.1:5080 + +{ + "jsonrpc": "2.0", + "method": "dispatcher.set_state", + "params": ["ip", 2, "sip:127.0.0.1:5080"], + "id": 1 +} + +## - or: + +{ + "jsonrpc": "2.0", + "method": "dispatcher.set_state", + "params": { + "state": "ip", + "grpup": 2, + "address": "sip:127.0.0.1:5080" + }, + "id": 1 +} +... + + + +
+
JSONRPC Transports JSONRPC specifications do not enforce a specific transport to carry the JSON documents. Very common is JSONRPC over HTTP or HTTPS, and they are supported by &kamailio;. In addition, &kamailio; supports receiving JSON - documents via a local FIFO file. + documents via a local FIFO file.
JSONRPC Over HTTP