kamailio.cfg: adding xhttp modules to the default config
authorOvidiu Sas <osas@voipembedded.com>
Sat, 1 Dec 2012 05:12:34 +0000 (00:12 -0500)
committerOvidiu Sas <osas@voipembedded.com>
Sat, 1 Dec 2012 05:12:34 +0000 (00:12 -0500)
              three new defines: WITH_XHTTP, WITH_XHTTP_RPC, WITH_XHTTP_PI

Makefile
etc/kamailio.cfg

index ee58a21..08c3245 100644 (file)
--- 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)
index aa83fad..e1d7ff1 100644 (file)
 #     - 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
+