2
0
Эх сурвалжийг харах

tmx: functions to check the routing block type exported to kemi

Daniel-Constantin Mierla 9 жил өмнө
parent
commit
f81488f50e
1 өөрчлөгдсөн 72 нэмэгдсэн , 12 устгасан
  1. 72 12
      modules/tmx/tmx_mod.c

+ 72 - 12
modules/tmx/tmx_mod.c

@@ -68,10 +68,10 @@ static int t_reply_callid(struct sip_msg* msg, char *cid, char *cseq,
 static int fixup_reply_callid(void** param, int param_no);
 
 static int t_flush_flags(struct sip_msg* msg, char*, char* );
-static int t_is_failure_route(struct sip_msg* msg, char*, char* );
-static int t_is_branch_route(struct sip_msg* msg, char*, char* );
-static int t_is_reply_route(struct sip_msg* msg, char*, char*);
-static int t_is_request_route(struct sip_msg* msg, char*, char*);
+static int w_t_is_failure_route(struct sip_msg* msg, char*, char* );
+static int w_t_is_branch_route(struct sip_msg* msg, char*, char* );
+static int w_t_is_reply_route(struct sip_msg* msg, char*, char*);
+static int w_t_is_request_route(struct sip_msg* msg, char*, char*);
 
 static int w_t_suspend(struct sip_msg* msg, char*, char*);
 static int w_t_continue(struct sip_msg* msg, char *idx, char *lbl, char *rtn);
@@ -187,13 +187,13 @@ static cmd_export_t cmds[]={
 		fixup_reply_callid, 0, ANY_ROUTE },
 	{"t_flush_flags",   (cmd_function)t_flush_flags,    0, 0,
 		0, ANY_ROUTE  },
-	{"t_is_failure_route",   (cmd_function)t_is_failure_route,   0, 0,
+	{"t_is_failure_route",  (cmd_function)w_t_is_failure_route,   0, 0,
 		0, ANY_ROUTE  },
-	{"t_is_branch_route",    (cmd_function)t_is_branch_route,    0, 0,
+	{"t_is_branch_route",   (cmd_function)w_t_is_branch_route,    0, 0,
 		0, ANY_ROUTE  },
-	{"t_is_reply_route",    (cmd_function)t_is_reply_route,    0, 0,
+	{"t_is_reply_route",    (cmd_function)w_t_is_reply_route,    0, 0,
 		0, ANY_ROUTE  },
-	{"t_is_request_route",    (cmd_function)t_is_request_route,    0, 0,
+	{"t_is_request_route",  (cmd_function)w_t_is_request_route,    0, 0,
 		0, ANY_ROUTE  },
 	{"t_suspend",    (cmd_function)w_t_suspend,    0, 0,
 		0, ANY_ROUTE  },
@@ -540,7 +540,7 @@ static int t_flush_flags(struct sip_msg* msg, char *foo, char *bar)
 /**
  *
  */
-static int t_is_failure_route(struct sip_msg* msg, char *foo, char *bar)
+static int w_t_is_failure_route(struct sip_msg* msg, char *foo, char *bar)
 {
 	if(route_type==FAILURE_ROUTE)
 		return 1;
@@ -550,7 +550,27 @@ static int t_is_failure_route(struct sip_msg* msg, char *foo, char *bar)
 /**
  *
  */
-static int t_is_branch_route(struct sip_msg* msg, char *foo, char *bar)
+static int t_is_failure_route(sip_msg_t* msg)
+{
+	if(route_type==FAILURE_ROUTE)
+		return 1;
+	return -1;
+}
+
+/**
+ *
+ */
+static int w_t_is_branch_route(struct sip_msg* msg, char *foo, char *bar)
+{
+	if(route_type==BRANCH_ROUTE)
+		return 1;
+	return -1;
+}
+
+/**
+ *
+ */
+static int t_is_branch_route(sip_msg_t* msg)
 {
 	if(route_type==BRANCH_ROUTE)
 		return 1;
@@ -560,7 +580,17 @@ static int t_is_branch_route(struct sip_msg* msg, char *foo, char *bar)
 /**
  *
  */
-static int t_is_reply_route(struct sip_msg* msg, char *foo, char *bar)
+static int w_t_is_reply_route(struct sip_msg* msg, char *foo, char *bar)
+{
+	if(route_type & ONREPLY_ROUTE)
+		return 1;
+	return -1;
+}
+
+/**
+ *
+ */
+static int t_is_reply_route(sip_msg_t* msg)
 {
 	if(route_type & ONREPLY_ROUTE)
 		return 1;
@@ -570,7 +600,17 @@ static int t_is_reply_route(struct sip_msg* msg, char *foo, char *bar)
 /**
  *
  */
-static int t_is_request_route(struct sip_msg* msg, char *foo, char *bar)
+static int w_t_is_request_route(struct sip_msg* msg, char *foo, char *bar)
+{
+	if(route_type == REQUEST_ROUTE)
+		return 1;
+	return -1;
+}
+
+/**
+ *
+ */
+static int t_is_request_route(sip_msg_t* msg)
 {
 	if(route_type == REQUEST_ROUTE)
 		return 1;
@@ -874,6 +914,26 @@ static sr_kemi_t sr_kemi_tmx_exports[] = {
 		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
 	},
+	{ str_init("tmx"), str_init("t_is_request_route"),
+		SR_KEMIP_INT, t_is_request_route,
+		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+	},
+	{ str_init("tmx"), str_init("t_is_reply_route"),
+		SR_KEMIP_INT, t_is_reply_route,
+		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+	},
+	{ str_init("tmx"), str_init("t_is_failure_route"),
+		SR_KEMIP_INT, t_is_failure_route,
+		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+	},
+	{ str_init("tmx"), str_init("t_is_branch_route"),
+		SR_KEMIP_INT, t_is_branch_route,
+		{ SR_KEMIP_NONE, 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 } }
 };