Module: kamailio
Branch: master
Commit: 929823cd5620f8ee3ee7c8961f810e16b2031b01
URL:
https://github.com/kamailio/kamailio/commit/929823cd5620f8ee3ee7c8961f810e1…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2018-11-22T08:30:09+01:00
core: added kemi KSR.is_myself_srcip()
- equivalent of src_ip==myself condition
---
Modified: src/core/kemi.c
---
Diff:
https://github.com/kamailio/kamailio/commit/929823cd5620f8ee3ee7c8961f810e1…
Patch:
https://github.com/kamailio/kamailio/commit/929823cd5620f8ee3ee7c8961f810e1…
---
diff --git a/src/core/kemi.c b/src/core/kemi.c
index 9b1d0050a5..526ebf996b 100644
--- a/src/core/kemi.c
+++ b/src/core/kemi.c
@@ -274,12 +274,30 @@ static int sr_kemi_core_is_myself_suri(sip_msg_t *msg)
if(get_src_uri(msg, 0, &suri)<0) {
LM_ERR("cannot src address uri\n");
- return SR_KEMI_FALSE;
+ return SR_KEMI_FALSE;
}
return sr_kemi_core_is_myself(msg, &suri);
}
+/**
+ *
+ */
+static int sr_kemi_core_is_myself_srcip(sip_msg_t *msg)
+{
+ str srcip;
+ int ret;
+
+ srcip.s = ip_addr2a(&msg->rcv.src_ip);
+ srcip.len = strlen(srcip.s);
+
+ ret = check_self(&srcip, 0, 0);
+ if(ret==1) {
+ return SR_KEMI_TRUE;
+ }
+ return SR_KEMI_FALSE;
+}
+
/**
*
*/
@@ -1267,6 +1285,11 @@ static sr_kemi_t _sr_kemi_core[] = {
{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
+ { str_init(""), str_init("is_myself_srcip"),
+ SR_KEMIP_BOOL, sr_kemi_core_is_myself_srcip,
+ { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
{ str_init(""), str_init("setflag"),
SR_KEMIP_BOOL, sr_kemi_core_setflag,
{ SR_KEMIP_INT, SR_KEMIP_NONE, SR_KEMIP_NONE,