[asterisk-commits] twilson: trunk r291657 - in /trunk: ./ main/channel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Oct 13 18:47:15 CDT 2010


Author: twilson
Date: Wed Oct 13 18:47:10 2010
New Revision: 291657

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=291657
Log:
Merged revisions 291581 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r291581 | twilson | 2010-10-13 16:01:56 -0700 (Wed, 13 Oct 2010) | 35 lines
  
  Merged revisions 291580 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ................
    r291580 | twilson | 2010-10-13 15:58:43 -0700 (Wed, 13 Oct 2010) | 28 lines
    
    Merged revisions 291577 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.4
    
    ........
      r291577 | twilson | 2010-10-13 15:45:15 -0700 (Wed, 13 Oct 2010) | 21 lines
      
      Don't ignore frames that have been queued when softhangup'd
      
      When an outgoing call is answered and hung up by the far end *very* quickly, we
      may not read any frames and therefor end up with a call that displays the wrong
      disposition/DIALSTATUS. The reason is because ast_queue_hangup() immediately
      sets the _softhangup flag on the channel and then queues the HANGUP control
      frame, but __ast_read refuses to read any frames if ast_check_hangup() indicates
      that a hangup request has been made (which it will if _softhangup is set). So,
      we end up losing control frames.
      
      This change makes __ast_read continue to read frames even if a soft hangup has
      been requested. It queues a hangup frame to make sure that __ast_read() will
      still eventually return NULL.
      
      Much thanks to David Vossel for all of the reviews, discussion, and help!
      
      (closes issue #16946)
      Reported by: davidw
      
      Review: https://reviewboard.asterisk.org/r/740/
    ........
  ................
................

Modified:
    trunk/   (props changed)
    trunk/main/channel.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: trunk/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/channel.c?view=diff&rev=291657&r1=291656&r2=291657
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Wed Oct 13 18:47:10 2010
@@ -3611,7 +3611,18 @@
 	if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) {
 		if (chan->generator)
 			ast_deactivate_generator(chan);
-		goto done;
+
+		/* It is possible for chan->_softhangup to be set, yet there still be control
+		 * frames that still need to be read. Instead of just going to 'done' in the
+		 * case of ast_check_hangup(), we instead need to send the HANGUP frame so that
+		 * it can mark the end of the read queue. If there are frames to be read, 
+		 * ast_queue_control will be called repeatedly, but will only queue one hangup
+		 * frame. */
+		if (ast_check_hangup(chan)) {
+			ast_queue_control(chan, AST_CONTROL_HANGUP);
+		} else {
+			goto done;
+		}
 	}
 
 #ifdef AST_DEVMODE




More information about the asterisk-commits mailing list