소스 검색

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

Daniel-Constantin Mierla 12 년 전
부모
커밋
ca568ee699
2개의 변경된 파일18개의 추가작업 그리고 1개의 파일을 삭제
  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 */
 /* current action executed from config file */
 static cfg_action_t *_cfg_crt_action = 0;
 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)
 cfg_action_t *get_cfg_crt_action(void)
 {
 {
 	return _cfg_crt_action;
 	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.
 /* handle the exit code of a module function call.
  * (used internally in do_action())
  * (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);
 int run_top_route(struct action* a, sip_msg_t* msg, struct run_act_ctx* c);
 
 
 cfg_action_t *get_cfg_crt_action(void);
 cfg_action_t *get_cfg_crt_action(void);
+int get_cfg_crt_line(void);
+char *get_cfg_crt_name(void);
 
 
 #ifdef USE_LONGJMP
 #ifdef USE_LONGJMP
 int run_actions_safe(struct run_act_ctx* c, struct action* a,
 int run_actions_safe(struct run_act_ctx* c, struct action* a,