diff --git a/jsonrpc_remoteprocesscalls/README.md b/jsonrpc_remoteprocesscalls/README.md new file mode 100644 index 0000000..a0cb816 --- /dev/null +++ b/jsonrpc_remoteprocesscalls/README.md @@ -0,0 +1,52 @@ +# jsonrpcs for Remote process calls using kamctl in kamailio + +## UL commands + +### get online users +once regsieterd the users can also be diapled using kamctl coamands +``` +> kamctl online +altanai +bisht +``` + +## dialog commands +get call state using kamcmd dlg.list command +``` +>kamcmd dlg.list +{ + h_entry: 486 + h_id: 8019 + call-id: 97576YmZlZDUzZTBiZWViOGFhMjNlMTExZGYyM2I3N2Y3MWU + from_uri: sip:kate@ip_addr + to_uri: sip:altanai@ip_addr + state: 5 + start_ts: 1563268239 + init_ts: 1563268227 + timeout: 0 + lifetime: 43200 + dflags: 516 + sflags: 0 + iflags: 0 + caller: { + tag: 838e7651 + contact: sip:kate@ua_addr:25797;rinstance=4343a1eb7a321c75;alias=ua_addr~25797~1 + cseq: 1 + route_set: + socket: udp:10.130.74.151:5060 + } + callee: { + tag: 42aeae5e + contact: sip:altanai@ua_addr:35570;alias=ua_addr~35570~1 + cseq: 0 + route_set: + socket: udp:10.130.74.151:5060 + } + profiles: { + } + variables: { + } +} +``` + +Ref : https://kamailio.org/docs/modules/5.1.x/modules/jsonrpcs.html \ No newline at end of file diff --git a/jsonrpc_remoteprocesscalls/jsonrpc_kamailio.cfg b/jsonrpc_remoteprocesscalls/jsonrpc_kamailio.cfg new file mode 100644 index 0000000..57956b1 --- /dev/null +++ b/jsonrpc_remoteprocesscalls/jsonrpc_kamailio.cfg @@ -0,0 +1,39 @@ +#!KAMAILIO + +memdbg=5 +memlog=5 + +debug=3 +log_stderror=yes + +fork=yes +children=2 + +tcp_accept_no_cl=yes + +loadmodule "sl.so" +loadmodule "pv.so" +loadmodule "xhttp.so" +loadmodule "jsonrpcs.so" + +modparam("jsonrpcs", "transport", 1) + +request_route { + send_reply("404", "not found"); + exit; +} + +event_route[xhttp:request] { + if(src_ip!=127.0.0.1) { + xhttp_reply("403", "Forbidden", "text/html", + "Not allowed from $si"); + exit; + } + if ($hu =~ "^/RPC") { + jsonrpc_dispatch(); + } else { + xhttp_reply("200", "OK", "text/html", + "Wrong URL $hu"); + } + return; +} \ No newline at end of file