Module: kamailio
Branch: master
Commit: e4f6a39b08cb6fb8bb40c635ebafc7795a239e3c
URL:
https://github.com/kamailio/kamailio/commit/e4f6a39b08cb6fb8bb40c635ebafc77…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2018-05-08T22:48:47+02:00
core: kemi - exported is_myself_suri()
- return true if the source address is matching myself (useful to detect
when sending to itself)
---
Modified: src/core/kemi.c
---
Diff:
https://github.com/kamailio/kamailio/commit/e4f6a39b08cb6fb8bb40c635ebafc77…
Patch:
https://github.com/kamailio/kamailio/commit/e4f6a39b08cb6fb8bb40c635ebafc77…
---
diff --git a/src/core/kemi.c b/src/core/kemi.c
index 0ff1c48152..bb671f1e60 100644
--- a/src/core/kemi.c
+++ b/src/core/kemi.c
@@ -235,6 +235,21 @@ static int sr_kemi_core_is_myself_turi(sip_msg_t *msg)
return sr_kemi_core_is_myself(msg, &xto->uri);
}
+/**
+ *
+ */
+static int sr_kemi_core_is_myself_suri(sip_msg_t *msg)
+{
+ str suri;
+
+ if(get_src_uri(msg, 0, &suri)<0) {
+ LM_ERR("cannot src address uri\n");
+ return SR_KEMI_FALSE;
+ }
+
+ return sr_kemi_core_is_myself(msg, &suri);
+}
+
/**
*
*/
@@ -1047,6 +1062,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_suri"),
+ SR_KEMIP_BOOL, sr_kemi_core_is_myself_suri,
+ { 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,