Skip to content

Commit

Permalink
json rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
altanai committed Aug 2, 2019
1 parent 501f90b commit 31d4b92
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 0 deletions.
52 changes: 52 additions & 0 deletions jsonrpc_remoteprocesscalls/README.md
Original file line number Diff line number Diff line change
@@ -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
39 changes: 39 additions & 0 deletions jsonrpc_remoteprocesscalls/jsonrpc_kamailio.cfg
Original file line number Diff line number Diff line change
@@ -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",
"<html><body>Not allowed from $si</body></html>");
exit;
}
if ($hu =~ "^/RPC") {
jsonrpc_dispatch();
} else {
xhttp_reply("200", "OK", "text/html",
"<html><body>Wrong URL $hu</body></html>");
}
return;
}

0 comments on commit 31d4b92

Please sign in to comment.