Unless you want to trigger that after receiving some kind of "SIP control packet", you would rather add something like this in your kamailio.cfg:
event_route[xhttp:request] { if ($hu =~ "^/jsonrpc") { xlog("L_NOTICE", "Got jsonrpc request, body '$rb'\n"); jsonrpc_dispatch(); } else { xhttp_reply("500", "Internal Server Error", "text/html", "<html><body>Unsupported URL $hu</body></html>"); } return; }
Then you would use curl or a script in the language of your choice and send a request to http://kamailio_ip:kamailio_tcp_listen_port/jsonrpc with the json string in the body.
Best Regards, Sebastian