Index: res_config_mysql.c =================================================================== --- res_config_mysql.c (revision 220) +++ res_config_mysql.c (working copy) @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -618,7 +619,9 @@ return 0; } } else { - if(mysql_ping(&mysql) != 0) { + /* MySQL likes to return an error, even if it reconnects successfully. + * So the postman pings twice. */ + if (mysql_ping(&mysql) != 0 && mysql_ping(&mysql) != 0) { connected = 0; ast_log(LOG_ERROR, "MySQL RealTime: Failed to reconnect. Check debug for more info.\n"); ast_log(LOG_DEBUG, "MySQL RealTime: Server Error: %s\n", mysql_error(&mysql));