Procházet zdrojové kódy

misc/examples/ims/pcscf: Add support for IPSec in the P-CSCF examples

Tsvetomir Dimitrov před 7 roky
rodič
revize
c4daee8635

+ 15 - 1
misc/examples/ims/pcscf/kamailio.cfg

@@ -162,6 +162,9 @@ loadmodule "statistics"
 loadmodule "ims_dialog"
 loadmodule "ims_usrloc_pcscf" 
 loadmodule "ims_registrar_pcscf"
+#!ifdef WITH_IPSEC
+loadmodule "ims_ipsec_pcscf"
+#!endif
 
 #!ifdef WITH_XMLRPC
 loadmodule "xmlrpc"
@@ -366,6 +369,12 @@ modparam("ims_registrar_pcscf", "subscribe_to_reginfo", 0)
 modparam("ims_registrar_pcscf", "publish_reginfo", 0)
 #!endif
 
+#!ifdef WITH_IPSEC
+modparam("ims_ipsec_pcscf", "ipsec_listen_addr", IPSEC_LISTEN_ADDR)
+modparam("ims_ipsec_pcscf", "ipsec_client_port", IPSEC_CLIENT_PORT)
+modparam("ims_ipsec_pcscf", "ipsec_server_port", IPSEC_SERVER_PORT)
+#!endif
+
 #!ifdef WITH_RX
 # -- CDP params --
 modparam("cdp","config_file","/etc/kamailio_pcscf/pcscf.xml")
@@ -700,7 +709,11 @@ route[REQINIT] {
 		send_reply("503", "Server shutting down");
 		exit;
 	}
-	
+
+	if (!is_method("REGISTER")) {
+        ipsec_forward("location");
+    }
+
 	# Ignore Re-Transmits:
 	if (t_lookup_request()) {
 		exit;
@@ -852,6 +865,7 @@ event_route[uac:reply] {
 			}
 			xlog("  Unregistering $uac_req(ruri);$var(alias)\n");
 			setdebug("9");
+			ipsec_destroy("location");
 			pcscf_unregister("location", "$uac_req(ruri);$var(alias)", "$(uac_req(ouri){uri.host})", "$(uac_req(ouri){uri.port})");
 			resetdebug();
 			$sht(natping=>$uac_req(ouri)) = $null;

+ 6 - 1
misc/examples/ims/pcscf/pcscf.cfg.sample

@@ -7,6 +7,11 @@ listen=udp:11.22.33.44:5060
 # SIP / TCP/TLS
 #listen=tls:11.22.33.44:5061
 
+# IPSEC / UDP
+#!define IPSEC_LISTEN_ADDR "11.22.33.44"
+#!define IPSEC_CLIENT_PORT 5062
+#!define IPSEC_SERVER_PORT 5063
+
 alias=pcscf.mnc001.mcc001.3gppnetwork.org
 
 #!define MY_WS_PORT 80
@@ -104,4 +109,4 @@ alias=pcscf.mnc001.mcc001.3gppnetwork.org
 ##!define WITH_REGINFO
 ##!define WITH_RTPPING
 ##!define WITH_WEBSOCKET
-
+##!define WITH_IPSEC