[asterisk-commits] qwell: trunk r285746 - in /trunk: ./ main/channel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 9 15:13:50 CDT 2010


Author: qwell
Date: Thu Sep  9 15:13:39 2010
New Revision: 285746

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

................
  r285745 | qwell | 2010-09-09 15:11:06 -0500 (Thu, 09 Sep 2010) | 23 lines
  
  Merged revisions 285744 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ................
    r285744 | qwell | 2010-09-09 15:09:23 -0500 (Thu, 09 Sep 2010) | 16 lines
    
    Merged revisions 285742 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.4
    
    ........
      r285742 | qwell | 2010-09-09 15:06:31 -0500 (Thu, 09 Sep 2010) | 9 lines
      
      Transmit silence when reading DTMF in ast_readstring.
      
      Otherwise, you could get issues with DTMF timeouts causing hangups.
      
      (closes issue #17370)
      Reported by: makoto
      Patches: 
            channel-readstring-silence-generator.patch uploaded by makoto (license 38)
    ........
  ................
................

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=285746&r1=285745&r2=285746
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Thu Sep  9 15:13:39 2010
@@ -5368,6 +5368,8 @@
 	int pos = 0;	/* index in the buffer where we accumulate digits */
 	int to = ftimeout;
 
+	struct ast_silence_generator *silgen = NULL;
+
 	/* Stop if we're a zombie or need a soft hangup */
 	if (ast_test_flag(c, AST_FLAG_ZOMBIE) || ast_check_hangup(c))
 		return -1;
@@ -5378,24 +5380,33 @@
 		if (c->stream) {
 			d = ast_waitstream_full(c, AST_DIGIT_ANY, audiofd, ctrlfd);
 			ast_stopstream(c);
+			if (!silgen && ast_opt_transmit_silence)
+				silgen = ast_channel_start_silence_generator(c);
 			usleep(1000);
 			if (!d)
 				d = ast_waitfordigit_full(c, to, audiofd, ctrlfd);
 		} else {
+			if (!silgen && ast_opt_transmit_silence)
+				silgen = ast_channel_start_silence_generator(c);
 			d = ast_waitfordigit_full(c, to, audiofd, ctrlfd);
 		}
-		if (d < 0)
+		if (d < 0) {
+			ast_channel_stop_silence_generator(c, silgen);
 			return AST_GETDATA_FAILED;
+		}
 		if (d == 0) {
 			s[pos] = '\0';
+			ast_channel_stop_silence_generator(c, silgen);
 			return AST_GETDATA_TIMEOUT;
 		}
 		if (d == 1) {
 			s[pos] = '\0';
+			ast_channel_stop_silence_generator(c, silgen);
 			return AST_GETDATA_INTERRUPTED;
 		}
 		if (strchr(enders, d) && (pos == 0)) {
 			s[pos] = '\0';
+			ast_channel_stop_silence_generator(c, silgen);
 			return AST_GETDATA_EMPTY_END_TERMINATED;
 		}
 		if (!strchr(enders, d)) {
@@ -5403,6 +5414,7 @@
 		}
 		if (strchr(enders, d) || (pos >= len)) {
 			s[pos] = '\0';
+			ast_channel_stop_silence_generator(c, silgen);
 			return AST_GETDATA_COMPLETE;
 		}
 		to = timeout;




More information about the asterisk-commits mailing list