Module: kamailio
Branch: 5.0
Commit: d0b49abb54a6e15edb53f4d8bc7030e4078bb2ad
URL:
https://github.com/kamailio/kamailio/commit/d0b49abb54a6e15edb53f4d8bc7030e…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-10-31T12:38:47+01:00
acc: allow accounting only for external accounting engine
- have accounting via external engines without a need to have log
flag set
- backport of ccf71c68f7c0af4ac761e2e0c2dc1ac11662261f
---
Modified: src/modules/acc/acc.c
Modified: src/modules/acc/acc.h
Modified: src/modules/acc/acc_logic.c
---
Diff:
https://github.com/kamailio/kamailio/commit/d0b49abb54a6e15edb53f4d8bc7030e…
Patch:
https://github.com/kamailio/kamailio/commit/d0b49abb54a6e15edb53f4d8bc7030e…
---
diff --git a/src/modules/acc/acc.c b/src/modules/acc/acc.c
index a7ba8c0d75..84e9b16bdc 100644
--- a/src/modules/acc/acc.c
+++ b/src/modules/acc/acc.c
@@ -781,6 +781,52 @@ int acc_diam_request( struct sip_msg *req )
#endif
/**
+ * @brief test if acc flag from enternal engines is set
+ */
+int is_eng_acc_on(sip_msg_t *msg)
+{
+ acc_engine_t *e;
+
+ e = acc_api_get_engines();
+
+ if(e==NULL) {
+ return 0;
+ }
+ while(e) {
+ if(e->flags & 1) {
+ if(msg->flags & e->acc_flag) {
+ return 1;
+ }
+ }
+ e = e->next;
+ }
+ return 0;
+}
+
+/**
+ * @brief test if acc flag from enternal engines is set
+ */
+int is_eng_mc_on(sip_msg_t *msg)
+{
+ acc_engine_t *e;
+
+ e = acc_api_get_engines();
+
+ if(e==NULL) {
+ return 0;
+ }
+ while(e) {
+ if(e->flags & 1) {
+ if(msg->flags & e->missed_flag) {
+ return 1;
+ }
+ }
+ e = e->next;
+ }
+ return 0;
+}
+
+/**
* @brief execute all acc engines for a SIP request event
*/
int acc_run_engines(struct sip_msg *msg, int type, int *reset)
diff --git a/src/modules/acc/acc.h b/src/modules/acc/acc.h
index 248c2cf4d9..3c25bdcaf5 100644
--- a/src/modules/acc/acc.h
+++ b/src/modules/acc/acc.h
@@ -90,4 +90,7 @@ int acc_diam_init(void);
int acc_diam_request( struct sip_msg *req );
#endif
+int is_eng_acc_on(sip_msg_t *msg);
+int is_eng_mc_on(sip_msg_t *msg);
+
#endif
diff --git a/src/modules/acc/acc_logic.c b/src/modules/acc/acc_logic.c
index 58418441d9..7042aca56c 100644
--- a/src/modules/acc/acc_logic.c
+++ b/src/modules/acc/acc_logic.c
@@ -79,11 +79,11 @@ struct acc_enviroment acc_env;
#define is_acc_on(_rq) \
( (is_log_acc_on(_rq)) || (is_db_acc_on(_rq)) \
- || (is_diam_acc_on(_rq)) )
+ || (is_diam_acc_on(_rq)) || (is_eng_acc_on(_rq)) )
#define is_mc_on(_rq) \
( (is_log_mc_on(_rq)) || (is_db_mc_on(_rq)) \
- || (is_diam_mc_on(_rq)) )
+ || (is_diam_mc_on(_rq)) || (is_eng_mc_on(_rq)) )
#define skip_cancel(_rq) \
(((_rq)->REQ_METHOD==METHOD_CANCEL) && report_cancels==0)