Module: kamailio
Branch: master
Commit: bdad243dfb5a56c052eaa01150bbfc4696bd2ccb
URL:
https://github.com/kamailio/kamailio/commit/bdad243dfb5a56c052eaa01150bbfc4…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2018-12-03T21:01:39+01:00
tmx: exported t_drop functions to kemi framework
---
Modified: src/modules/tmx/tmx_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/bdad243dfb5a56c052eaa01150bbfc4…
Patch:
https://github.com/kamailio/kamailio/commit/bdad243dfb5a56c052eaa01150bbfc4…
---
diff --git a/src/modules/tmx/tmx_mod.c b/src/modules/tmx/tmx_mod.c
index c31eae6713..1dc22f4f27 100644
--- a/src/modules/tmx/tmx_mod.c
+++ b/src/modules/tmx/tmx_mod.c
@@ -704,17 +704,9 @@ static int t_is_request_route(sip_msg_t* msg)
/**
*
*/
-static int w_t_drop1(sip_msg_t* msg, char *p1, char *p2)
+static int ki_t_drop_rcode(sip_msg_t* msg, int rcode)
{
tm_cell_t *t = 0;
- unsigned int uas_status = 500;
-
- if(p1) {
- if(fixup_get_ivalue(msg, (gparam_p)p1, (int*)&uas_status)<0)
- {
- uas_status = 500;
- }
- }
t=_tmx_tmb.t_gett();
if (t==NULL || t==T_UNDEFINED) {
@@ -722,19 +714,42 @@ static int w_t_drop1(sip_msg_t* msg, char *p1, char *p2)
return -1;
}
- t->uas.status = uas_status;
+ t->uas.status = (unsigned int)rcode;
if(t_is_request_route(msg) == 1) {
_tmx_tmb.t_release(msg);
}
return 0;
}
+/**
+ *
+ */
+static int ki_t_drop(sip_msg_t* msg)
+{
+ return ki_t_drop_rcode(msg, 500);
+}
+
+/**
+ *
+ */
+static int w_t_drop1(sip_msg_t* msg, char *p1, char *p2)
+{
+ int uas_status = 500;
+
+ if(p1) {
+ if(fixup_get_ivalue(msg, (gparam_t*)p1, &uas_status)<0) {
+ uas_status = 500;
+ }
+ }
+ return ki_t_drop_rcode(msg, uas_status);
+}
+
/**
*
*/
static int w_t_drop0(sip_msg_t* msg, char *p1, char *p2)
{
- return w_t_drop1(msg, NULL, NULL);
+ return ki_t_drop_rcode(msg, 500);
}
@@ -1140,6 +1155,16 @@ static sr_kemi_t sr_kemi_tmx_exports[] = {
{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_INT,
SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
+ { str_init("tmx"), str_init("t_drop"),
+ SR_KEMIP_INT, ki_t_drop,
+ { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init("tmx"), str_init("t_drop_rcode"),
+ SR_KEMIP_INT, ki_t_drop_rcode,
+ { SR_KEMIP_INT, 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 } }
};