Summary:ASTERISK-06208: Failed to run ResetCDR or ForkCDR when using cdr_mysql with uniqueid enabled
Reporter:Ioan Indreias (igiro)Labels:
Date Opened:2006-01-27 14:09:14.000-0600Date Closed:2011-06-07 14:02:59
Versions:Frequency of
Description:Asterisk version: CVS-Nv1-2-0-01/24/06-16:08:10

We have an small IVR application witch authenticate first the user and, if it was succesfully, it dial out. We need to know home much time the user spent in our IVR application and how much time he spent in the last "call".

We use cdr_mysql and uniqueid enabled.
We try using ResetCDR(w) or ForkCDR and the history it is the following:
1. first CDR it is OK
2. second CDR failed with the following error:
Jan 27 16:11:07 ERROR[8548] cdr_addon_mysql.c: mysql_cdr: Failed to insert into database: (1062) Duplicate entry '1138371059' for key 1

We debug into cdr sources and found that in case of using uniqueid, issuing a ResetCDR(w) or ForkCDR will try to insert a new CDR with same uniqueid (as uniqueid it is defined per channel).

Our work-arround was to disable uniqueid as been PRI key.

Please check if this it is a normal behavior and if there are any chances to keep uniqueid as PRI key.
Comments:By: Olle Johansson (oej) 2006-02-02 01:09:44.000-0600

Anyone that can repeat this bug? Any more information?


By: Sergey Basmanov (sb) 2006-02-02 07:59:17.000-0600

I have same issue. Uniqueid stays same for entire call and each cdr posted within one call will have same uniqueid. To differentiate records with same uniqueid, I just added auto_increment column to cdr table.
I think we should add some counter to uniqueid and increment it each time we post cdr.

By: Tilghman Lesher (tilghman) 2006-03-06 14:37:25.000-0600

I'm moving this to feature requests, as this is known and documented behavior.  In fact, having the same uniqueid is a feature, because it allows one to associate multiple CDRs with the same call.

Feature requests are properly placed on the Wiki, off the bugtracker.  You may reopen this issue when you have a proposed patch for changing the documented behavior, with a configuration option.