forked from altanai/kamailioexamples
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |