Browse code

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

Daniel-Constantin Mierla authored on 23/11/2020 09:09:33
Showing 5 changed files
... ...
@@ -133,7 +133,8 @@ function ksr_route_reqinit()
133 133
 	}
134 134
 	if (KSR.corex.has_user_agent()>0) {
135 135
 		var UA = KSR.pv.gete("$ua");
136
-		if (UA.indexOf("friendly-scanner")>=0 || UA.indexOf("sipcli")>=0) {
136
+		if (UA.indexOf("friendly")>=0 || UA.indexOf("scanner")>=0
137
+				|| UA.indexOf("sipcli")>=0 || UA.indexOf("sipvicious")>=0) {
137 138
 			KSR.sl.sl_send_reply(200, "OK");
138 139
 			KSR.x.exit();
139 140
 		}
... ...
@@ -176,8 +176,8 @@ function ksr_route_reqinit()
176 176
 		end
177 177
 	end
178 178
 	local ua = KSR.kx.gete_ua();
179
-	if string.find(ua, "friendly-scanner")
180
-				or string.find(ua, "sipcli") then
179
+	if string.find(ua, "friendly") or string.find(ua, "scanner")
180
+			or string.find(ua, "sipcli") or string.find(ua, "sipvicious") then
181 181
 		KSR.sl.sl_send_reply(200, "OK");
182 182
 		KSR.x.exit();
183 183
 	end
... ...
@@ -157,8 +157,8 @@ class kamailio:
157 157
 
158 158
         if KSR.corex.has_user_agent() > 0 :
159 159
             ua = KSR.pv.gete("$ua")
160
-            if (ua.find("friendly-scanner")!=-1
161
-                    or ua.find("sipcli")!=-1) :
160
+            if (ua.find("friendly")!=-1 or ua.find("scanner")!=-1
161
+                    or ua.find("sipcli")!=-1 or ua.find("sipvicious")!=-1) :
162 162
                 KSR.sl.sl_send_reply(200, "Processed")
163 163
                 return -255
164 164
 
... ...
@@ -41,7 +41,7 @@ def ksr_request_route()
41 41
 
42 42
   # Auth
43 43
   ksr_route_auth()
44
-  
44
+
45 45
   # Record routing for dialog forming requests (in case they are routed)
46 46
   KSR::HDR.remove("Route")
47 47
   if KSR.is_method_in("IS") then
... ...
@@ -65,7 +65,8 @@ end
65 65
 def ksr_route_reqinit()
66 66
   if KSR::COREX.has_user_agent() > 0 then
67 67
     ua = KSR::PV.gete("$ua");
68
-    if ua.include? 'friendly-scanner' or ua.include? 'sipcli' then
68
+    if ua.include? 'friendly' or ua.include? 'scanner'
69
+        or ua.include? 'sipcli' or ua.include? 'sipvicious' then
69 70
       KSR::SL.sl_send_reply(200, "OK");
70 71
       exit
71 72
     end
... ...
@@ -137,7 +137,8 @@ function ksr_route_reqinit()
137 137
 	if (KSR.corex.has_user_agent()>0) {
138 138
 		local UA = KSR.pv.get("$ua");
139 139
 		// if (sipscanregex.match(UA)) {
140
-		if (UA.find("friendly-scanner")!=null || UA.find("sipcli")!=null) {
140
+		if (UA.find("friendly")!=null || UA.find("scanner")!=null
141
+				|| UA.find("sipcli")!=null || UA.find("sipvicious")!=null) {
141 142
 			KSR.sl.sl_send_reply(200, "OK");
142 143
 			KSR.x.exit();
143 144
 		}