[asterisk-bugs] [Asterisk 0014035]: revision r77858 breaks 'failed'-extension functionality

Asterisk Bug Tracker noreply at bugs.digium.com
Thu Dec 11 14:07:43 CST 2008


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=14035 
====================================================================== 
Reported By:                erogoza
Assigned To:                russell
====================================================================== 
Project:                    Asterisk
Issue ID:                   14035
Category:                   Core/PBX
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     acknowledged
Asterisk Version:           SVN 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!): 77858 
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             2008-12-09 02:14 CST
Last Modified:              2008-12-11 14:07 CST
====================================================================== 
Summary:                    revision r77858 breaks 'failed'-extension
functionality
Description: 
The function 'ast_pbx_outgoing_exten()' in pbx.c offers a possibility for 
creating a fake channel "OutgoingSpoolFailed" and running the PBX on the 
extension "failed" on it. However, only the first priority of this
extension in the dialplan gets executed, then 
this fake channel gets hung up. The reason for this is the 
'ast_check_hangup()' instead of 'c->_softhangup' in 'ast_pbx_run()'.

'ast_check_hangup()' additionally checks for the presense of
'chan->tech_pvt', 
and because fake channels do not have any PVT structures associated, the
value 
of that field is NULL, which then returns 1 as a function result, which
causes 
the exit from the main loop on priorities in 'ast_pbx_run()'.

Dummy PVTs for fake channels don't seem to be the best solution as the 
following piece of code in 'ast_channel_free()' would then be executed:

if (chan->tech_pvt) {
        ast_log(LOG_WARNING, "Channel '%s' may not have been hung
up properly\n", 
chan->name);
        ast_free(chan->tech_pvt);
}

======================================================================
Relationships       ID      Summary
----------------------------------------------------------------------
related to          0010230 [patch] where possible replace uses of ...
====================================================================== 

---------------------------------------------------------------------- 
 (0096239) svnbot (reporter) - 2008-12-11 14:07
 http://bugs.digium.com/view.php?id=14035#c96239 
---------------------------------------------------------------------- 
Repository: asterisk
Revision: 163171

U   trunk/main/channel.c

------------------------------------------------------------------------
r163171 | russell | 2008-12-11 14:07:43 -0600 (Thu, 11 Dec 2008) | 16
lines

Fix the "failed" extension for outgoing calls.  

The conversion to use ast_check_hangup() everywhere instead of checking
the softhangup
flag directly introduced this problem.  The issue is that
ast_check_hangup() checked
for tech_pvt to be NULL.  Unfortunately, this will be NULL is some valid
circumstances,
such as with a dummy channel.

The fix is simple.  Don't check tech_pvt.  It's pointless, because the
code path that
sets this to NULL is when the channel hangup callback gets called.  This
happens inside
of ast_hangup(), which is the same function responsible for freeing the
channel.  Any
code calling ast_check_hangup() better not be calling it after that point,
and if so,
we have a bigger problem at hand.

(closes issue http://bugs.digium.com/view.php?id=14035)
Reported by: erogoza

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=163171 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2008-12-11 14:07 svnbot         Checkin                                      
2008-12-11 14:07 svnbot         Note Added: 0096239                          
======================================================================




More information about the asterisk-bugs mailing list