[SR-Users] Looking for network version of ds_reload
Alex Balashov
abalashov at evaristesys.com
Sat Aug 27 00:42:25 CEST 2016
Hello Chad,
My suggestion would be to use the 'jsonrpc-s' module:
http://kamailio.org/docs/modules/4.4.x/modules/jsonrpc-s.html
This runs over the 'xhttp' module, and requires enabling the TCP
transport. However, the end result is that with very little config
script, it will allow you to run next-generation RPC commands, including
the equivalent of 'ds_reload', 'dispatcher.reload':
http://kamailio.org/docs/modules/4.4.x/modules/dispatcher.html#dispatcher.f.reload
You would run it using something like this:
$ curl -v -H 'Content-Type: application/json' \
-H 'Call-ID: abc12' \
-d '{"jsonrpc": "2.0", "method": "dispatcher.reload", "id": "0deadb33f"}' \
http://your.kamailio.server:5060/rpc_path/
The basic boilerplate is as simple as:
----
listen=tcp:0.0.0.0:5060
loadmodule "xhttp"
loadmodule "jsonrpc-s"
modparam("xhttp", "url_match", "^/rpc_path/")
modparam("jsonrpc-s", "pretty_format", 1)
event_route[xhttp:request] {
if($hu =~ "^/rpc_path")
jsonrpc_dispatch();
else
xhttp_reply("404", "Not Found", "text/html", "");
}
----
Of course, in the real world, you'll want to consider authentication, IP
ACLs, and other things that go into some sort of security thought
process. But that's the basic idea.
-- Alex
--
Alex Balashov | Principal | Evariste Systems LLC
Tel: +1-706-510-6800 (direct) / +1-800-250-5920 (toll-free)
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
More information about the sr-users
mailing list