[13.1, postgres 9.5] cdr_pgsql: INSERT of record fails due to empty string instead of proper timestamp for $answer when disposition = 'NO ANSWER'

When a call is assigned the disposition NO ANSWER, cdr_pgsql wants to insert an empty string ‘’ into the column $answer, which has the type. ‘timestamp with time zone’. This fails like so:

pgsql_log: Reason: ERROR: invalid input syntax for type timestamp with time zone: LINE 1: ...nkedid","sequence") VALUES ('2016-06-23 13:01:37','','2016-0...
snip
HARD ERROR! Attempted reconnection failed. DROPPING CALL RECORD!

Setting a default value for the answer column doesn’t work because the value is not null but an empty string.

I wonder if there’s a solution short of adding a BEFORE INSERT trigger to the database and sanitize to get cdr_pgsql to insert clean records into the database; after all what it is doing just doesn’t work in pgsql?

Asterisk 1.8 did handle this properly by inserting a ‘1970-01-01 09:00:00+09’-like timestamp instead of ‘’ (I’m porting a configuration from 1.8 to 13.1 right now) – perhaps it’s a regression? After reading through the documentation, I didn’t find anything that concerns itself with this. Calls with a disposition of ANSWERED get a proper timestamp value and insert cleanly.

I’d suggest filing an issue[1] with details as this should not have changed.

[1] https://issues.asterisk.org/jira

Submitted a bug report here: https://issues.asterisk.org/jira/browse/ASTERISK-26146.

Any new commnents and test results I will only report there.

Responded, I apparently glossed over the fact you were on 13.1. That’s an incredibly old version and one we can’t support, as substantial changes have happened over time.

I see. Given that Ubuntu"s stuff is considered garbage and backporting from Debian Sid against Xenial doesn’t work because of obsolete Xenial userland, I need to prepare the 13.9 sources for our deployment system first.

I will update the bug report with the news about 13.9 next week.