|
|
|
@ -118,6 +118,7 @@ static int pgsql_log(struct ast_cdr *cdr)
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (option_debug > 1)
|
|
|
|
|
ast_log(LOG_DEBUG, "cdr_pgsql: inserting a CDR record.\n");
|
|
|
|
|
|
|
|
|
|
snprintf(sqlcmd,sizeof(sqlcmd),"INSERT INTO %s (calldate,clid,src,dst,dcontext,channel,dstchannel,"
|
|
|
|
@ -126,6 +127,7 @@ static int pgsql_log(struct ast_cdr *cdr)
|
|
|
|
|
table,timestr,clid,cdr->src, cdr->dst, dcontext,channel, dstchannel, lastapp, lastdata,
|
|
|
|
|
cdr->duration,cdr->billsec,ast_cdr_disp2str(cdr->disposition),cdr->amaflags, cdr->accountcode, uniqueid, userfield);
|
|
|
|
|
|
|
|
|
|
if (option_debug > 2)
|
|
|
|
|
ast_log(LOG_DEBUG, "cdr_pgsql: SQL command executed: %s\n",sqlcmd);
|
|
|
|
|
|
|
|
|
|
/* Test to be sure we're still connected... */
|
|
|
|
@ -280,6 +282,7 @@ static int process_my_load_module(struct ast_config *cfg)
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (option_debug) {
|
|
|
|
|
ast_log(LOG_DEBUG, "cdr_pgsql: got hostname of %s\n", pghostname);
|
|
|
|
|
ast_log(LOG_DEBUG, "cdr_pgsql: got port of %s\n", pgdbport);
|
|
|
|
|
if (pgdbsock)
|
|
|
|
@ -288,9 +291,11 @@ static int process_my_load_module(struct ast_config *cfg)
|
|
|
|
|
ast_log(LOG_DEBUG, "cdr_pgsql: got dbname of %s\n", pgdbname);
|
|
|
|
|
ast_log(LOG_DEBUG, "cdr_pgsql: got password of %s\n", pgpassword);
|
|
|
|
|
ast_log(LOG_DEBUG, "cdr_pgsql: got sql table name of %s\n", table);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
conn = PQsetdbLogin(pghostname, pgdbport, NULL, NULL, pgdbname, pgdbuser, pgpassword);
|
|
|
|
|
if (PQstatus(conn) != CONNECTION_BAD) {
|
|
|
|
|
if (option_debug)
|
|
|
|
|
ast_log(LOG_DEBUG, "Successfully connected to PostgreSQL database.\n");
|
|
|
|
|
connected = 1;
|
|
|
|
|
} else {
|
|
|
|
|