[sr-dev] git:master: kamailio.cfg: adding xhttp modules to the default config

Ovidiu Sas osas at voipembedded.com
Sat Dec 1 06:19:09 CET 2012


Module: sip-router
Branch: master
Commit: 983dd207a51be5ea2bd2a71d546280f8e4389408
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=983dd207a51be5ea2bd2a71d546280f8e4389408

Author: Ovidiu Sas <osas at voipembedded.com>
Committer: Ovidiu Sas <osas at voipembedded.com>
Date:   Sat Dec  1 00:12:34 2012 -0500

kamailio.cfg: adding xhttp modules to the default config
              three new defines: WITH_XHTTP, WITH_XHTTP_RPC, WITH_XHTTP_PI

---

 Makefile         |    8 +++++++
 etc/kamailio.cfg |   57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index ee58a21..08c3245 100644
--- a/Makefile
+++ b/Makefile
@@ -1000,6 +1000,14 @@ install-cfg: $(cfg_prefix)/$(cfg_dir)
 				fi ; \
 			fi ; \
 		done; true
+		# provisionning xml framework
+		$(INSTALL_TOUCH) $(cfg_prefix)/$(cfg_dir)/pi_framework.xml.sample
+		$(INSTALL_CFG) examples/pi_framework.xml \
+			$(cfg_prefix)/$(cfg_dir)/pi_framework.xml.sample
+		if [ ! -f $(cfg_prefix)/$(cfg_dir)/pi_framework.xml ]; then \
+			mv -f $(cfg_prefix)/$(cfg_dir)/pi_framework.xml.sample \
+				$(cfg_prefix)/$(cfg_dir)/pi_framework.xml; \
+		fi
 		# radius dictionary
 		$(INSTALL_TOUCH) $(cfg_prefix)/$(cfg_dir)/dictionary.$(CFG_NAME)
 		$(INSTALL_CFG) etc/dictionary.$(CFG_NAME) $(cfg_prefix)/$(cfg_dir)
diff --git a/etc/kamailio.cfg b/etc/kamailio.cfg
index aa83fad..e1d7ff1 100644
--- a/etc/kamailio.cfg
+++ b/etc/kamailio.cfg
@@ -67,6 +67,18 @@
 #     - define WITH_XMLRPC
 #     - adjust route[XMLRPC] for access policy
 #
+# *** To enable the embedded http server:
+#     - define WITH_XHTTP
+#
+# *** To enable the RPC web interface execute:
+#     - enable xhttp
+#     - define WITH_XHTTP_RPC
+#
+# *** To enable the provisioning web interface execute:
+#     - enable mysql
+#     - enable xhttp
+#     - define WITH_XHTTP_PI
+#
 # *** 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)
@@ -174,6 +186,10 @@ enable_tls=yes
 # - a bit higher than registration expires to cope with UA behind NAT
 tcp_connection_lifetime=3605
 
+#!ifdef WITH_XHTTP
+tcp_accept_no_cl=yes
+#!endif
+
 ####### Custom Parameters #########
 
 # These parameters can be modified runtime via RPC interface
@@ -282,6 +298,18 @@ loadmodule "xmlrpc.so"
 loadmodule "debugger.so"
 #!endif
 
+#!ifdef WITH_XHTTP
+loadmodule "xhttp.so"
+#!endif
+
+#!ifdef WITH_XHTTP_RPC
+loadmodule "xhttp_rpc.so"
+#!endif
+
+#!ifdef WITH_XHTTP_PI
+loadmodule "xhttp_pi.so"
+#!endif
+
 # ----------------- setting module-specific parameters ---------------
 
 
@@ -445,6 +473,15 @@ modparam("xmlrpc", "url_match", "^/RPC")
 modparam("debugger", "cfgtrace", 1)
 #!endif
 
+#!ifdef WITH_XHTTP_RPC
+modparam("xhttp_rpc", "xhttp_rpc_root", "http_rpc")
+#!endif
+
+#!ifdef WITH_XHTTP_PI
+modparam("xhttp_pi", "xhttp_pi_root", "http_pi")
+modparam("xhttp_pi", "framework", "/usr/local/etc/kamailio/pi_framework.xml")
+#!endif
+
 ####### Routing Logic ########
 
 
@@ -921,3 +958,23 @@ failure_route[MANAGE_FAILURE] {
 	}
 #!endif
 }
+
+#!ifdef WITH_XHTTP
+event_route[xhttp:request] {
+#!ifdef WITH_XHTTP_RPC
+	$var(xhttp_rpc_root) = $(hu{s.substr,0,9});
+	if ($var(xhttp_rpc_root) == "/http_rpc") {
+		dispatch_xhttp_rpc();
+	}
+#!endif
+#!ifdef WITH_XHTTP_PI
+	$var(xhttp_rpc_root) = $(hu{s.substr,0,8});
+	if ($var(xhttp_rpc_root) == "/http_pi") {
+		dispatch_xhttp_pi();
+	}
+#!endif
+	xhttp_reply("200", "OK", "text/html",
+		"<html><body>Wrong URL $hu</body></html>");
+}
+#!endif
+




More information about the sr-dev mailing list