[asterisk-dev] implementing struct ast_channel with astobj2 ?

Russell Bryant russell at digium.com
Thu Nov 15 18:55:37 CST 2007

Luigi Rizzo wrote:
> is there any work going on for implementing struct ast_channel with astobj2?

I started it, and made it pretty far.  The code is located in:


Most of the work was ...

 - reimplemented the channel list walking functions and the channel find
functions to work with the ao2 container.
 - gone through and updated all of the code to the new API

However, I did not make it into the channel drivers.  (Well, it looks like I
started to mess with chan_sip, but the code should probably be removed.)

Today, all channel drivers store references to channels.  However, it is the
channel hangup process that ensures that these references are erased before the
channel goes away.  The code in this branch continues to make the same
assumptions.  So, the next thing I needed to do was to try to document which
parts of the code don't currently change the channel reference count, because
they make some other assumption about making sure the reference is erased before
the channel goes away.

Of course, you could in some cases, such as the one you were dealing with in
your console video code, increase the channel reference count.  It just needs to
be clear in what places we do mess with the refcount, and which places we don't,
and why.

Also, unfortunately, the branch is currently out of date.  But, you should be
able to take a look at what I had done with ...

$ R=http://svn.digium.com/svn/asterisk

$ svn pg svnmerge-integrated $R/team/russell/chan_refcount

$ svn diff $R/trunk at 85454 $R/team/russell/chan_refcount > chan_refcount.diff

Russell Bryant
Senior Software Engineer
Open Source Team Lead
Digium, Inc.

More information about the asterisk-dev mailing list