[sr-dev] git:master: kamailio.cfg: added sample usage of xmlrpc module
Daniel-Constantin Mierla
miconda at gmail.com
Mon Oct 4 16:09:07 CEST 2010
Module: sip-router
Branch: master
Commit: 0b5ccf31a6e3e6e1091a97e472539ba314428e04
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0b5ccf31a6e3e6e1091a97e472539ba314428e04
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: Mon Oct 4 16:08:16 2010 +0200
kamailio.cfg: added sample usage of xmlrpc module
- enabled with #!define WITH_XMLRPC
- based on ser.cfg version
---
etc/kamailio.cfg | 34 ++++++++++++++++++++++++++++++++++
1 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/etc/kamailio.cfg b/etc/kamailio.cfg
index 08183ff..9aa3915 100644
--- a/etc/kamailio.cfg
+++ b/etc/kamailio.cfg
@@ -59,6 +59,10 @@
# - adjust CFGDIR/tls.cfg as needed
# - define WITH_TLS
#
+# *** To enable XMLRPC support execute:
+# - define WITH_XMLRPC
+# - adjust route[XMLRPC] for access policy
+#
# *** To enable anti-flood detection execute:
# - adjust pike and htable=>ipban settings as needed (default is
# block if more than 16 requests in 2 seconds and ban for 300 seconds)
@@ -233,6 +237,10 @@ loadmodule "htable.so"
loadmodule "pike.so"
#!endif
+#!ifdef WITH_XMLRPC
+loadmodule "xmlrpc.so"
+#!endif
+
# ----------------- setting module-specific parameters ---------------
@@ -374,6 +382,12 @@ modparam("pike", "remove_latency", 4)
modparam("htable", "htable", "ipban=>size=8;autoexpire=300;")
#!endif
+#!ifdef WITH_XMLRPC
+# ----- xmlrpc params -----
+modparam("xmlrpc", "route", "XMLRPC");
+modparam("xmlrpc", "url_match", "^/RPC")
+#!endif
+
####### Routing Logic ########
@@ -749,6 +763,26 @@ route[PSTN] {
return;
}
+# XMLRPC routing
+#!ifdef WITH_XMLRPC
+route[XMLRPC]
+{
+ # allow XMLRPC from localhost
+ if ((method=="POST" || method=="GET")
+ && (src_ip==127.0.0.1)) {
+ # close connection only for xmlrpclib user agents (there is a bug in
+ # xmlrpclib: it waits for EOF before interpreting the response).
+ if ($hdr(User-Agent) =~ "xmlrpclib")
+ set_reply_close();
+ set_reply_no_connect();
+ dispatch_rpc();
+ exit;
+ }
+ send_reply("403", "Forbidden");
+ exit;
+}
+#!endif
+
# Sample branch router
branch_route[BRANCH_ONE] {
xdbg("new branch at $ru\n");
More information about the sr-dev
mailing list