[asterisk-dev] Is ast_channel->uniqueid really unique ?

Tzafrir Cohen tzafrir.cohen at xorcom.com
Mon Jan 22 14:03:31 MST 2007


On Mon, Jan 22, 2007 at 12:45:10PM +0200, Oded Arbel wrote:
> 
> >From what I understand, the uniqueid field in the ast_channel is unique
> for a single installation of Asterisk, and is composed of the unix
> timestamp at the creation of the channel plus some running counter. 
> 
> The problem I'm having, is that I don't think that a channel's uniqueid
> is unique across multiple Asterisk installations - under some very
> common behaviors of a multiple Asterisk installation, some channels
> created on different Asterisk instances will have the same uniqueid.
> 
> I'm thinking about changing the uniqueid generation algorithm to
> something that generates ids that have a high statistical probability to
> be unique across multiple instances of Asterisk given some reasonable
> assumptions (for example - that there are less then a few thousands of
> Asterisk instances to be considered). I'm not looking for a truly
> globally unique identifier, just unique enough.

So you assume you have up to 2^10 -- 2^16 servers in the network. So in
order to avoid frequent collisions, the identfier will have to be in a
range of at least 2^20 -- 2^32 numbers (depending on your assumption).

How can you tell when the "unique" ID is the same on two servers?

> 
> Do you think that this is doable/interesting/good idea ?

An ipv4 address might have been a nice identifier, if you can actually
assume all hosts share the same IPv4 namespace. However you have to
consider NAT, that may segment your namespace, and IPv6, that uses 128
bits.

-- 
               Tzafrir Cohen       
icq#16849755                    jabber:tzafrir at jabber.org
+972-50-7952406           mailto:tzafrir.cohen at xorcom.com       
http://www.xorcom.com  iax:guest at local.xorcom.com/tzafrir


More information about the asterisk-dev mailing list