[asterisk-commits] rmudgett: trunk r347294 - in /trunk: ./ channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Dec 6 17:58:48 CST 2011


Author: rmudgett
Date: Tue Dec  6 17:58:44 2011
New Revision: 347294

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=347294
Log:
Make SIP INFO messages for dtmf-relay signals case insensitive.

(closes issue ASTERISK-18924)
Reported by: Kevin Taylor
........

Merged revisions 347292 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 347293 from http://svn.asterisk.org/svn/asterisk/branches/10

Modified:
    trunk/   (props changed)
    trunk/channels/chan_sip.c

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

Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=347294&r1=347293&r2=347294
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Tue Dec  6 17:58:44 2011
@@ -10918,14 +10918,20 @@
 	int event;
 	if (mode) {
 		/* Application/dtmf short version used by some implementations */
-		if (digit == '*')
+		if ('0' <= digit && digit <= '9') {
+			event = digit - '0';
+		} else if (digit == '*') {
 			event = 10;
-		else if (digit == '#')
+		} else if (digit == '#') {
 			event = 11;
-		else if ((digit >= 'A') && (digit <= 'D'))
+		} else if ('A' <= digit && digit <= 'D') {
 			event = 12 + digit - 'A';
-		else
-			event = atoi(&digit);
+		} else if ('a' <= digit && digit <= 'd') {
+			event = 12 + digit - 'a';
+		} else {
+			/* Unknown digit */
+			event = 0;
+		}
 		snprintf(tmp, sizeof(tmp), "%d\r\n", event);
 		add_header(req, "Content-Type", "application/dtmf");
 		add_content(req, tmp);
@@ -19066,16 +19072,21 @@
 			return;
 		}
 
-		if (buf[0] == '*') {
+		if ('0' <= buf[0] && buf[0] <= '9') {
+			event = buf[0] - '0';
+		} else if (buf[0] == '*') {
 			event = 10;
 		} else if (buf[0] == '#') {
 			event = 11;
-		} else if ((buf[0] >= 'A') && (buf[0] <= 'D')) {
+		} else if ('A' <= buf[0] && buf[0] <= 'D') {
 			event = 12 + buf[0] - 'A';
+		} else if ('a' <= buf[0] && buf[0] <= 'd') {
+			event = 12 + buf[0] - 'a';
 		} else if (buf[0] == '!') {
 			event = 16;
 		} else {
-			event = atoi(buf);
+			/* Unknown digit */
+			event = 0;
 		}
 		if (event == 16) {
 			/* send a FLASH event */
@@ -19140,6 +19151,9 @@
 				f.subclass.integer = '#';
 			} else if (event < 16) {
 				f.subclass.integer = 'A' + (event - 12);
+			} else {
+				/* Unknown digit. */
+				f.subclass.integer = '0';
 			}
 			f.len = duration;
 			ast_queue_frame(p->owner, &f);




More information about the asterisk-commits mailing list