Module: kamailio Branch: master Commit: b4f439301c2dffbfc6a389354e840142fc3b965b URL: https://github.com/kamailio/kamailio/commit/b4f439301c2dffbfc6a389354e840142...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2021-01-12T10:05:32+01:00
misc/examples/kemi: use local variable instead of many function calls for js
---
Modified: misc/examples/kemi/kamailio-basic-kemi-jsdt.js
---
Diff: https://github.com/kamailio/kamailio/commit/b4f439301c2dffbfc6a389354e840142... Patch: https://github.com/kamailio/kamailio/commit/b4f439301c2dffbfc6a389354e840142...
---
diff --git a/misc/examples/kemi/kamailio-basic-kemi-jsdt.js b/misc/examples/kemi/kamailio-basic-kemi-jsdt.js index cedbf098b0..9949739d94 100644 --- a/misc/examples/kemi/kamailio-basic-kemi-jsdt.js +++ b/misc/examples/kemi/kamailio-basic-kemi-jsdt.js @@ -116,18 +116,19 @@ function ksr_route_relay() function ksr_route_reqinit() { if (!KSR.is_myself_srcip()) { + var srcip = KSR.kx.get_srcip(); if (KSR.htable.sht_match_name("ipban", "eq", srcip) > 0) { // ip is already blocked KSR.dbg("request from blocked IP - " + KSR.kx.get_method() + " from " + KSR.kx.get_furi() + " (IP:" - + KSR.kx.get_srcip() + ":" + KSR.kx.get_srcport() + ")\n"); + + srcip + ":" + KSR.kx.get_srcport() + ")\n"); KSR.x.exit(); } if (KSR.pike.pike_check_req()<0) { KSR.err("ALERT: pike blocking " + KSR.kx.get_method() + " from " + KSR.kx.get_furi() + " (IP:" - + KSR.kx.get_srcip() + ":" + KSR.kx.get_srcport() + ")\n"); - KSR.htable.sht_seti("ipban", KSR.kx.get_srcip(), 1); + + srcip + ":" + KSR.kx.get_srcport() + ")\n"); + KSR.htable.sht_seti("ipban", srcip, 1); KSR.x.exit(); } }