Module: kamailio
Branch: master
Commit: 35767f387bbcd2766bf7a4ff1345183612219225
URL:
https://github.com/kamailio/kamailio/commit/35767f387bbcd2766bf7a4ff1345183…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-11-25T13:36:59+01:00
acc: expose accounting functions via inter-module api
---
Modified: src/modules/acc/acc_api.h
Modified: src/modules/acc/acc_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/35767f387bbcd2766bf7a4ff1345183…
Patch:
https://github.com/kamailio/kamailio/commit/35767f387bbcd2766bf7a4ff1345183…
---
diff --git a/src/modules/acc/acc_api.h b/src/modules/acc/acc_api.h
index 0a6df2e32c..04b893483b 100644
--- a/src/modules/acc/acc_api.h
+++ b/src/modules/acc/acc_api.h
@@ -146,8 +146,16 @@ typedef acc_extra_t* (*parse_extra_f)(char *extra_str);
typedef int (*register_cdr_engine_f)(cdr_engine_t *eng);
typedef int (*cdr_api_exec_f)(struct dlg_cell *dlg, struct sip_msg *rq, cdr_engine_t
*eng, acc_param_t* comment);
+typedef int (*acc_log_request_f)(sip_msg_t *msg, str *comment);
+typedef int (*acc_db_request_f)(sip_msg_t *msg, str *comment, str *dbtable);
+typedef int (*acc_request_f)(sip_msg_t *msg, str *comment, str *dbtable);
+
+
/* the acc API */
typedef struct acc_api {
+ acc_log_request_f acc_log_request;
+ acc_db_request_f acc_db_request;
+ acc_request_f acc_request;
leg_info_f get_leg_info;
core2strar_f get_core_attrs;
extra2strar_f get_extra_attrs;
diff --git a/src/modules/acc/acc_mod.c b/src/modules/acc/acc_mod.c
index 5afcab113b..801a908025 100644
--- a/src/modules/acc/acc_mod.c
+++ b/src/modules/acc/acc_mod.c
@@ -644,6 +644,12 @@ static int bind_acc(acc_api_t* api)
return -1;
}
+ memset(api, 0, sizeof(acc_api_t));
+
+ api->acc_log_request = ki_acc_log_request;
+ api->acc_db_request = ki_acc_db_request;
+ api->acc_request = ki_acc_request;
+
api->register_engine = acc_register_engine;
api->get_leg_info = get_leg_info;
api->get_core_attrs = core2strar;