Browse code

core: store current executed cfg action in a global variable

- can be retrieved by module to access name of config file and the line

Daniel-Constantin Mierla authored on 15/09/2013 20:35:38
Showing 2 changed files
... ...
@@ -111,6 +111,14 @@
111 111
 int _last_returned_code  = 0;
112 112
 struct onsend_info* p_onsend=0; /* onsend route send info */
113 113
 
114
+/* current action executed from config file */
115
+static cfg_action_t *_cfg_crt_action = 0;
116
+
117
+/* return currect action executed from config file */
118
+cfg_action_t *get_cfg_crt_action(void)
119
+{
120
+	return _cfg_crt_action;
121
+}
114 122
 
115 123
 
116 124
 /* handle the exit code of a module function call.
... ...
@@ -1572,7 +1580,9 @@ int run_actions(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
1572 1572
 	for (t=a; t!=0; t=t->next){
1573 1573
 		if(unlikely(cfg_get(core, core_cfg, latency_limit_action)>0))
1574 1574
 			ms = TICKS_TO_MS(get_ticks_raw());
1575
+		_cfg_crt_action = t;
1575 1576
 		ret=do_action(h, t, msg);
1577
+		_cfg_crt_action = 0;
1576 1578
 		if(unlikely(cfg_get(core, core_cfg, latency_limit_action)>0)) {
1577 1579
 			ms = TICKS_TO_MS(get_ticks_raw()) - ms;
1578 1580
 			if(ms >= cfg_get(core, core_cfg, latency_limit_action)) {
... ...
@@ -68,6 +68,7 @@ int run_actions(struct run_act_ctx* c, struct action* a, struct sip_msg* msg);
68 68
 
69 69
 int run_top_route(struct action* a, sip_msg_t* msg, struct run_act_ctx* c);
70 70
 
71
+cfg_action_t *get_cfg_crt_action(void);
71 72
 
72 73
 #ifdef USE_LONGJMP
73 74
 int run_actions_safe(struct run_act_ctx* c, struct action* a,