Roger Schreiter
2005-Nov-05 05:42 UTC
[Asterisk-Users] How uniqueids are formed - possible race conditions for linked channels?
Hi, the uniqueid obviously consists of a timestamp part and an continously incremented part, separated by a dot. The two channels of a call in most cases have the same number before the dot (timestamp) and consecutive numbers after the dot. Now I wonder, whether I can rely on that scheme. I assume, the timestamp part can be different, e.g. if between the creation of the incoming channel and the creation of the outgoing channel the system clock switches to the next second. (Or even more, if an AGI- script or anything else has consumed more time in between.) What about the part after the dot? Is it possible, that the outgoing channels gets there a higher number than the one from the incoming incremented by 1? May e.g. another incoming channel at almost exact the same time get that number instead? Thanks for some hints about that! Roger.
Stefan Reuter
2005-Nov-05 05:52 UTC
[Asterisk-Users] How uniqueids are formed - possible race conditions for linked channels?
On Sat, 2005-11-05 at 13:42 +0100, Roger Schreiter wrote:> Now I wonder, whether I can rely on that scheme. > I assume, the timestamp part can be different, e.g. > if between the creation of the incoming channel and > the creation of the outgoing channel the system clock > switches to the next second. (Or even more, if an AGI- > script or anything else has consumed more time in between.)in general you can't rely on it. It really depends on how the call is processed. Usually there are more reliable ways to determine which channels are linked, for example through the Manager API that generates Link and Unlink events. To propose the best solution we must know more about your actual use case. =Stefan