Module: kamailio
Branch: master
Commit: ccf71c68f7c0af4ac761e2e0c2dc1ac11662261f
URL:
https://github.com/kamailio/kamailio/commit/ccf71c68f7c0af4ac761e2e0c2dc1ac…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-10-31T12:31:26+01:00
acc: allow accounting only for external accounting engine
- have accounting via external engines without a need to have log flag set
---
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/ccf71c68f7c0af4ac761e2e0c2dc1ac…
Patch:
https://github.com/kamailio/kamailio/commit/ccf71c68f7c0af4ac761e2e0c2dc1ac…
---
diff --git a/src/modules/acc/acc.c b/src/modules/acc/acc.c
index b5c304a801..ad2df5a6c2 100644
--- a/src/modules/acc/acc.c
+++ b/src/modules/acc/acc.c
@@ -511,6 +511,52 @@ int acc_db_request( struct sip_msg *rq)
}
/**
+ * @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 6089e49abc..a764a694fc 100644
--- a/src/modules/acc/acc.h
+++ b/src/modules/acc/acc.h
@@ -83,6 +83,9 @@ int acc_db_init(const str* db_url);
int acc_db_init_child(const str* db_url);
void acc_db_close(void);
int acc_db_request( struct sip_msg *req);
-int acc_get_db_handlers(void **vf, void **vh);
+int acc_get_db_handlers(void **vf, void **vh);
+
+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 da0b6d4e78..d41108d3bc 100644
--- a/src/modules/acc/acc_logic.c
+++ b/src/modules/acc/acc_logic.c
@@ -66,10 +66,10 @@ struct acc_enviroment acc_env;
#define is_db_mc_on(_rq) is_acc_flag_set(_rq,db_missed_flag)
#define is_acc_on(_rq) \
- ( (is_log_acc_on(_rq)) || (is_db_acc_on(_rq)) )
+ ( (is_log_acc_on(_rq)) || (is_db_acc_on(_rq)) || (is_eng_acc_on(_rq)) )
#define is_mc_on(_rq) \
- ( (is_log_mc_on(_rq)) || (is_db_mc_on(_rq)) )
+ ( (is_log_mc_on(_rq)) || (is_db_mc_on(_rq)) || (is_eng_mc_on(_rq)) )
#define skip_cancel(_rq) \
(((_rq)->REQ_METHOD==METHOD_CANCEL) && report_cancels==0)