[asterisk-bugs] [Asterisk 0015671]: Stuck channel using FEATD_MF if caller hangs up at the right time

Asterisk Bug Tracker noreply at bugs.digium.com
Thu Aug 6 21:29:14 CDT 2009


The following issue has been SUBMITTED. 
====================================================================== 
https://issues.asterisk.org/view.php?id=15671 
====================================================================== 
Reported By:                jcromes
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   15671
Category:                   Channels/chan_dahdi
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
Asterisk Version:           1.4.26 
Regression:                 No 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2009-08-06 21:29 CDT
Last Modified:              2009-08-06 21:29 CDT
====================================================================== 
Summary:                    Stuck channel using FEATD_MF if caller hangs up at
the right time
Description: 
CentOS 5.2 x86_64
Asterisk 1.4.26
Zaptel 1.4.12.1
Digium TE412P 

This box's purpose is to be a conferencing server, so it takes almost
entirely inbound calls.  All 4 spans of my TE412P are configured as
FEATD_MF, and are connected to a Nortel DMS-100 switch.  (I can't do PRI.) 
The system has worked great for quite a long time, except every once in a
while, a channel would get stuck in "Ring" state. For example:

>> show channels
Channel       Location        State    Application(Data)     
Zap/77-1      s at tdma:1        Ring     (None)               
1 active channel
0 active calls 

The DMS-100 would show this channel "idle" while it was stuck in Asterisk.
It would remain stuck like this permanently until I restarted Asterisk.
Once I did that (and nothing else), the channel would clear again with no
problems. 

-----

The cause, I discovered, was actually a caller hanging up just at the end
of the Feature Group D DTMF tones that setup the call.  The reason for this
is a "guard timer" that's implemented using ast_safe_sleep(100) on line
6189 of chan_dahdi.c.  If the caller happens to hang up AFTER the final
tone of the DTMF string but BEFORE the end of that ast_safe_sleep(), then
ast_safe_sleep() will return non-zero.  This causes the code to bounce to
the end of ss_thread, but it does NOT tear down the call properly.

This should be a rare occurrence because the caller has to hang up at
EXACTLY the right time.  Nonetheless, it was happening quite regularly on
my system.  It's not easily reproducible, unless you purposely increase the
guard-time to 2000 or more.  Once do that, you can reproduce it every time
by watching the DTMF debug and hanging up just as it ends.

The solution was to change line 6189 from this:
if (ast_safe_sleep(chan,100)) goto quit;

...to this:
if (ast_safe_sleep(chan,100)) { ast_hangup(chan);  goto quit; }

I'm not very familiar with Asterisk channel handling conventions, so there
may be a better way fix this problem.  I did, however, put some extra
logging code in my local system and I have evidence of the situation
occurring and exiting cleanly.  I have 6 weeks of runtime with 0 stuck
channels at the moment.

Thanks.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2009-08-06 21:29 jcromes        New Issue                                    
2009-08-06 21:29 jcromes        Asterisk Version          => 1.4.26          
2009-08-06 21:29 jcromes        Regression                => No              
2009-08-06 21:29 jcromes        SVN Branch (only for SVN checkouts, not tarball
releases) => N/A             
======================================================================




More information about the asterisk-bugs mailing list