Browse Source

core: added wrapper functions to return cfg line and name for current action

Daniel-Constantin Mierla 12 năm trước cách đây
mục cha
commit
ca568ee699
2 tập tin đã thay đổi với 18 bổ sung1 xóa
  1. 16 1
      action.c
  2. 2 0
      action.h

+ 16 - 1
action.c

@@ -114,12 +114,27 @@ struct onsend_info* p_onsend=0; /* onsend route send info */
 /* current action executed from config file */
 static cfg_action_t *_cfg_crt_action = 0;
 
-/* return currect action executed from config file */
+/* return current action executed from config file */
 cfg_action_t *get_cfg_crt_action(void)
 {
 	return _cfg_crt_action;
 }
 
+/* return line in config for current executed action */
+int get_cfg_crt_line(void)
+{
+	if(_cfg_crt_action==0)
+		return 0;
+	return _cfg_crt_action->cline;
+}
+
+/* return name of config for current executed action */
+char *get_cfg_crt_name(void)
+{
+	if(_cfg_crt_action==0)
+		return 0;
+	return _cfg_crt_action->cfile;
+}
 
 /* handle the exit code of a module function call.
  * (used internally in do_action())

+ 2 - 0
action.h

@@ -69,6 +69,8 @@ int run_actions(struct run_act_ctx* c, struct action* a, struct sip_msg* msg);
 int run_top_route(struct action* a, sip_msg_t* msg, struct run_act_ctx* c);
 
 cfg_action_t *get_cfg_crt_action(void);
+int get_cfg_crt_line(void);
+char *get_cfg_crt_name(void);
 
 #ifdef USE_LONGJMP
 int run_actions_safe(struct run_act_ctx* c, struct action* a,