[asterisk-commits] rmudgett: trunk r303154 - in /trunk: ./ main/ccss.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 20 14:35:54 CST 2011


Author: rmudgett
Date: Thu Jan 20 14:35:50 2011
New Revision: 303154

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=303154
Log:
Merged revisions 303153 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r303153 | rmudgett | 2011-01-20 14:31:20 -0600 (Thu, 20 Jan 2011) | 22 lines
  
  Merged revision 303098 from
  https://origsvn.digium.com/svn/asterisk/be/branches/C.3-bier
  
  ..........
    r303098 | rmudgett | 2011-01-20 12:11:45 -0600 (Thu, 20 Jan 2011) | 15 lines
  
    CC_INTERFACES does not get built correctly with local channels.
  
    If local channels are used with CCSS, CC_INTERFACES gets garbage prepended
    to it so the CC recall fails.  Also CC_INTERFACES gets "&(null)" appended
    to it.
  
    * Initialize the buffer to eliminate the prepended garbage.
  
    * Filter out the empty interface strings to eliminate the latter.
  
    * Added a diagnostic message if the CC_INTERFACES is ever empty.
  
    JIRA ABE-2740
    JIRA SWP-2848
  ..........
................

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

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

Modified: trunk/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/ccss.c?view=diff&rev=303154&r1=303153&r2=303154
==============================================================================
--- trunk/main/ccss.c (original)
+++ trunk/main/ccss.c Thu Jan 20 14:35:50 2011
@@ -3186,10 +3186,14 @@
  * \param dialstring A new dialstring to add
  * \retval void
  */
-static void cc_unique_append(struct ast_str *str, const char * const dialstring)
+static void cc_unique_append(struct ast_str *str, const char *dialstring)
 {
 	char dialstring_search[AST_CHANNEL_NAME];
 
+	if (ast_strlen_zero(dialstring)) {
+		/* No dialstring to append. */
+		return;
+	}
 	snprintf(dialstring_search, sizeof(dialstring_search), "%s%c", dialstring, '&');
 	if (strstr(ast_str_buffer(str), dialstring_search)) {
 		return;
@@ -3218,6 +3222,10 @@
 	struct extension_child_dialstring *child_dialstring;
 	struct ast_cc_monitor *monitor_iter = starting_point;
 	int top_level_id = starting_point->id;
+	size_t length;
+
+	/* Init to an empty string. */
+	ast_str_truncate(str, 0);
 
 	/* First we need to take all of the is_valid child_dialstrings from
 	 * the extension monitor we found and add them to the CC_INTERFACES
@@ -3240,7 +3248,15 @@
 	/* str will have an extra '&' tacked onto the end of it, so we need
 	 * to get rid of that.
 	 */
-	ast_str_truncate(str, ast_str_strlen(str) - 1);
+	length = ast_str_strlen(str);
+	if (length) {
+		ast_str_truncate(str, length - 1);
+	}
+	if (length <= 1) {
+		/* Nothing to recall?  This should not happen. */
+		ast_log(LOG_ERROR, "CC_INTERFACES is empty. starting device_name:'%s'\n",
+			starting_point->interface->device_name);
+	}
 }
 
 int ast_cc_agent_set_interfaces_chanvar(struct ast_channel *chan)




More information about the asterisk-commits mailing list