--- asterisk/res/res_config_pgsql.c 2006-09-04 15:20:36.000000000 +0400 +++ res_config_pgsql.c 2006-09-15 01:37:34.589591491 +0400 @@ -729,7 +729,7 @@ free(connInfo); connInfo = NULL; ast_log(LOG_DEBUG, "pgsqlConn=%p\n", pgsqlConn); - if (pgsqlConn) { + if (PQstatus(pgsqlConn) == CONNECTION_OK) { ast_log(LOG_DEBUG, "Postgresql RealTime: Successfully connected to database.\n"); connect_time = time(NULL); return 1; @@ -785,6 +785,8 @@ return RESULT_SUCCESS; } else { + + ast_cli(fd, "Postgresql RealTime: Not connected to database.\n"); return RESULT_FAILURE; } }