Module: kamailio
Branch: master
Commit: e15c90d31fd0444f41cb862408f77399123c0191
URL:
https://github.com/kamailio/kamailio/commit/e15c90d31fd0444f41cb862408f7739…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-11-23T10:09:33+01:00
misc/examples/kemi: filter on user agent matching friendly, scanner and sipvicious
---
Modified: misc/examples/kemi/kamailio-basic-kemi-jsdt.js
Modified: misc/examples/kemi/kamailio-basic-kemi-lua.lua
Modified: misc/examples/kemi/kamailio-basic-kemi-python.py
Modified: misc/examples/kemi/kamailio-basic-kemi-ruby.rb
Modified: misc/examples/kemi/kamailio-basic-kemi-sqlang.sq
---
Diff:
https://github.com/kamailio/kamailio/commit/e15c90d31fd0444f41cb862408f7739…
Patch:
https://github.com/kamailio/kamailio/commit/e15c90d31fd0444f41cb862408f7739…
---
diff --git a/misc/examples/kemi/kamailio-basic-kemi-jsdt.js
b/misc/examples/kemi/kamailio-basic-kemi-jsdt.js
index 7cc880f290..ab3799fdc9 100644
--- a/misc/examples/kemi/kamailio-basic-kemi-jsdt.js
+++ b/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();
}
diff --git a/misc/examples/kemi/kamailio-basic-kemi-lua.lua
b/misc/examples/kemi/kamailio-basic-kemi-lua.lua
index fc31e1b93c..0ddfc82c1e 100644
--- a/misc/examples/kemi/kamailio-basic-kemi-lua.lua
+++ b/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
diff --git a/misc/examples/kemi/kamailio-basic-kemi-python.py
b/misc/examples/kemi/kamailio-basic-kemi-python.py
index f73abfedc5..601daa3687 100644
--- a/misc/examples/kemi/kamailio-basic-kemi-python.py
+++ b/misc/examples/kemi/kamailio-basic-kemi-python.py
@@ -157,8 +157,8 @@ def ksr_route_reqinit(self, msg):
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
diff --git a/misc/examples/kemi/kamailio-basic-kemi-ruby.rb
b/misc/examples/kemi/kamailio-basic-kemi-ruby.rb
index 11f96b460c..2a3a9eca41 100644
--- a/misc/examples/kemi/kamailio-basic-kemi-ruby.rb
+++ b/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 @@ def ksr_request_route()
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
diff --git a/misc/examples/kemi/kamailio-basic-kemi-sqlang.sq
b/misc/examples/kemi/kamailio-basic-kemi-sqlang.sq
index 4926ec8317..38672aa817 100644
--- a/misc/examples/kemi/kamailio-basic-kemi-sqlang.sq
+++ b/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();
}