[sr-dev] git:master:b4f43930: misc/examples/kemi: use local variable instead of many function calls for js
Daniel-Constantin Mierla
miconda at gmail.com
Tue Jan 12 10:06:26 CET 2021
Module: kamailio
Branch: master
Commit: b4f439301c2dffbfc6a389354e840142fc3b965b
URL: https://github.com/kamailio/kamailio/commit/b4f439301c2dffbfc6a389354e840142fc3b965b
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at 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/b4f439301c2dffbfc6a389354e840142fc3b965b.diff
Patch: https://github.com/kamailio/kamailio/commit/b4f439301c2dffbfc6a389354e840142fc3b965b.patch
---
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();
}
}
More information about the sr-dev
mailing list