Hey Alex, this worked well for me.
As far as the security portion goes, I just exposed the tcp on a separate port that is only accessible to linked containers. I feel like that should be sufficient.
Thank you for the direction!
-- Chad McElligott Digium, Inc. | Senior Software Developer 445 Jan Davis Drive NW - Huntsville, AL 35806 - US direct: +1-256-434-5151 / cmcelligott@digium.com
On Fri, Aug 26, 2016 at 6:05 PM, Chad McElligott cmcelligott@digium.com wrote:
Great, thanks Alex. I will give that a shot and see how it goes.
On Aug 26, 2016 5:42 PM, "Alex Balashov" abalashov@evaristesys.com wrote:
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.ht ml#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/
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users