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

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed May 9 12:21:35 MST 2007


Author: russell
Date: Wed May  9 14:21:35 2007
New Revision: 63697

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

........
r63612 | russell | 2007-05-09 11:55:27 -0500 (Wed, 09 May 2007) | 5 lines

Modify ast_senddigit_begin() to use the same assumptions used elsewhere in the
code in that if a channel does not have a send_digit_begin() callback, it only
cares about DTMF END events.  (pointed out by Michael Neuhauser on the
asterisk-dev list)

........

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=63697&r1=63696&r2=63697
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Wed May  9 14:21:35 2007
@@ -2554,46 +2554,45 @@
 
 int ast_senddigit_begin(struct ast_channel *chan, char digit)
 {
-	int res = -1;
-
-	if (chan->tech->send_digit_begin)
-		res = chan->tech->send_digit_begin(chan, digit);
-
-	if (res) {
-		/* Device does not support DTMF tones, lets fake
-		 * it by doing our own generation. */
-		static const char* dtmf_tones[] = {
-			"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')
-			ast_playtones_start(chan, 0, dtmf_tones[digit-'A'+10], 0);
-		else if (digit == '*')
-			ast_playtones_start(chan, 0, dtmf_tones[14], 0);
-		else if (digit == '#')
-			ast_playtones_start(chan, 0, dtmf_tones[15], 0);
-		else {
-			/* not handled */
-			if (option_debug)
-				ast_log(LOG_DEBUG, "Unable to generate DTMF tone '%c' for '%s'\n", digit, chan->name);
-		}
+	/* Device does not support DTMF tones, lets fake
+	 * it by doing our own generation. */
+	static const char* dtmf_tones[] = {
+		"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 (!chan->tech->send_digit_begin)
+		return 0;
+
+	if (!chan->tech->send_digit_begin(chan, digit))
+		return 0;
+
+	if (digit >= '0' && digit <='9')
+		ast_playtones_start(chan, 0, dtmf_tones[digit-'0'], 0);
+	else if (digit >= 'A' && digit <= 'D')
+		ast_playtones_start(chan, 0, dtmf_tones[digit-'A'+10], 0);
+	else if (digit == '*')
+		ast_playtones_start(chan, 0, dtmf_tones[14], 0);
+	else if (digit == '#')
+		ast_playtones_start(chan, 0, dtmf_tones[15], 0);
+	else {
+		/* not handled */
+		if (option_debug)
+			ast_log(LOG_DEBUG, "Unable to generate DTMF tone '%c' for '%s'\n", digit, chan->name);
 	}
 
 	return 0;



More information about the asterisk-commits mailing list