[asterisk-dev] incorrect generation of Newchannel manager event

Russell Bryant russell at digium.com
Wed Aug 30 19:01:06 MST 2006


----- Moises Silva <moises.silva at gmail.com> wrote:
> 1. Remove the condition in ast_setstate(), and this could possibly
> break things in other situations.

I actually made this change when this bug was reported a while ago.  It was a very bad idea and created a worse problem, where the Newchannel wouldn't be generated at all in about half of the cases.

> 2. Add a new member to ast_channel structure to define when the
> channel is not new yet. So ast_setstate could check this instead of
> the "_state" member.

That is the only thing I have really thought of so far, but it just feels so dirty.  We could just use a channel flag for it.  However, this may be an acceptable hack of a fix to put in the release branch as a bug fix.

> 3. Add or use some new state to set in ast_request() instead of
> returning the channel in AST_STATE_DOWN, wich possibly would break
> things?

I don't think that's really the best idea, either.

Ideally the generation of the "Newchannel" event would be in common code that is used in *every* instance where a new channel is allocated.  The only function that really meets that criteria is ast_channel_new(), which allocates and sets up a new channel structure.  However, as it stands now, that function can not generate the event because it doesn't know the name of the new channel.  It will have to be updated to be passed that information.  This would be my preferred fix for the issue.


-- 
Russell Bryant
Software Engineer
Digium, Inc.




More information about the asterisk-dev mailing list