Skip to content

Commit

Permalink
misc/examples/kemi: filter on user agent matching friendly, scanner a…
Browse files Browse the repository at this point in the history
…nd sipvicious

(cherry picked from commit e15c90d)
  • Loading branch information
miconda committed Dec 11, 2020
1 parent 66f5cc9 commit c5793f5
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
3 changes: 2 additions & 1 deletion misc/examples/kemi/kamailio-basic-kemi-jsdt.js
Expand Up @@ -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();
}
Expand Down
4 changes: 2 additions & 2 deletions misc/examples/kemi/kamailio-basic-kemi-lua.lua
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions misc/examples/kemi/kamailio-basic-kemi-python.py
Expand Up @@ -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

Expand Down
5 changes: 3 additions & 2 deletions misc/examples/kemi/kamailio-basic-kemi-ruby.rb
Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion misc/examples/kemi/kamailio-basic-kemi-sqlang.sq
Expand Up @@ -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();
}
Expand Down

0 comments on commit c5793f5

Please sign in to comment.