فهرست منبع

core: kemi - exported is_myself_suri()

- return true if the source address is matching myself (useful to detect
when sending to itself)
Daniel-Constantin Mierla 7 سال پیش
والد
کامیت
e4f6a39b08
1فایلهای تغییر یافته به همراه20 افزوده شده و 0 حذف شده
  1. 20 0
      src/core/kemi.c

+ 20 - 0
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,