[asterisk-dev] asterisk 10 & softhangup
rmudgett at digium.com
Fri Feb 15 13:37:56 CST 2013
> On Feb 15, 2013, at 12:10 PM, Richard Mudgett <rmudgett at digium.com>
> >> On Feb 15, 2013, at 11:41 AM, Richard Mudgett
> >> <rmudgett at digium.com>
> >> wrote:
> >>>> I noticed a change in ast_softhangup after moving to asterisk
> >>>> 10.
> >>>> Now
> >>>> asterisk doesn't continue to the next priority after a soft
> >>>> hangup
> >>>> which doesn't make much sense. Is this an feature or bug?
> >>> Either svn revisions
> >>> -r190423 Changes channels to ref counted objects
> >>> -r225244 Add support for OBJ_MULTIPLE
> >>> Causes the issue. The app does not continue in the dialplan if
> >>> no
> >>> channels are found to hangup or there was a memory allocation
> >>> error.
> >>> Its a bug.
> >> That's what I thought. What about ast_channel_clear_softhangup?
> >> Why
> >> does it need to go through the readq?
> >> The only thing ast_softhangup queues is a null frame and I thought
> >> they're supposed to be ignored.
> > There is a comment in ast_channel_clear_softhangup() that says why.
> > There is another comment in __ast_read() where the
> > AST_CONTROL_END_OF_Q
> > control frame is put in the read queue that gives even more
> > information.
> > Basically, when ast_read() sees a hangup, there may be pending
> > frames
> > in the read queue so it puts a control frame in the read queue to
> > know
> > when all pending frames have been read and to block any more frames
> > from being put on the read queue. ast_read() will then return a
> > NULL
> > to indicate a hangup.
> I don't see why the control frame is needed. The application waiting
> on its read wakes up when the null frame queued by ast_softhangup is
> received. The application read fails in asterisk ast_read because
> the channel indicates a soft hangup. The applications finishes
> whatever it's doing, returns, and control goes back to the pbx to
> select the next application to run.
There is more than one source of frames. There may be other frames pending
before ast_softhangup is called. The end-of-q frame is needed to prevent
anymore frames from being queued so the application can finish up and end
the call. That is why.
More information about the asterisk-dev