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, Aleksandar Sosic wrote: > 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/html", "Dispatchers Set for RELOAD"); > exit; > } > ... > } > ``` > > And then in the DISPATCHER_LIST route we do an API call for fetching > the updated dispatcher list for that node. > After the dispatcher list is updated we just run: > jsonrpc_exec('{"jsonrpc": "2.0", "method": "dispatcher.reload", "id": "1"}'); > > So you can just put a `jsonrpc_exec` inside the event_route[xhttp:request]. > > Kind regards, > -- > Aleksandar Sosic > mail: alex.so...@timenet.it > skype: alex.sosic > cell: +385 91 2505 146 > > > On Fri, Mar 2, 2018 at 10:16 AM, Ben Hood <0x6e6...@gmail.com> wrote: >> 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 >> <mico...@gmail.com> wrote: >>> 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. >> _______________________________________________ >> Kamailio (SER) - Users Mailing List >> sr-users@lists.kamailio.org >> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users -- Daniel-Constantin Mierla www.twitter.com/miconda -- www.linkedin.com/in/miconda Kamailio Advanced Training - March 5-7, 2018, Berlin - www.asipto.com Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users