Module: kamailio
Branch: master
Commit: 43fc3cd6ea1fe8f9e96ca498ba0ed69d2c14589b
URL:
https://github.com/kamailio/kamailio/commit/43fc3cd6ea1fe8f9e96ca498ba0ed69…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2016-04-14T13:15:15+02:00
tm: implementation of alternative failure_route callback execution via kemi
---
Modified: modules/tm/t_reply.c
---
Diff:
https://github.com/kamailio/kamailio/commit/43fc3cd6ea1fe8f9e96ca498ba0ed69…
Patch:
https://github.com/kamailio/kamailio/commit/43fc3cd6ea1fe8f9e96ca498ba0ed69…
---
diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c
index 9011c87..237c38b 100644
--- a/modules/tm/t_reply.c
+++ b/modules/tm/t_reply.c
@@ -73,6 +73,7 @@
#include "../../sr_compat.h"
#include "../../receive.h"
#include "../../onsend.h"
+#include "../../kemi.h"
#include "t_stats.h"
#include "uac.h"
@@ -949,6 +950,7 @@ int run_failure_handlers(struct cell *t, struct sip_msg *rpl,
static struct sip_msg faked_req;
struct sip_msg *shmem_msg = t->uas.request;
int on_failure;
+ sr_kemi_eng_t *keng = NULL;
on_failure = t->uac[picked_branch].on_failure;
@@ -987,8 +989,16 @@ int run_failure_handlers(struct cell *t, struct sip_msg *rpl,
t->flags &= ~T_ASYNC_SUSPENDED;
if (exec_pre_script_cb(&faked_req, FAILURE_CB_TYPE)>0) {
/* run a failure_route action if some was marked */
- if (run_top_route(failure_rt.rlist[on_failure], &faked_req, 0)<0)
- LOG(L_ERR, "ERROR: run_failure_handlers: Error in run_top_route\n");
+ keng = sr_kemi_eng_get();
+ if(unlikely(keng!=NULL)) {
+ if(keng->froute(&faked_req, FAILURE_ROUTE,
+ sr_kemi_cbname_lookup_idx(on_failure))<0) {
+ LM_ERR("error running failure kemi callback\n");
+ }
+ } else {
+ if (run_top_route(failure_rt.rlist[on_failure], &faked_req, 0)<0)
+ LM_ERR("error running run_top_route for failure handler\n");
+ }
exec_post_script_cb(&faked_req, FAILURE_CB_TYPE);
}
/* update message flags, if changed in failure route */