Module: sip-router Branch: master Commit: a2316f35deef2586f79dc575367224af853e9b70 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a2316f35...
Author: Victor Seva linuxmaniac@torreviejawireless.org Committer: Victor Seva linuxmaniac@torreviejawireless.org Date: Wed May 29 12:25:09 2013 +0200
core: Add callback to be able to log assign actions.
---
lvalue.c | 14 ++++++++++++++ lvalue.h | 3 ++- 2 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/lvalue.c b/lvalue.c index a235ccc..156e506 100644 --- a/lvalue.c +++ b/lvalue.c @@ -36,7 +36,16 @@ #include "dprint.h" #include "route.h"
+/* callback to log assign actions */ +static log_assign_action_f _log_assign_action = NULL;
+/** + * @brief set callback function log assign actions + */ +void set_log_assign_action_cb(log_assign_action_f f) +{ + _log_assign_action = f; +}
/** * @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, rve->fpos.s_line, rve->fpos.s_col, rve->fpos.e_line, rve->fpos.e_col); } + else + { + if(unlikely(_log_assign_action!=NULL)) + _log_assign_action(msg, lv); + } rval_destroy(rv); return ret; error: diff --git a/lvalue.h b/lvalue.h index 3dbbcb1..b5eccd4 100644 --- a/lvalue.h +++ b/lvalue.h @@ -51,7 +51,8 @@ struct lvalue{ /* lval operators */ #define EQ_T 254 /* k compatibility */
- +typedef int (*log_assign_action_f)(struct sip_msg* msg, struct lvalue *lv); +void set_log_assign_action_cb(log_assign_action_f f);
/** eval rve and assign the result to lv * lv=eval(rve)