--- cdr_addon_mysql_orig.c 2007-03-31 10:14:26.000000000 +0200 +++ cdr_addon_mysql.c 2007-03-31 11:22:59.000000000 +0200 @@ -151,7 +151,7 @@ if ((error = mysql_ping(&mysql))) { connected = 0; records = 0; - switch (error) { + switch (mysql_errno(&mysql)) { case CR_SERVER_GONE_ERROR: case CR_SERVER_LOST: ast_log(LOG_ERROR, "cdr_mysql: Server has gone away. Attempting to reconnect.\n");