[asterisk-commits] russell: trunk r62791 - in /trunk: ./ main/channel.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed May 2 16:00:08 MST 2007


Author: russell
Date: Wed May  2 18:00:07 2007
New Revision: 62791

URL: http://svn.digium.com/view/asterisk?view=rev&rev=62791
Log:
Merged revisions 62789 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r62789 | russell | 2007-05-02 17:59:09 -0500 (Wed, 02 May 2007) | 20 lines

Merge changes from team/russell/inband_dtmf ...

Fix some issues related to generating inband DTMF.  There are two changes here:

1)   The list of DTMF tones in the senddigit_begin() function explicitly
   specified 100ms of the tone followed by 100ms of silence.  This really
   broke things with the way that Asterisk now wants complete control
   over when the digit begins and ends.  So, regardless of what Asterisk
   really wanted to do, this was going to play out the tone at the length it
   wanted to.  This caused various problems like DTMF translation to inband to
   be extremely unreliable.
     The list of tones has been changed so that the correct DTMF tone is played
   indefinitely until Asterisk tells it to stop.

2) ast_write() had to be modified to let a DTMF_END frame get processed even
   when a generator is present.  This is how the tone will finally get stopped.

(issues #8944, #9250, #9348, maybe others.  Thanks to mdu113 from #8944 for
 the testing and feedback!)

........

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

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

Modified: trunk/main/channel.c
URL: http://svn.digium.com/view/asterisk/trunk/main/channel.c?view=diff&rev=62791&r1=62790&r2=62791
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Wed May  2 18:00:07 2007
@@ -2543,27 +2543,27 @@
 		res = chan->tech->send_digit_begin(chan, digit);
 
 	if (res) {
-		/*
-		 * Device does not support DTMF tones, lets fake
-		 * it by doing our own generation. (PM2002)
-		 */
+		/* Device does not support DTMF tones, lets fake
+		 * it by doing our own generation. */
 		static const char* dtmf_tones[] = {
-			"!941+1336/100,!0/100",	/* 0 */
-			"!697+1209/100,!0/100",	/* 1 */
-			"!697+1336/100,!0/100",	/* 2 */
-			"!697+1477/100,!0/100",	/* 3 */
-			"!770+1209/100,!0/100",	/* 4 */
-			"!770+1336/100,!0/100",	/* 5 */
-			"!770+1477/100,!0/100",	/* 6 */
-			"!852+1209/100,!0/100",	/* 7 */
-			"!852+1336/100,!0/100",	/* 8 */
-			"!852+1477/100,!0/100",	/* 9 */
-			"!697+1633/100,!0/100",	/* A */
-			"!770+1633/100,!0/100",	/* B */
-			"!852+1633/100,!0/100",	/* C */
-			"!941+1633/100,!0/100",	/* D */
-			"!941+1209/100,!0/100",	/* * */
-			"!941+1477/100,!0/100" };	/* # */
+			"941+1336", /* 0 */
+			"697+1209", /* 1 */
+			"697+1336", /* 2 */
+			"697+1477", /* 3 */
+			"770+1209", /* 4 */
+			"770+1336", /* 5 */
+			"770+1477", /* 6 */
+			"852+1209", /* 7 */
+			"852+1336", /* 8 */
+			"852+1477", /* 9 */
+			"697+1633", /* A */
+			"770+1633", /* B */
+			"852+1633", /* C */
+			"941+1633", /* D */
+			"941+1209", /* * */
+			"941+1477"  /* # */
+		};
+
 		if (digit >= '0' && digit <='9')
 			ast_playtones_start(chan, 0, dtmf_tones[digit-'0'], 0);
 		else if (digit >= 'A' && digit <= 'D')
@@ -2657,6 +2657,17 @@
 		if (ast_test_flag(chan, AST_FLAG_WRITE_INT))
 			ast_deactivate_generator(chan);
 		else {
+			if (fr->frametype == AST_FRAME_DTMF_END) {
+				/* There is a generator running while we're in the middle of a digit.
+				 * It's probably inband DTMF, so go ahead and pass it so it can
+				 * stop the generator */
+				ast_clear_flag(chan, AST_FLAG_BLOCKING);
+				ast_channel_unlock(chan);
+				res = ast_senddigit_end(chan, fr->subclass, fr->len);
+				ast_channel_lock(chan);
+				CHECK_BLOCKING(chan);
+			}
+
 			res = 0;	/* XXX explain, why 0 ? */
 			goto done;
 		}



More information about the asterisk-commits mailing list