[sr-dev] git:master:fb131bbd: tm: implemented the execution of branch_route callback via kemi

Daniel-Constantin Mierla miconda at gmail.com
Thu Apr 14 13:15:48 CEST 2016


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-04-14T13:15:15+02:00

tm: implemented the execution of branch_route callback via kemi

---

Modified: modules/tm/t_fwd.c
Modified: modules/tm/t_reply.c

---

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

---

diff --git a/modules/tm/t_fwd.c b/modules/tm/t_fwd.c
index 15f0969..dc97ad9 100644
--- a/modules/tm/t_fwd.c
+++ b/modules/tm/t_fwd.c
@@ -58,6 +58,7 @@
 #include "../../dst_blacklist.h"
 #endif
 #include "../../atomic_ops.h" /* membar_depends() */
+#include "../../kemi.h"
 
 
 extern int tm_failure_exec_mode;
@@ -152,6 +153,8 @@ static int prepare_new_uac( struct cell *t, struct sip_msg *i_req,
 	struct socket_info *force_send_socket_bak;
 	struct dest_info *dst;
 	struct run_act_ctx ctx;
+	struct run_act_ctx *bctx;
+	sr_kemi_eng_t *keng;
 
 	shbuf=0;
 	ret=E_UNSPEC;
@@ -340,10 +343,20 @@ static int prepare_new_uac( struct cell *t, struct sip_msg *i_req,
 				/* set the new values */
 				i_req->fwd_send_flags=snd_flags /* intial value  */;
 				set_force_socket(i_req, fsocket);
-				if (run_top_route(branch_rt.rlist[branch_route], i_req, &ctx)
-						< 0)
-				{
-					LOG(L_DBG, "negative return code in run_top_route\n");
+				keng = sr_kemi_eng_get();
+				if(unlikely(keng!=NULL)) {
+					bctx = sr_kemi_act_ctx_get();
+					sr_kemi_act_ctx_set(&ctx);
+					if(keng->froute(i_req, BRANCH_ROUTE,
+							sr_kemi_cbname_lookup_idx(branch_route))<0) {
+						LM_ERR("error running branch route kemi callback\n");
+					}
+					sr_kemi_act_ctx_set(bctx);
+				} else {
+					if (run_top_route(branch_rt.rlist[branch_route],
+								i_req, &ctx) < 0) {
+						LOG(L_DBG, "negative return code in run_top_route\n");
+					}
 				}
 				/* update dst send_flags  and send socket*/
 				snd_flags=i_req->fwd_send_flags;
diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c
index 237c38b..6022d50 100644
--- a/modules/tm/t_reply.c
+++ b/modules/tm/t_reply.c
@@ -993,7 +993,7 @@ int run_failure_handlers(struct cell *t, struct sip_msg *rpl,
 			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");
+					LM_ERR("error running failure route kemi callback\n");
 				}
 			} else {
 				if (run_top_route(failure_rt.rlist[on_failure], &faked_req, 0)<0)




More information about the sr-dev mailing list