ソースを参照

misc/examples/kemi: filter on user agent matching friendly, scanner and sipvicious

Daniel-Constantin Mierla 4 年 前
コミット
e15c90d31f

+ 2 - 1
misc/examples/kemi/kamailio-basic-kemi-jsdt.js

@@ -133,7 +133,8 @@ function ksr_route_reqinit()
 	}
 	if (KSR.corex.has_user_agent()>0) {
 		var UA = KSR.pv.gete("$ua");
-		if (UA.indexOf("friendly-scanner")>=0 || UA.indexOf("sipcli")>=0) {
+		if (UA.indexOf("friendly")>=0 || UA.indexOf("scanner")>=0
+				|| UA.indexOf("sipcli")>=0 || UA.indexOf("sipvicious")>=0) {
 			KSR.sl.sl_send_reply(200, "OK");
 			KSR.x.exit();
 		}

+ 2 - 2
misc/examples/kemi/kamailio-basic-kemi-lua.lua

@@ -176,8 +176,8 @@ function ksr_route_reqinit()
 		end
 	end
 	local ua = KSR.kx.gete_ua();
-	if string.find(ua, "friendly-scanner")
-				or string.find(ua, "sipcli") then
+	if string.find(ua, "friendly") or string.find(ua, "scanner")
+			or string.find(ua, "sipcli") or string.find(ua, "sipvicious") then
 		KSR.sl.sl_send_reply(200, "OK");
 		KSR.x.exit();
 	end

+ 2 - 2
misc/examples/kemi/kamailio-basic-kemi-python.py

@@ -157,8 +157,8 @@ class kamailio:
 
         if KSR.corex.has_user_agent() > 0 :
             ua = KSR.pv.gete("$ua")
-            if (ua.find("friendly-scanner")!=-1
-                    or ua.find("sipcli")!=-1) :
+            if (ua.find("friendly")!=-1 or ua.find("scanner")!=-1
+                    or ua.find("sipcli")!=-1 or ua.find("sipvicious")!=-1) :
                 KSR.sl.sl_send_reply(200, "Processed")
                 return -255
 

+ 3 - 2
misc/examples/kemi/kamailio-basic-kemi-ruby.rb

@@ -41,7 +41,7 @@ def ksr_request_route()
 
   # Auth
   ksr_route_auth()
-  
+
   # Record routing for dialog forming requests (in case they are routed)
   KSR::HDR.remove("Route")
   if KSR.is_method_in("IS") then
@@ -65,7 +65,8 @@ end
 def ksr_route_reqinit()
   if KSR::COREX.has_user_agent() > 0 then
     ua = KSR::PV.gete("$ua");
-    if ua.include? 'friendly-scanner' or ua.include? 'sipcli' then
+    if ua.include? 'friendly' or ua.include? 'scanner'
+        or ua.include? 'sipcli' or ua.include? 'sipvicious' then
       KSR::SL.sl_send_reply(200, "OK");
       exit
     end

+ 2 - 1
misc/examples/kemi/kamailio-basic-kemi-sqlang.sq

@@ -137,7 +137,8 @@ function ksr_route_reqinit()
 	if (KSR.corex.has_user_agent()>0) {
 		local UA = KSR.pv.get("$ua");
 		// if (sipscanregex.match(UA)) {
-		if (UA.find("friendly-scanner")!=null || UA.find("sipcli")!=null) {
+		if (UA.find("friendly")!=null || UA.find("scanner")!=null
+				|| UA.find("sipcli")!=null || UA.find("sipvicious")!=null) {
 			KSR.sl.sl_send_reply(200, "OK");
 			KSR.x.exit();
 		}