[sr-dev] git:master: acc: added acc_prepare_flag parameter

Daniel-Constantin Mierla miconda at gmail.com
Fri Sep 23 22:19:48 CEST 2011


Module: sip-router
Branch: master
Commit: cf7a3249f9f792b0873b20bf6998f2ba74d7eb9d
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=cf7a3249f9f792b0873b20bf6998f2ba74d7eb9d

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Fri Sep 23 12:42:22 2011 +0200

acc: added acc_prepare_flag parameter

- useful to tell to acc module to prepare the request for later
  accounting, in case the acc or missed call flag is not set in request
  route block at all. Otherwise there will be no accounting if the acc
  flags are set for first time in TM routes (e.g., like failure_route)
- dicovered in a discussion with Ozren Lapcevic

---

 modules_k/acc/acc_logic.c |    5 ++++-
 modules_k/acc/acc_mod.c   |    2 ++
 modules_k/acc/acc_mod.h   |    1 +
 3 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/modules_k/acc/acc_logic.c b/modules_k/acc/acc_logic.c
index 6874327..d6e6d53 100644
--- a/modules_k/acc/acc_logic.c
+++ b/modules_k/acc/acc_logic.c
@@ -100,6 +100,8 @@ struct acc_enviroment acc_env;
 #define skip_cancel(_rq) \
 	(((_rq)->REQ_METHOD==METHOD_CANCEL) && report_cancels==0)
 
+#define is_acc_prepare_on(_rq) \
+	(is_acc_flag_set(_rq,acc_prepare_flag))
 
 
 
@@ -228,7 +230,8 @@ void acc_onreq( struct cell* t, int type, struct tmcb_params *ps )
 	int is_invite;
 
 	if ( ps->req && !skip_cancel(ps->req) &&
-	(is_acc_on(ps->req) || is_mc_on(ps->req)) ) {
+			( is_acc_on(ps->req) || is_mc_on(ps->req)
+				|| is_acc_prepare_on(ps->req) ) ) {
 		/* do some parsing in advance */
 		if (acc_preparse_req(ps->req)<0)
 			return;
diff --git a/modules_k/acc/acc_mod.c b/modules_k/acc/acc_mod.c
index d64610f..3dbf1f1 100644
--- a/modules_k/acc/acc_mod.c
+++ b/modules_k/acc/acc_mod.c
@@ -108,6 +108,7 @@ static char *failed_filter_str = 0;  /* by default, do not filter logging of
 unsigned short failed_filter[MAX_FAILED_FILTER_COUNT + 1];
 static char* leg_info_str = 0;	/*!< multi call-leg support */
 struct acc_extra *leg_info = 0;
+int acc_prepare_flag = -1; /*!< should the request be prepared for later acc */
 
 
 /* ----- SYSLOG acc variables ----------- */
@@ -236,6 +237,7 @@ static param_export_t params[] = {
 	{"report_cancels",          INT_PARAM, &report_cancels          },
 	{"multi_leg_info",          STR_PARAM, &leg_info_str            },
 	{"detect_direction",        INT_PARAM, &detect_direction        },
+	{"acc_prepare_flag",        INT_PARAM, &acc_prepare_flag        },
 	/* syslog specific */
 	{"log_flag",             INT_PARAM, &log_flag             },
 	{"log_missed_flag",      INT_PARAM, &log_missed_flag      },
diff --git a/modules_k/acc/acc_mod.h b/modules_k/acc/acc_mod.h
index cf900fe..ca76eff 100644
--- a/modules_k/acc/acc_mod.h
+++ b/modules_k/acc/acc_mod.h
@@ -49,6 +49,7 @@ extern int early_media;
 extern int failed_transaction_flag;
 extern unsigned short failed_filter[];
 extern int detect_direction;
+extern int acc_prepare_flag;
 
 extern int log_facility;
 extern int log_level;




More information about the sr-dev mailing list