diff --git a/lib/srdb1/schema/acc_cdrs.xml b/lib/srdb1/schema/acc_cdrs.xml index 22cba14416a..84bb678fa98 100644 --- a/lib/srdb1/schema/acc_cdrs.xml +++ b/lib/srdb1/schema/acc_cdrs.xml @@ -9,7 +9,7 @@ acc_cdrs - 1 + 2&MYSQL_TABLE_TYPE; This table is used by the ACC module to report on CDRs relying on dialog callbacks. More information is available at: &KAMAILIO_MOD_DOC;acc.html @@ -28,24 +28,22 @@ start_time - string - 32 - Start time + datetime + Start date and time end_time - string - 32 - End time + datetime + End date and time duration - string - 32 + float + 10,3 Duration diff --git a/modules/acc/acc_api.h b/modules/acc/acc_api.h index f2efbe40292..f252b589582 100644 --- a/modules/acc/acc_api.h +++ b/modules/acc/acc_api.h @@ -110,7 +110,7 @@ typedef struct acc_engine { #define ACC_CORE_LEN 6 -enum {TYPE_NULL = 0, TYPE_INT, TYPE_STR}; +enum {TYPE_NULL = 0, TYPE_INT, TYPE_STR, TYPE_DOUBLE, TYPE_DATE}; typedef int (*register_engine_f)(acc_engine_t *eng); diff --git a/modules/acc/acc_cdr.c b/modules/acc/acc_cdr.c index d01beb96f62..845fc126228 100644 --- a/modules/acc/acc_cdr.c +++ b/modules/acc/acc_cdr.c @@ -90,6 +90,8 @@ extern str acc_cdrs_table; extern int cdr_log_enable; extern int _acc_cdr_on_failed; +static int string2time( str* time_str, struct timeval* time_value); + /* write all basic information to buffers(e.g. start-time ...) */ static int cdr_core2strar( struct dlg_cell* dlg, str* values, @@ -111,13 +113,13 @@ static int cdr_core2strar( struct dlg_cell* dlg, duration = dlgb.get_dlg_var( dlg, (str*)&cdr_duration_str); values[0] = ( start != NULL ? *start : empty_string); - types[0] = ( start != NULL ? TYPE_STR : TYPE_NULL); + types[0] = ( start != NULL ? TYPE_DATE : TYPE_NULL); values[1] = ( end != NULL ? *end : empty_string); - types[1] = ( end != NULL ? TYPE_STR : TYPE_NULL); + types[1] = ( end != NULL ? TYPE_DATE : TYPE_NULL); values[2] = ( duration != NULL ? *duration : empty_string); - types[2] = ( duration != NULL ? TYPE_STR : TYPE_NULL); + types[2] = ( duration != NULL ? TYPE_DOUBLE : TYPE_NULL); return MAX_CDR_CORE; } @@ -138,6 +140,10 @@ static int db_write_cdr( struct dlg_cell* dialog, db1_con_t *dh=NULL; void *vf=NULL; void *vh=NULL; + struct timeval timeval_val; + long long_val; + double double_val; + char * end; if(acc_cdrs_table.len<=0) return 0; @@ -157,9 +163,45 @@ static int db_write_cdr( struct dlg_cell* dialog, for(i=0; i