Index: configs/cdr_mysql.conf.sample =================================================================== --- configs/cdr_mysql.conf.sample (revision 1132) +++ configs/cdr_mysql.conf.sample (working copy) @@ -22,6 +22,9 @@ ; If you need your CDRs recorded in GMT instead of local time ;usegmtime=yes ; +; If you want to write ENUM fields in the database in integer format +;intenum=yes +; ; If your system's locale differs from mysql database character set, ; cdr_mysql can damage non-latin characters in CDR variables. Use this ; option to protect your data. Index: cdr/cdr_addon_mysql.c =================================================================== --- cdr/cdr_addon_mysql.c (revision 1132) +++ cdr/cdr_addon_mysql.c (working copy) @@ -77,6 +77,7 @@ static int timeout = 0; static int calldate_compat = 0; static int usegmtime = 0; +static int useintenum = 0; AST_MUTEX_DEFINE_STATIC(mysql_lock); @@ -276,6 +277,7 @@ !strcmp(cdrname, "disposition") || !strcmp(cdrname, "amaflags")) && (strstr(entry->type, "int") || + (useintenum && strstr(entry->type, "enum")) || /* Use INT-style Enums for DB writes - see #15170 */ strstr(entry->type, "dec") || strstr(entry->type, "float") || strstr(entry->type, "double") || @@ -406,6 +408,7 @@ char *temp; struct ast_str *compat; struct ast_str *gmtime; + struct ast_str *intenum; MYSQL_ROW row; MYSQL_RES *result; char sqldesc[128]; @@ -443,6 +446,7 @@ res |= my_load_config_string(cfg, "global", "table", &dbtable, "cdr"); res |= my_load_config_string(cfg, "global", "password", &password, ""); res |= my_load_config_string(cfg, "global", "usegmtime", &gmtime, "no"); + res |= my_load_config_string(cfg, "global", "intenum", &intenum, "no"); res |= my_load_config_string(cfg, "global", "charset", &dbcharset, ""); @@ -465,6 +469,12 @@ usegmtime = 0; } + if (ast_true(intenum->str)) { + useintenum = 1; + } else { + useintenum = 0; + } + if (res < 0) { if (reload) { AST_RWLIST_UNLOCK(&columns);