Module: kamailio Branch: master Commit: a7525829309427fbb9357e0104b9dba1016f6777 URL: https://github.com/kamailio/kamailio/commit/a7525829309427fbb9357e0104b9dba1...
Author: Henning Westerholt hw@kamailio.org Committer: Henning Westerholt hw@kamailio.org Date: 2018-11-01T21:27:28+01:00
acc: fix generating duplicates for missed calls
- fix generating duplicates for missed calls (#GH1674) - patch from Julien Chavanton jchavanton at gmail dot com
---
Modified: src/modules/acc/acc.c Modified: src/modules/acc/acc_logic.c
---
Diff: https://github.com/kamailio/kamailio/commit/a7525829309427fbb9357e0104b9dba1... Patch: https://github.com/kamailio/kamailio/commit/a7525829309427fbb9357e0104b9dba1...
---
diff --git a/src/modules/acc/acc.c b/src/modules/acc/acc.c index 24d26304e5..9879e697ff 100644 --- a/src/modules/acc/acc.c +++ b/src/modules/acc/acc.c @@ -526,7 +526,7 @@ int is_eng_acc_on(sip_msg_t *msg) } while(e) { if(e->flags & 1) { - if(msg->flags & e->acc_flag) { + if(isflagset(msg, e->acc_flag) == 1) { return 1; } } @@ -549,7 +549,7 @@ int is_eng_mc_on(sip_msg_t *msg) } while(e) { if(e->flags & 1) { - if(msg->flags & e->missed_flag) { + if(isflagset(msg, e->missed_flag) == 1) { return 1; } } @@ -579,15 +579,15 @@ int acc_run_engines(struct sip_msg *msg, int type, int *reset) inf.leg_info = leg_info; while(e) { if(e->flags & 1) { - if((type==0) && (msg->flags&(e->acc_flag))) { + if((type==0) && isflagset(msg, e->acc_flag) == 1) { LM_DBG("acc event for engine: %s\n", e->name); e->acc_req(msg, &inf); - if(reset) *reset |= e->acc_flag; + if(reset) *reset |= 1 << e->acc_flag; } - if((type==1) && (msg->flags&(e->missed_flag))) { + if((type==1) && isflagset(msg, e->missed_flag) == 1) { LM_DBG("missed event for engine: %s\n", e->name); e->acc_req(msg, &inf); - if(reset) *reset |= e->missed_flag; + if(reset) *reset |= 1 << e->missed_flag; } } e = e->next; diff --git a/src/modules/acc/acc_logic.c b/src/modules/acc/acc_logic.c index e0443ce906..cc66bc67df 100644 --- a/src/modules/acc/acc_logic.c +++ b/src/modules/acc/acc_logic.c @@ -55,7 +55,6 @@ struct acc_enviroment acc_env;
#define is_acc_flag_set(_rq,_flag) (((_flag) != -1) && (isflagset((_rq), (_flag)) == 1)) -#define reset_acc_flag(_rq,_flag) (resetflag((_rq), (_flag)))
#define is_failed_acc_on(_rq) is_acc_flag_set(_rq,failed_transaction_flag)
@@ -465,7 +464,6 @@ static inline void acc_onreply_in(struct cell *t, struct sip_msg *req, }
- /* initiate a report if we previously enabled MC accounting for this t */ static inline void on_missed(struct cell *t, struct sip_msg *req, struct sip_msg *reply, int code) @@ -501,11 +499,10 @@ static inline void on_missed(struct cell *t, struct sip_msg *req, * forwarding attempt fails; we do not wish to * report on every attempt; so we clear the flags; */ - if (is_log_mc_on(req)) { env_set_text( ACC_MISSED, ACC_MISSED_LEN); acc_log_request( req ); - flags_to_reset |= log_missed_flag; + flags_to_reset |= 1 << log_missed_flag; } if (is_db_mc_on(req)) { if(acc_db_set_table_name(req, db_table_mc_data, &db_table_mc)<0) { @@ -513,7 +510,7 @@ static inline void on_missed(struct cell *t, struct sip_msg *req, return; } acc_db_request( req ); - flags_to_reset |= db_missed_flag; + flags_to_reset |= 1 << db_missed_flag; }
/* run extra acc engines */ @@ -523,7 +520,7 @@ static inline void on_missed(struct cell *t, struct sip_msg *req, * These can't be reset in the blocks above, because * it would skip accounting if the flags are identical */ - reset_acc_flag( req, flags_to_reset ); + resetflags(req, flags_to_reset);
if (new_uri_bk.len>=0) { req->new_uri = new_uri_bk;