Module: kamailio
Branch: master
Commit: 7bedc5885134bb340b75a263d822617831e4af99
URL:
https://github.com/kamailio/kamailio/commit/7bedc5885134bb340b75a263d822617…
Author: Carlos Cruz <carlos(a)cruzccl.com>
Committer: Henning Westerholt <hw(a)skalatan.de>
Date: 2020-06-11T10:42:12+02:00
acc: new skip_cdr modparam to prevent cdr generation
This commit adds a new modparam called cdr_skip to acc module that allows
excluding certain calls from CDRs in Kamailio route logic.
Dialogs ended with chosen dlg_var set (no matter the value) won't generate
a CDR (both database and log) even though cdr_enable modparam is set.
---
Modified: src/modules/acc/acc_cdr.c
Modified: src/modules/acc/acc_mod.c
Modified: src/modules/acc/acc_mod.h
Modified: src/modules/acc/doc/acc_admin.xml
---
Diff:
https://github.com/kamailio/kamailio/commit/7bedc5885134bb340b75a263d822617…
Patch:
https://github.com/kamailio/kamailio/commit/7bedc5885134bb340b75a263d822617…
---
diff --git a/src/modules/acc/acc_cdr.c b/src/modules/acc/acc_cdr.c
index d59192156a..52c904a50f 100644
--- a/src/modules/acc/acc_cdr.c
+++ b/src/modules/acc/acc_cdr.c
@@ -392,6 +392,16 @@ static int write_cdr( struct dlg_cell* dialog,
return -1;
}
+ /* Skip cdr if cdr_skip dlg_var exists */
+ if (cdr_skip.len > 0) {
+ str* nocdr_val = 0;
+ nocdr_val = dlgb.get_dlg_var( dialog, &cdr_skip);
+ if ( nocdr_val ){
+ LM_DBG( "cdr_skip dlg_var set, skip cdr!");
+ return 0;
+ }
+ }
+
ret = log_write_cdr(dialog, message);
ret |= db_write_cdr(dialog, message);
return ret;
diff --git a/src/modules/acc/acc_mod.c b/src/modules/acc/acc_mod.c
index 0b04f3e82c..27feb847db 100644
--- a/src/modules/acc/acc_mod.c
+++ b/src/modules/acc/acc_mod.c
@@ -121,6 +121,7 @@ int cdr_start_on_confirmed = 0;
int cdr_expired_dlg_enable = 0;
static char* cdr_facility_str = 0;
static char* cdr_log_extra_str = 0;
+str cdr_skip = {NULL, 0};
str cdr_start_str = str_init("start_time");
str cdr_end_str = str_init("end_time");
@@ -206,6 +207,7 @@ static param_export_t params[] = {
{"log_extra", PARAM_STRING, &log_extra_str },
/* cdr specific */
{"cdr_enable", INT_PARAM, &cdr_enable },
+ {"cdr_skip", PARAM_STR, &cdr_skip },
{"cdr_log_enable", INT_PARAM, &cdr_log_enable },
{"cdr_start_on_confirmed", INT_PARAM, &cdr_start_on_confirmed },
{"cdr_facility", PARAM_STRING, &cdr_facility_str },
diff --git a/src/modules/acc/acc_mod.h b/src/modules/acc/acc_mod.h
index a28721cdea..b25c9d4a17 100644
--- a/src/modules/acc/acc_mod.h
+++ b/src/modules/acc/acc_mod.h
@@ -53,6 +53,7 @@ extern int cdr_extra_nullable;
extern int cdr_start_on_confirmed;
extern int cdr_log_facility;
extern int cdr_expired_dlg_enable;
+extern str cdr_skip;
extern int db_flag;
extern int db_missed_flag;
diff --git a/src/modules/acc/doc/acc_admin.xml b/src/modules/acc/doc/acc_admin.xml
index f47a92a689..a990db04a4 100644
--- a/src/modules/acc/doc/acc_admin.xml
+++ b/src/modules/acc/doc/acc_admin.xml
@@ -1034,6 +1034,23 @@ modparam("acc", "db_insert_mode", 1)
...
modparam("acc", "cdr_enable", 1)
...
+</programlisting>
+ </example>
+ </section>
+ <section id="acc.p.cdr_skip">
+ <title><varname>cdr_skip</varname> (string)</title>
+ <para>
+ Skip cdr generation for dialogs with this dlg_var set.
+ </para>
+ <para>
+ Default value is NULL.
+ </para>
+ <example>
+ <title>cdr_skip example</title>
+ <programlisting format="linespecific">
+...
+modparam("acc", "cdr_skip", "nocdr")
+...
</programlisting>
</example>
</section>