Posted: Mon May 18, 2009 6:13 pm Post subject: [asterisk-dev] channel name uniqueness
Hi,
I have a question about the channel name. Specifically, is it guaranteed
to be unique? The reason I'm asking is because sip channels use the
pointer to their private block in their channel name, but that only
ensures uniqueness if asterisk is compiled 32 bit.
--
Paul Albrecht
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
Posted: Mon May 18, 2009 8:02 pm Post subject: [asterisk-dev] channel name uniqueness
Paul Albrecht wrote:
Quote:
I have a question about the channel name. Specifically, is it guaranteed
to be unique? The reason I'm asking is because sip channels use the
pointer to their private block in their channel name, but that only
ensures uniqueness if asterisk is compiled 32 bit.
Channel names are not guaranteed to be unique throughout system
lifetime. There will (should!) never be more than one channel with the
same name at the same time, though.
The unique ID field on a channel is what uniquely identifies it from
others that had the same name. The unique ID field is a monotonically
increasing integer, a timestamp, and optionally, a system name.
--
Russell Bryant
Digium, Inc. | Senior Software Engineer, Open Source Team Lead
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: www.digium.com & www.asterisk.org
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
Posted: Mon May 18, 2009 8:23 pm Post subject: [asterisk-dev] channel name uniqueness
On Mon, 2009-05-18 at 15:39 -0500, Russell Bryant wrote:
Quote:
Paul Albrecht wrote:
> I have a question about the channel name. Specifically, is it guaranteed
> to be unique? The reason I'm asking is because sip channels use the
> pointer to their private block in their channel name, but that only
> ensures uniqueness if asterisk is compiled 32 bit.
Channel names are not guaranteed to be unique throughout system
lifetime. There will (should!) never be more than one channel with the
same name at the same time, though.
The unique ID field on a channel is what uniquely identifies it from
others that had the same name. The unique ID field is a monotonically
increasing integer, a timestamp, and optionally, a system name.
Hmmm, ... what about the "ASCII unique channel name", is it unique? For
sip channels, it's set in sip_new by calling ast_channel_alloc with
format string "SIP/%s-%08x", where the the string is a host address and
the number is a 32 bit pointer to the channel's private data pointer.
--
Paul Albrecht
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
Posted: Mon May 18, 2009 8:29 pm Post subject: [asterisk-dev] channel name uniqueness
Paul Albrecht wrote:
Quote:
On Mon, 2009-05-18 at 15:39 -0500, Russell Bryant wrote:
> Paul Albrecht wrote:
>> I have a question about the channel name. Specifically, is it guaranteed
>> to be unique? The reason I'm asking is because sip channels use the
>> pointer to their private block in their channel name, but that only
>> ensures uniqueness if asterisk is compiled 32 bit.
> Channel names are not guaranteed to be unique throughout system
> lifetime. There will (should!) never be more than one channel with the
> same name at the same time, though.
>
> The unique ID field on a channel is what uniquely identifies it from
> others that had the same name. The unique ID field is a monotonically
> increasing integer, a timestamp, and optionally, a system name.
>
Hmmm, ... what about the "ASCII unique channel name", is it unique? For
sip channels, it's set in sip_new by calling ast_channel_alloc with
format string "SIP/%s-%08x", where the the string is a host address and
the number is a 32 bit pointer to the channel's private data pointer.
Right, so, that will be unique across _current_ channels. However,
after one channel is gone, it is conceivable that another with the same
name will get created.
--
Russell Bryant
Digium, Inc. | Senior Software Engineer, Open Source Team Lead
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: www.digium.com & www.asterisk.org
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
Posted: Mon May 18, 2009 9:51 pm Post subject: [asterisk-dev] channel name uniqueness
On Mon, 2009-05-18 at 16:18 -0500, Russell Bryant wrote:
Quote:
Paul Albrecht wrote:
> On Mon, 2009-05-18 at 15:39 -0500, Russell Bryant wrote:
>> Paul Albrecht wrote:
>>> I have a question about the channel name. Specifically, is it guaranteed
>>> to be unique? The reason I'm asking is because sip channels use the
>>> pointer to their private block in their channel name, but that only
>>> ensures uniqueness if asterisk is compiled 32 bit.
>> Channel names are not guaranteed to be unique throughout system
>> lifetime. There will (should!) never be more than one channel with the
>> same name at the same time, though.
>>
>> The unique ID field on a channel is what uniquely identifies it from
>> others that had the same name. The unique ID field is a monotonically
>> increasing integer, a timestamp, and optionally, a system name.
>>
>
> Hmmm, ... what about the "ASCII unique channel name", is it unique? For
> sip channels, it's set in sip_new by calling ast_channel_alloc with
> format string "SIP/%s-%08x", where the the string is a host address and
> the number is a 32 bit pointer to the channel's private data pointer.
Right, so, that will be unique across _current_ channels. However,
after one channel is gone, it is conceivable that another with the same
name will get created.
The names of the active sip channels are guaranteed to be unique only if
asterisk data pointers are 32 bits, that is, asterisk is compiled on a
32 bit system. If, on the other hand, asterisk is compiled on a 64 bit
system, pointers are 64 bits so that a 32 bit data pointer is ambiguous
because heap is allocated both above and below 4 gigabytes.
--
Paul Albrecht
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
Posted: Mon May 18, 2009 11:15 pm Post subject: [asterisk-dev] channel name uniqueness
Is this not a serious bug for us 64 bit users???
F.Alves
-----Original Message-----
From: asterisk-dev-bounces@lists.digium.com
[mailto:asterisk-dev-bounces@lists.digium.com] On Behalf Of paul@glccom.com
Sent: Monday, May 18, 2009 6:39 PM
To: Asterisk Developers Mailing List
Subject: Re: [asterisk-dev] channel name uniqueness
On Mon, 2009-05-18 at 16:18 -0500, Russell Bryant wrote:
Quote:
Paul Albrecht wrote:
> On Mon, 2009-05-18 at 15:39 -0500, Russell Bryant wrote:
>> Paul Albrecht wrote:
>>> I have a question about the channel name. Specifically, is it
guaranteed
Quote:
>>> to be unique? The reason I'm asking is because sip channels use the
>>> pointer to their private block in their channel name, but that only
>>> ensures uniqueness if asterisk is compiled 32 bit.
>> Channel names are not guaranteed to be unique throughout system
>> lifetime. There will (should!) never be more than one channel with the
>> same name at the same time, though.
>>
>> The unique ID field on a channel is what uniquely identifies it from
>> others that had the same name. The unique ID field is a monotonically
>> increasing integer, a timestamp, and optionally, a system name.
>>
>
> Hmmm, ... what about the "ASCII unique channel name", is it unique? For
> sip channels, it's set in sip_new by calling ast_channel_alloc with
> format string "SIP/%s-%08x", where the the string is a host address and
> the number is a 32 bit pointer to the channel's private data pointer.
Right, so, that will be unique across _current_ channels. However,
after one channel is gone, it is conceivable that another with the same
name will get created.
The names of the active sip channels are guaranteed to be unique only if
asterisk data pointers are 32 bits, that is, asterisk is compiled on a
32 bit system. If, on the other hand, asterisk is compiled on a 64 bit
system, pointers are 64 bits so that a 32 bit data pointer is ambiguous
because heap is allocated both above and below 4 gigabytes.
--
Paul Albrecht
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
Posted: Tue May 19, 2009 5:57 am Post subject: [asterisk-dev] channel name uniqueness
18 maj 2009 kl. 22.39 skrev Russell Bryant:
Quote:
Paul Albrecht wrote:
> I have a question about the channel name. Specifically, is it
> guaranteed
> to be unique? The reason I'm asking is because sip channels use the
> pointer to their private block in their channel name, but that only
> ensures uniqueness if asterisk is compiled 32 bit.
Channel names are not guaranteed to be unique throughout system
lifetime. There will (should!) never be more than one channel with
the
same name at the same time, though.
The unique ID field on a channel is what uniquely identifies it from
others that had the same name. The unique ID field is a monotonically
increasing integer, a timestamp, and optionally, a system name.
We should propably add some documentation on channel name and UniqueID
uniqueness to Doxygen docs...
/O
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
The names of the active sip channels are guaranteed to be unique
only if
asterisk data pointers are 32 bits, that is, asterisk is compiled on a
32 bit system. If, on the other hand, asterisk is compiled on a 64 bit
system, pointers are 64 bits so that a 32 bit data pointer is
ambiguous
because heap is allocated both above and below 4 gigabytes.
Yes, you are correct. I'm sorry for missing what you were saying the
first time. So, while it seems like running into this problem would
be very unlikely, it is a bug that we need to address.
It would be excellent if you could post this to issues.asterisk.org.
--
Russell Bryant
Digium, Inc. | Senior Software Engineer, Open Source Team Lead
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: www.digium.com & www.asterisk.org
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
>
> The names of the active sip channels are guaranteed to be unique
> only if
> asterisk data pointers are 32 bits, that is, asterisk is compiled on a
> 32 bit system. If, on the other hand, asterisk is compiled on a 64 bit
> system, pointers are 64 bits so that a 32 bit data pointer is
> ambiguous
> because heap is allocated both above and below 4 gigabytes.
Yes, you are correct. I'm sorry for missing what you were saying the
first time. So, while it seems like running into this problem would
be very unlikely, it is a bug that we need to address.
It would be excellent if you could post this to issues.asterisk.org.
OK, I'll add this to asterisk's issue tracker ... I have another
question about the channel name: Given a channel name, how do I, a
module writer, efficiently find the corresponding channel address? The
reason I'm asking is because I know I could use "channel_find_locked",
but I'd like to avoid a linear search over all active channels.
Quote:
--
Russell Bryant
Digium, Inc. | Senior Software Engineer, Open Source Team Lead
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: www.digium.com & www.asterisk.org
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
Posted: Wed May 20, 2009 2:59 pm Post subject: [asterisk-dev] channel name uniqueness
On Mon, May 18, 2009 at 3:39 PM, Russell Bryant <russell@digium.com (russell@digium.com)> wrote:
Quote:
The unique ID field on a channel is what uniquely identifies it from
others that had the same name. Â The unique ID field is a monotonically
increasing integer, a timestamp, and optionally, a system name.
I did recently notice that the unique ID isn't copied during a channel masq and had been wondering if that was intentional. For what I was doing, it would have been much more convenient if it did copy. The way it is now, the same channel name (e.g. SIP/foo-xxxx), representing the same actual call leg, will change uniqueid's (because it isn't copied into the channel struct on masq) during the lifetime of the call if certain events happen.
Is that on purpose or an oversite? If it's intentional, you might want to add that quirk to the documentation.
Posted: Wed May 20, 2009 3:42 pm Post subject: [asterisk-dev] channel name uniqueness
On Wed, May 20, 2009 at 6:50 PM, Tim Ringenbach
<tim.ringenbach@gmail.com> wrote:
Quote:
On Mon, May 18, 2009 at 3:39 PM, Russell Bryant <russell@digium.com> wrote:
>
> The unique ID field on a channel is what uniquely identifies it from
> others that had the same name. The unique ID field is a monotonically
> increasing integer, a timestamp, and optionally, a system name.
>
I did recently notice that the unique ID isn't copied during a channel masq
and had been wondering if that was intentional. For what I was doing, it
would have been much more convenient if it did copy. The way it is now, the
same channel name (e.g. SIP/foo-xxxx), representing the same actual call
leg, will change uniqueid's (because it isn't copied into the channel struct
on masq) during the lifetime of the call if certain events happen.
Is that on purpose or an oversite? If it's intentional, you might want to
add that quirk to the documentation.
That's exactly how it was designed.
There is going to be LinkedID soon (perhaps it's already merged in
some 1.6.x branch), that will basically be uniqueid of first channel
for a call. For now, You can just do
if ("${call_id}"="") Set(__call_id=${UNIQUEID});
Regards,
Atis
Quote:
--Tim
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
Posted: Wed May 20, 2009 3:46 pm Post subject: [asterisk-dev] channel name uniqueness
Tim Ringenbach wrote:
Quote:
On Mon, May 18, 2009 at 3:39 PM, Russell Bryant <russell@digium.com> wrote:
> The unique ID field on a channel is what uniquely identifies it from
> others that had the same name. The unique ID field is a monotonically
> increasing integer, a timestamp, and optionally, a system name.
>
>
I did recently notice that the unique ID isn't copied during a channel masq
and had been wondering if that was intentional. For what I was doing, it
would have been much more convenient if it did copy. The way it is now, the
same channel name (e.g. SIP/foo-xxxx), representing the same actual call
leg, will change uniqueid's (because it isn't copied into the channel struct
on masq) during the lifetime of the call if certain events happen.
Is that on purpose or an oversite? If it's intentional, you might want to
add that quirk to the documentation.
It is a quirk, for sure. I can't say if it was really intentional, as
it was done long before my time in this code.
However, at this point, since it has been that way for _so_ long, I
would be very concerned about breaking applications if we made the
change. So, for now, I think we have to live with it as a quirk.
If someone wanted to make it an option that is off by default, then I
could live with that.
--
Russell Bryant
Digium, Inc. | Senior Software Engineer, Open Source Team Lead
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: www.digium.com & www.asterisk.org
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
Posted: Wed May 20, 2009 3:51 pm Post subject: [asterisk-dev] channel name uniqueness
In article <36a74c840905200850x5cebfe22xdfa1b2d0bfbba0d@mail.gmail.com>,
Tim Ringenbach <tim.ringenbach@gmail.com> wrote:
Quote:
On Mon, May 18, 2009 at 3:39 PM, Russell Bryant <russell@digium.com> wrote:
> The unique ID field on a channel is what uniquely identifies it from
> others that had the same name. The unique ID field is a monotonically
> increasing integer, a timestamp, and optionally, a system name.
>
>
I did recently notice that the unique ID isn't copied during a channel masq
and had been wondering if that was intentional. For what I was doing, it
would have been much more convenient if it did copy. The way it is now, the
same channel name (e.g. SIP/foo-xxxx), representing the same actual call
leg, will change uniqueid's (because it isn't copied into the channel struct
on masq) during the lifetime of the call if certain events happen.
Is that on purpose or an oversite? If it's intentional, you might want to
add that quirk to the documentation.
It's not an oversight. The start and end channels of a masquerade are
different channel instances, and are distinguished precisely by having
different Unique IDs. Take a look at the events on the Manager interface
when a masq is happening. If the unique ID got copied across, it would
be impossible to distinguish between the hangup of the old channel at
the completion of the masq and the hangup of the new channel later on.
Posted: Wed May 20, 2009 4:25 pm Post subject: [asterisk-dev] channel name uniqueness
On Wed, May 20, 2009 at 11:33 AM, Atis Lezdins <atis@iq-labs.net (atis@iq-labs.net)> wrote:
Quote:
That's exactly how it was designed.
There is going to be LinkedID soon (perhaps it's already merged in
some 1.6.x branch), that will basically be uniqueid of first channel
for a call. For now, You can just do
if ("${call_id}"="") Set(__call_id=${UNIQUEID});
LinkedID isn't really the same thing though, it serves a different purpose. Consider that what you said can't even be done (in the dialplan anyway) on a channel not in the dialplan. The LinkID is for figuring out which channel created which other channels. It doesn't uniquely identify a channel. But nothing does because even it's uniqueid can change.
Now there are some cases where it's sort of nice that the uniqueid doesn't change. Consider following queue events where an attended transfer completes after the join but before the connect. But if you were trying to track a certain channel by unqueid id, well the uniqueid changing is certainly going to cause you problems.
And Rename events don't do much to help really. Lets say you were logging certain events to a database. Image trying to do a sql join between two events based on their unqiueid, but they had multiple unqiue id's over the lifetime of the call, so you have to somehow factor in that it's uniqueid was X if the timestamp is between Y and Z, but it's A if the timestamp is because B and C.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum