Browse code

core: Add callback to be able to log assign actions.

Victor Seva authored on 29/05/2013 10:25:09
Showing 2 changed files
... ...
@@ -36,7 +36,16 @@
36 36
 #include "dprint.h"
37 37
 #include "route.h"
38 38
 
39
+/* callback to log assign actions */
40
+static log_assign_action_f _log_assign_action = NULL;
39 41
 
42
+/**
43
+ * @brief set callback function log assign actions
44
+ */
45
+void set_log_assign_action_cb(log_assign_action_f f)
46
+{
47
+	_log_assign_action = f;
48
+}
40 49
 
41 50
 /**
42 51
  * @brief eval rve and assign the result to an avp
... ...
@@ -406,6 +415,11 @@ int lval_assign(struct run_act_ctx* h, struct sip_msg* msg,
406 406
 			rve->fpos.s_line, rve->fpos.s_col,
407 407
 			rve->fpos.e_line, rve->fpos.e_col);
408 408
 	}
409
+	else
410
+	{
411
+		if(unlikely(_log_assign_action!=NULL))
412
+			_log_assign_action(msg, lv);
413
+	}
409 414
 	rval_destroy(rv);
410 415
 	return ret;
411 416
 error:
... ...
@@ -51,7 +51,8 @@ struct lvalue{
51 51
 /* lval operators */
52 52
 #define EQ_T 254 /* k compatibility */
53 53
 
54
-
54
+typedef int (*log_assign_action_f)(struct sip_msg* msg, struct lvalue *lv);
55
+void set_log_assign_action_cb(log_assign_action_f f);
55 56
 
56 57
 /** eval rve and assign the result to lv
57 58
  * lv=eval(rve)