Browse code

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

Ovidiu Sas authored on 01/12/2012 05:12:34
Showing 2 changed files
... ...
@@ -1000,6 +1000,14 @@ install-cfg: $(cfg_prefix)/$(cfg_dir)
1000 1000
 				fi ; \
1001 1001
 			fi ; \
1002 1002
 		done; true
1003
+		# provisionning xml framework
1004
+		$(INSTALL_TOUCH) $(cfg_prefix)/$(cfg_dir)/pi_framework.xml.sample
1005
+		$(INSTALL_CFG) examples/pi_framework.xml \
1006
+			$(cfg_prefix)/$(cfg_dir)/pi_framework.xml.sample
1007
+		if [ ! -f $(cfg_prefix)/$(cfg_dir)/pi_framework.xml ]; then \
1008
+			mv -f $(cfg_prefix)/$(cfg_dir)/pi_framework.xml.sample \
1009
+				$(cfg_prefix)/$(cfg_dir)/pi_framework.xml; \
1010
+		fi
1003 1011
 		# radius dictionary
1004 1012
 		$(INSTALL_TOUCH) $(cfg_prefix)/$(cfg_dir)/dictionary.$(CFG_NAME)
1005 1013
 		$(INSTALL_CFG) etc/dictionary.$(CFG_NAME) $(cfg_prefix)/$(cfg_dir)
... ...
@@ -67,6 +67,18 @@
67 67
 #     - define WITH_XMLRPC
68 68
 #     - adjust route[XMLRPC] for access policy
69 69
 #
70
+# *** To enable the embedded http server:
71
+#     - define WITH_XHTTP
72
+#
73
+# *** To enable the RPC web interface execute:
74
+#     - enable xhttp
75
+#     - define WITH_XHTTP_RPC
76
+#
77
+# *** To enable the provisioning web interface execute:
78
+#     - enable mysql
79
+#     - enable xhttp
80
+#     - define WITH_XHTTP_PI
81
+#
70 82
 # *** To enable anti-flood detection execute:
71 83
 #     - adjust pike and htable=>ipban settings as needed (default is
72 84
 #       block if more than 16 requests in 2 seconds and ban for 300 seconds)
... ...
@@ -174,6 +186,10 @@ enable_tls=yes
174 174
 # - a bit higher than registration expires to cope with UA behind NAT
175 175
 tcp_connection_lifetime=3605
176 176
 
177
+#!ifdef WITH_XHTTP
178
+tcp_accept_no_cl=yes
179
+#!endif
180
+
177 181
 ####### Custom Parameters #########
178 182
 
179 183
 # These parameters can be modified runtime via RPC interface
... ...
@@ -282,6 +298,18 @@ loadmodule "xmlrpc.so"
282 282
 loadmodule "debugger.so"
283 283
 #!endif
284 284
 
285
+#!ifdef WITH_XHTTP
286
+loadmodule "xhttp.so"
287
+#!endif
288
+
289
+#!ifdef WITH_XHTTP_RPC
290
+loadmodule "xhttp_rpc.so"
291
+#!endif
292
+
293
+#!ifdef WITH_XHTTP_PI
294
+loadmodule "xhttp_pi.so"
295
+#!endif
296
+
285 297
 # ----------------- setting module-specific parameters ---------------
286 298
 
287 299
 
... ...
@@ -445,6 +473,15 @@ modparam("xmlrpc", "url_match", "^/RPC")
445 445
 modparam("debugger", "cfgtrace", 1)
446 446
 #!endif
447 447
 
448
+#!ifdef WITH_XHTTP_RPC
449
+modparam("xhttp_rpc", "xhttp_rpc_root", "http_rpc")
450
+#!endif
451
+
452
+#!ifdef WITH_XHTTP_PI
453
+modparam("xhttp_pi", "xhttp_pi_root", "http_pi")
454
+modparam("xhttp_pi", "framework", "/usr/local/etc/kamailio/pi_framework.xml")
455
+#!endif
456
+
448 457
 ####### Routing Logic ########
449 458
 
450 459
 
... ...
@@ -921,3 +958,23 @@ failure_route[MANAGE_FAILURE] {
921 921
 	}
922 922
 #!endif
923 923
 }
924
+
925
+#!ifdef WITH_XHTTP
926
+event_route[xhttp:request] {
927
+#!ifdef WITH_XHTTP_RPC
928
+	$var(xhttp_rpc_root) = $(hu{s.substr,0,9});
929
+	if ($var(xhttp_rpc_root) == "/http_rpc") {
930
+		dispatch_xhttp_rpc();
931
+	}
932
+#!endif
933
+#!ifdef WITH_XHTTP_PI
934
+	$var(xhttp_rpc_root) = $(hu{s.substr,0,8});
935
+	if ($var(xhttp_rpc_root) == "/http_pi") {
936
+		dispatch_xhttp_pi();
937
+	}
938
+#!endif
939
+	xhttp_reply("200", "OK", "text/html",
940
+		"<html><body>Wrong URL $hu</body></html>");
941
+}
942
+#!endif
943
+