[asterisk-users] Is uniqueid/sequence a safe CDR table primary key ?

Olivier oza_4h07 at yahoo.fr
Tue Jun 4 17:47:20 CDT 2013


OK, then I'll go with linkedid, uniqueid and sequence number.

Thanks for sharing this on this list


2013/6/3 Matthew Jordan <mjordan at digium.com>

> On 06/03/2013 11:20 AM, Olivier wrote:
> > Hi,
> >
> > When dealing with CDR SQL tables, I always added an auto-incremented
> > cdr_id key as a primary key, just in case provided uniqueid key went
> wrong.
> >
> > Now I'm facing a situation where I need to insert into a database's
> > table and from the dialplan, a reference to the CDR record which is
> > currently processed.
> >
> > So my questions are:
> >
> > 1. Can uniqueid/sequence (or uniqueid/sequence/calldate) bundle be
> > safely used as CDR's table primary key  (ie I cannot have any
> > uniqueid/sequence combination from one CDR record to match a past
> > uniqueid/sequence combination) ?
>
> Possibly. Things to keep in mind:
>
> * You can run into uniqueid collisions across multiple systems if you do
> not specify a system name in asterisk.conf or do not specify a unique
> system name in asterisk.conf.
> * You can run into uniqueid collisions if your system clock goes
> backwards for any reason (the uniqueid for a channel happens to use a
> timestamp for its uniqueness)
>
> Whether or not this is unique enough will be completely dependent on
> your overall system configuration.
>
> In general, the recommended combination that *should* uniquely specify a
> CDR (when configured correctly) is linkedid (which should be enabled and
> added to your schema), uniqueid, and sequence number, with the asterisk
> system name specified.
>
> --
> Matthew Jordan
> Digium, Inc. | Engineering Manager
> 445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
> Check us out at: http://digium.com & http://asterisk.org
>
>
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>                http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20130605/25bd99ce/attachment.htm>


More information about the asterisk-users mailing list