[sr-dev] git:master:afed885f: kazoo: add ksr_msg_env_reset after processing events

lazedo luis.azedo at factorlusitano.com
Fri May 19 17:05:08 CEST 2017


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

Author: lazedo <luis.azedo at factorlusitano.com>
Committer: lazedo <luis.azedo at factorlusitano.com>
Date: 2017-05-19T16:04:45+01:00

kazoo: add ksr_msg_env_reset after processing events

---

Modified: src/modules/kazoo/kz_amqp.c

---

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

---

diff --git a/src/modules/kazoo/kz_amqp.c b/src/modules/kazoo/kz_amqp.c
index da310893c9..ca3a86a19c 100644
--- a/src/modules/kazoo/kz_amqp.c
+++ b/src/modules/kazoo/kz_amqp.c
@@ -42,6 +42,10 @@
 #include "../../core/mod_fix.h"
 #include "../../core/lvalue.h"
 #include "../tm/tm_load.h"
+#include "../../core/route.h"
+#include "../../core/receive.h"
+#include "../../core/action.h"
+#include "../../core/script_cb.h"
 
 
 #include "kz_amqp.h"
@@ -2280,11 +2284,14 @@ int kz_amqp_consumer_fire_event(char *eventkey)
 	fmsg = faked_msg_get_next();
 	rtb = get_route_type();
 	set_route_type(REQUEST_ROUTE);
-	init_run_actions_ctx(&ctx);
-	run_top_route(event_rt.rlist[rt], fmsg, 0);
+	if (exec_pre_script_cb(fmsg, REQUEST_CB_TYPE)!=0 ) {
+		init_run_actions_ctx(&ctx);
+		run_top_route(event_rt.rlist[rt], fmsg, 0);
+		exec_post_script_cb(fmsg, REQUEST_CB_TYPE);
+		ksr_msg_env_reset();
+	}
 	set_route_type(rtb);
 	return 0;
-
 }
 
 void kz_amqp_consumer_event(char *payload, char* event_key, char* event_subkey)
@@ -2408,6 +2415,7 @@ void kz_amqp_cb_ok(kz_amqp_cmd_ptr cmd)
 	}
 	struct action *a = main_rt.rlist[n];
 	tmb.t_continue(cmd->t_hash, cmd->t_label, a);
+	ksr_msg_env_reset();
 }
 
 void kz_amqp_cb_error(kz_amqp_cmd_ptr cmd)
@@ -2419,6 +2427,7 @@ void kz_amqp_cb_error(kz_amqp_cmd_ptr cmd)
 	}
 	struct action *a = main_rt.rlist[n];
 	tmb.t_continue(cmd->t_hash, cmd->t_label, a);
+	ksr_msg_env_reset();
 }
 
 int kz_send_worker_error_event(kz_amqp_cmd_ptr cmd)




More information about the sr-dev mailing list