Re: [SR-Users] Invoking RPC commands over HTTP

2018-03-05 Thread Ben Hood
Hi Aleksandar, That's quite a cool set of technologies that you've integrated together :-) Many thanks for taking the time to explain this so clearly, very much appreciated. I like the fact that you've connected a GraphQL query (which I've only really seen being used in React) to populate a tmp

Re: [SR-Users] Invoking RPC commands over HTTP

2018-03-02 Thread Aleksandar Sosic
Hi Ben, we are working on a dockerized infrastructure orchestrated with Kubernetes with two kamailio layers, a `proxy` and a `router` level. In a stateless infrastructure like that we need to have also a SIP orchestrator that will handle all the active and ready nodes and notify or provide the cor

Re: [SR-Users] Invoking RPC commands over HTTP

2018-03-02 Thread Ben Hood
On Fri, Mar 2, 2018 at 11:06 AM, Daniel-Constantin Mierla wrote: > use jsonrcp_dispatch() when you want the rpc command response to be sent > back via incoming transport (http in this case). > > jsonrpc_exec() should be used when you want to do it from normal SIP > routing blocks and get the jsonr

Re: [SR-Users] Invoking RPC commands over HTTP

2018-03-02 Thread Ben Hood
Hey Aleksandar, Many thanks for the heads up - very interesting to see how other people are doing this. So if I understand you correctly, you have a dynamic list of dispatchers. And then you invoke "dispatcher.reload" to reload all of the dispatchers you have defined dynamically? What does the

Re: [SR-Users] Invoking RPC commands over HTTP

2018-03-02 Thread Daniel-Constantin Mierla
Hello, use jsonrcp_dispatch() when you want the rpc command response to be sent back via incoming transport (http in this case). jsonrpc_exec() should be used when you want to do it from normal SIP routing blocks and get the jsonrpc response in a local variable. Cheers, Daniel On 02.03.18 10:29

Re: [SR-Users] Invoking RPC commands over HTTP

2018-03-02 Thread Aleksandar Sosic
Hi Ben, we're using something like this to do dispatcher.reload: ``` event_route[xhttp:request] { if ($hu =~ "^/rpc") { $var(command) = $(hu{s.select,2,/}); $var(parameter) = $(hu{s.select,3,/}); if($var(command) == "reload.dispatchers") { route(DISPATCHER_LIST); xhttp_reply("200", "OK", "text/h

Re: [SR-Users] Invoking RPC commands over HTTP

2018-03-02 Thread Ben Hood
Cool, many thanks for the heads up. So jsonrpc_dispatch() in the request handler binds to the method parameter in the JSON blob sent by the client to the corresponding internal management function? On Fri, Mar 2, 2018 at 9:12 AM, Daniel-Constantin Mierla wrote: > you can do jsonrpc over http/s

Re: [SR-Users] Invoking RPC commands over HTTP

2018-03-02 Thread Daniel-Constantin Mierla
Hello, you can do jsonrpc over http/s by using jsonrpcs+xhttp modules -- example at:   - https://www.kamailio.org/docs/modules/stable/modules/jsonrpcs.html#jsonrpcs.f.jsonrpc_dispatch There is also an xmlrpc module that works over http/s. Cheers, Daniel On 02.03.18 09:57, Ben Hood wrote: > Hi,

[SR-Users] Invoking RPC commands over HTTP

2018-03-02 Thread Ben Hood
Hi, What is the idiomatic way to call an RPC from a remote HTTP client in the 5.1.x series? I'd like to invoke mtree.reload from a remote HTTP client. My goal is to avoid a dependency on kamcmd on the remote client system - it would be nice to be able to issue a HTTP RPC which could be implement