[Asterisk-Dev] Making uniqueID unique in a multiple system environment.

Chris A. Icide chris at netgeeks.net
Sat Aug 6 12:43:43 MST 2005


Currently, uniqueid is set when a channel is created and is set to the
current timestamp and some serial number to ensure the uniqueid is
actually unique for that 1 second.  It's done in the format of
<timestamp>.<serial>.

When you use multiple asterisk servers with each server logging cdr to a
centralized storage (mysql for example), uniqueid is no longer always
unique.  It is possible and the possiblility increases to highly
probable under significant load, that you will attempt to post a cdr
which has a uniqueid that already exists in the db, thus the post will
fail, resulting in loss of the cdr entry.

If we added an entry to a config file (asterisk.conf?  or maybe general
section of extensions.conf? cdr.conf has been mentioned as well), where
we set system-id=X.  Then when a channel is created use
<system-id>.<timestamp>.<serial>, barring human error, the uniqueid
generated would be unique under a single managed system (which includes
multiple servers - think BGP/IGP for comparison).  The system-id only
needs to be unqiue for the "cluster" of servers running under a single
management structure.

I prefer using a human set serial number to maintain the form and
appearance of uniqueID as well as providing some readability and ease of
parsing should you want to parse out cdr entries based on the
system-id.  However, in chat on #asterisk MAC address and hostname were
tossed out as well.

Thoughts?

-Chris




More information about the asterisk-dev mailing list