[sr-dev] git:master:358cf95e: tm: t_drop_replies() exported to kemi framework

Daniel-Constantin Mierla miconda at gmail.com
Tue May 9 07:00:22 CEST 2017


Module: kamailio
Branch: master
Commit: 358cf95e68fd1b41ff8f7aee6478aa9c79361765
URL: https://github.com/kamailio/kamailio/commit/358cf95e68fd1b41ff8f7aee6478aa9c79361765

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-05-09T06:30:55+02:00

tm: t_drop_replies() exported to kemi framework

---

Modified: src/modules/tm/tm.c

---

Diff:  https://github.com/kamailio/kamailio/commit/358cf95e68fd1b41ff8f7aee6478aa9c79361765.diff
Patch: https://github.com/kamailio/kamailio/commit/358cf95e68fd1b41ff8f7aee6478aa9c79361765.patch

---

diff --git a/src/modules/tm/tm.c b/src/modules/tm/tm.c
index c7dd7df..0559286 100644
--- a/src/modules/tm/tm.c
+++ b/src/modules/tm/tm.c
@@ -2044,19 +2044,34 @@ int t_grep_status(struct sip_msg* msg, char* status, char* bar)
 
 /* drop all the existing replies in failure_route to make sure
  * that none of them is picked up again */
-static int w_t_drop_replies(struct sip_msg* msg, char* foo, char* bar)
+static int t_drop_replies_helper(sip_msg_t* msg, char* mode)
 {
-	if(foo==NULL)
+	if(mode==NULL)
 		t_drop_replies(1);
-	else if(*foo=='n')
+	else if(*mode=='n')
 		t_drop_replies(0);
-	else if(*foo=='l')
+	else if(*mode=='l')
 		t_drop_replies(2);
 	else
 		t_drop_replies(1);
 	return 1;
 }
 
+static int w_t_drop_replies(struct sip_msg* msg, char* mode, char* bar)
+{
+	return t_drop_replies_helper(msg, mode);
+}
+
+static int ki_t_drop_replies(sip_msg_t* msg, str* mode)
+{
+	return t_drop_replies_helper(msg, (mode)?mode->s:NULL);
+}
+
+static int ki_t_drop_replies_all(sip_msg_t* msg)
+{
+	return t_drop_replies_helper(msg, NULL);
+}
+
 /* save the message lumps after t_newtran() but before t_relay() */
 static int w_t_save_lumps(struct sip_msg* msg, char* foo, char* bar)
 {
@@ -2695,6 +2710,16 @@ static sr_kemi_t tm_kemi_exports[] = {
 		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
 	},
+	{ str_init("tm"), str_init("t_drop_replies_all"),
+		SR_KEMIP_INT, ki_t_drop_replies_all,
+		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+	},
+	{ str_init("tm"), str_init("t_drop_replies"),
+		SR_KEMIP_INT, ki_t_drop_replies,
+		{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+	},
 
 	{ {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }
 };




More information about the sr-dev mailing list