[asterisk-commits] alecdavis: branch 1.8 r313001 - /branches/1.8/channels/sig_pri.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 7 05:19:38 CDT 2011


Author: alecdavis
Date: Thu Apr  7 05:19:31 2011
New Revision: 313001

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=313001
Log:
Fix ISDN calling subaddr User Specified Odd/Even Flag

Calculation of the Odd/Even flag was wrong.
Implement correct algo, and set odd/even=0 if data would be truncated.
Only allow automatic calculation of the O/E flag, don't let dialplan influence.

(closes issue #19062)
Reported by: festr
Patches: 
      bug19062.diff2.txt uploaded by alecdavis (license 585)
Tested by: festr, alecdavis, rmudgett


Modified:
    branches/1.8/channels/sig_pri.c

Modified: branches/1.8/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/sig_pri.c?view=diff&rev=313001&r1=313000&r2=313001
==============================================================================
--- branches/1.8/channels/sig_pri.c (original)
+++ branches/1.8/channels/sig_pri.c Thu Apr  7 05:19:31 2011
@@ -739,8 +739,14 @@
 			int length = ast_pri_pack_hex_string(pri_subaddress->data,
 				ast_subaddress->str, sizeof(pri_subaddress->data));
 
-			pri_subaddress->length = length;
-			pri_subaddress->odd_even_indicator = (length & 1);
+			pri_subaddress->length = length; /* packed data length */
+
+			length = strlen(ast_subaddress->str);
+			if (length > 2 * sizeof(pri_subaddress->data)) {
+				pri_subaddress->odd_even_indicator = 0;
+			} else {
+				pri_subaddress->odd_even_indicator = (length & 1);
+			}
 			pri_subaddress->valid = 1;
 		}
 	}
@@ -6415,12 +6421,10 @@
 		s++;
 		/* prefix */
 		/* 'n' = NSAP */
-		/* 'U' = odd, 'u'= even */
+		/* 'u' = User Specified */
 		/* Default = NSAP */
 		switch (*s) {
 		case 'U':
-			dialed_subaddress.odd_even_indicator = 1;
-			/* fall through */
 		case 'u':
 			s++;
 			dialed_subaddress.type = 2;




More information about the asterisk-commits mailing list