[Home]

Summary:ASTERISK-19216: cdr_pgsql reload failure
Reporter:Jacek Konieczny (jkonieczny)Labels:
Date Opened:2012-01-19 01:48:05.000-0600Date Closed:2012-02-07 09:10:19.000-0600
Priority:MajorRegression?
Status:Closed/CompleteComponents:CDR/cdr_pgsql
Versions:1.8.7.2 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Attachments:
Description:When reloading the cdr_pgsql module after a configuration file is modified the configuration seems to be added to the current one instead of replacing it, which causes a big failure.

To reproduce:
1. Start asterisk, with cdr_pgsql configured
2. touch /etc/asterisk/cdr_pgsql.conf
3. Try to reload it:

pbx6*CLI> module reload cdr_pgsql.so
   -- Reloading module 'cdr_pgsql.so' (PostgreSQL CDR Backend)
 == Parsing '/etc/asterisk/cdr_pgsql.conf':   == Found
[Jan 19 08:40:14] WARNING[3025]: cdr_pgsql.c:473 config_module: Encoding not specified.  Assuming LATIN9
      > Found column 'calldate' of type 'timestamptz'
      > Found column 'clid' of type 'varchar'
      > Found column 'src' of type 'varchar'
      > Found column 'dst' of type 'varchar'
      > Found column 'dcontext' of type 'varchar'
      > Found column 'channel' of type 'varchar'
      > Found column 'dstchannel' of type 'varchar'
      > Found column 'lastapp' of type 'varchar'
      > Found column 'lastdata' of type 'varchar'
      > Found column 'duration' of type 'int8'
      > Found column 'billsec' of type 'int8'
      > Found column 'disposition' of type 'varchar'
      > Found column 'amaflags' of type 'int8'
      > Found column 'accountcode' of type 'varchar'
      > Found column 'uniqueid' of type 'varchar'
      > Found column 'userfield' of type 'varchar'
[Jan 19 08:40:14] WARNING[3025]: cdr.c:140 ast_cdr_register: Already have a CDR backend called 'pgsql'

4. See what happens when a call is to be logged:

pbx6*CLI> cdr submit
Submitted CDRs to backend engines for processing.  This may take a while.
      > [INSERT INTO cdr ("calldate","clid","src","dst","dcontext","channel","dstchannel","lastapp","lastdata","duration","billsec","disposition","amaflags","uniqueid","userfield","calldate","clid","src","dst","dcontext","channel","dstchannel","lastapp","lastdata","duration","billsec","disposition","amaflags","uniqueid","userfield") VALUES ('2012-01-19 08:46:45','"phone 301" <phone_u215e>','phone_u215e','s','sub-dial','SIP/u215e-00000000','SIP/w7tny-00000001','Dial','SIP/w7tny,50,U(sub-dialparties-callee)',6,3,'ANSWERED',3,'1326959205.0','pbx:4c42b049-9d2e-445c-96ba-24ec96adf080,cu:301,','2012-01-19 08:46:45','"phone 301" <phone_u215e>','phone_u215e','s','sub-dial','SIP/u215e-00000000','SIP/w7tny-00000001','Dial','SIP/w7tny,50,U(sub-dialparties-callee)',6,3,'ANSWERED',3,'1326959205.0','pbx:4c42b049-9d2e-445c-96ba-24ec96adf080,cu:301,')]
[Jan 19 08:46:56] ERROR[3346]: cdr_pgsql.c:308 pgsql_log: Failed to insert call detail record into database!
[Jan 19 08:46:56] ERROR[3346]: cdr_pgsql.c:309 pgsql_log: Reason: ERROR:  column "calldate" specified more than once
LINE 1: ...","disposition","amaflags","uniqueid","userfield","calldate"...
                                                            ^

[Jan 19 08:46:56] ERROR[3346]: cdr_pgsql.c:310 pgsql_log: Connection may have been lost... attempting to reconnect.
[Jan 19 08:46:56] ERROR[3346]: cdr_pgsql.c:313 pgsql_log: Connection reestablished.
[Jan 19 08:46:56] ERROR[3346]: cdr_pgsql.c:319 pgsql_log: HARD ERROR!  Attempted reconnection failed.  DROPPING CALL RECORD!
[Jan 19 08:46:56] ERROR[3346]: cdr_pgsql.c:320 pgsql_log: Reason: ERROR:  column "calldate" specified more than once
LINE 1: ...","disposition","amaflags","uniqueid","userfield","calldate"...
Comments: