[asterisk-commits] rmudgett: branch group/issue8824 r173244 - /team/group/issue8824/main/channel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Feb 3 17:05:48 CST 2009


Author: rmudgett
Date: Tue Feb  3 17:05:48 2009
New Revision: 173244

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=173244
Log:
*  Made build_connected_line_data() and build_redirecting_data()
include an empty string in the built control frame.

The change makes the CONNECTEDLINE() and REDIRECTING() dialplan
functions behave the same way whether the inhibit(i) option is used
or not on the datatypes: name, number, and all.

Modified:
    team/group/issue8824/main/channel.c

Modified: team/group/issue8824/main/channel.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue8824/main/channel.c?view=diff&rev=173244&r1=173243&r2=173244
==============================================================================
--- team/group/issue8824/main/channel.c (original)
+++ team/group/issue8824/main/channel.c Tue Feb  3 17:05:48 2009
@@ -5995,30 +5995,26 @@
 	/* *************** Connected line party id *************** */
 	if (connected->id.number) {
 		length = strlen(connected->id.number);
-		if (0 < length) {
-			if (datalen < pos + (sizeof(data[0]) * 2) + length) {
-				ast_log(LOG_WARNING, "No space left for connected line number\n");
-				return -1;
-			}
-			data[pos++] = AST_CONNECTED_LINE_NUMBER;
-			data[pos++] = length;
-			memcpy(data + pos, connected->id.number, length);
-			pos += length;
-		}
+		if (datalen < pos + (sizeof(data[0]) * 2) + length) {
+			ast_log(LOG_WARNING, "No space left for connected line number\n");
+			return -1;
+		}
+		data[pos++] = AST_CONNECTED_LINE_NUMBER;
+		data[pos++] = length;
+		memcpy(data + pos, connected->id.number, length);
+		pos += length;
 	}
 
 	if (connected->id.name) {
 		length = strlen(connected->id.name);
-		if (0 < length) {
-			if (datalen < pos + (sizeof(data[0]) * 2) + length) {
-				ast_log(LOG_WARNING, "No space left for connected line name\n");
-				return -1;
-			}
-			data[pos++] = AST_CONNECTED_LINE_NAME;
-			data[pos++] = length;
-			memcpy(data + pos, connected->id.name, length);
-			pos += length;
-		}
+		if (datalen < pos + (sizeof(data[0]) * 2) + length) {
+			ast_log(LOG_WARNING, "No space left for connected line name\n");
+			return -1;
+		}
+		data[pos++] = AST_CONNECTED_LINE_NAME;
+		data[pos++] = length;
+		memcpy(data + pos, connected->id.name, length);
+		pos += length;
 	}
 
 	if (datalen < pos + (sizeof(data[0]) * 2) + 1) {
@@ -6284,30 +6280,26 @@
 	/* *************** Redirecting from party id *************** */
 	if (redirecting->from.number) {
 		length = strlen(redirecting->from.number);
-		if (0 < length) {
-			if (datalen < pos + (sizeof(data[0]) * 2) + length) {
-				ast_log(LOG_WARNING, "No space left for redirecting from number\n");
-				return -1;
-			}
-			data[pos++] = AST_REDIRECTING_FROM_NUMBER;
-			data[pos++] = length;
-			memcpy(data + pos, redirecting->from.number, length);
-			pos += length;
-		}
+		if (datalen < pos + (sizeof(data[0]) * 2) + length) {
+			ast_log(LOG_WARNING, "No space left for redirecting from number\n");
+			return -1;
+		}
+		data[pos++] = AST_REDIRECTING_FROM_NUMBER;
+		data[pos++] = length;
+		memcpy(data + pos, redirecting->from.number, length);
+		pos += length;
 	}
 
 	if (redirecting->from.name) {
 		length = strlen(redirecting->from.name);
-		if (0 < length) {
-			if (datalen < pos + (sizeof(data[0]) * 2) + length) {
-				ast_log(LOG_WARNING, "No space left for redirecting from name\n");
-				return -1;
-			}
-			data[pos++] = AST_REDIRECTING_FROM_NAME;
-			data[pos++] = length;
-			memcpy(data + pos, redirecting->from.name, length);
-			pos += length;
-		}
+		if (datalen < pos + (sizeof(data[0]) * 2) + length) {
+			ast_log(LOG_WARNING, "No space left for redirecting from name\n");
+			return -1;
+		}
+		data[pos++] = AST_REDIRECTING_FROM_NAME;
+		data[pos++] = length;
+		memcpy(data + pos, redirecting->from.name, length);
+		pos += length;
 	}
 
 	if (datalen < pos + (sizeof(data[0]) * 2) + 1) {
@@ -6329,30 +6321,26 @@
 	/* *************** Redirecting to party id *************** */
 	if (redirecting->to.number) {
 		length = strlen(redirecting->to.number);
-		if (0 < length) {
-			if (datalen < pos + (sizeof(data[0]) * 2) + length) {
-				ast_log(LOG_WARNING, "No space left for redirecting to number\n");
-				return -1;
-			}
-			data[pos++] = AST_REDIRECTING_TO_NUMBER;
-			data[pos++] = length;
-			memcpy(data + pos, redirecting->to.number, length);
-			pos += length;
-		}
+		if (datalen < pos + (sizeof(data[0]) * 2) + length) {
+			ast_log(LOG_WARNING, "No space left for redirecting to number\n");
+			return -1;
+		}
+		data[pos++] = AST_REDIRECTING_TO_NUMBER;
+		data[pos++] = length;
+		memcpy(data + pos, redirecting->to.number, length);
+		pos += length;
 	}
 
 	if (redirecting->to.name) {
 		length = strlen(redirecting->to.name);
-		if (0 < length) {
-			if (datalen < pos + (sizeof(data[0]) * 2) + length) {
-				ast_log(LOG_WARNING, "No space left for redirecting to name\n");
-				return -1;
-			}
-			data[pos++] = AST_REDIRECTING_TO_NAME;
-			data[pos++] = length;
-			memcpy(data + pos, redirecting->to.name, length);
-			pos += length;
-		}
+		if (datalen < pos + (sizeof(data[0]) * 2) + length) {
+			ast_log(LOG_WARNING, "No space left for redirecting to name\n");
+			return -1;
+		}
+		data[pos++] = AST_REDIRECTING_TO_NAME;
+		data[pos++] = length;
+		memcpy(data + pos, redirecting->to.name, length);
+		pos += length;
 	}
 
 	if (datalen < pos + (sizeof(data[0]) * 2) + 1) {




More information about the asterisk-commits mailing list