[svn-commits] mmichelson: branch group/CCSS r235902 - /team/group/CCSS/main/ccss.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Dec 21 11:53:37 CST 2009


Author: mmichelson
Date: Mon Dec 21 11:53:35 2009
New Revision: 235902

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=235902
Log:
Prevent consecutive duplicates from appearing in CC_INTERFACES.

If dialing, say, a group of DAHDI channels, it's possible that
there are multiple devices or PRI spans that will be monitored
to determine when a member of that group has become available.
When the time comes, we don't want to end up with a CC_INTERFACES
variable with contents like

DAHDI/G1&DAHDI/G1&DAHDI/G1

Instead, just one will suffice.


Modified:
    team/group/CCSS/main/ccss.c

Modified: team/group/CCSS/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=235902&r1=235901&r2=235902
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Mon Dec 21 11:53:35 2009
@@ -2826,6 +2826,7 @@
 	unsigned int exten_id = 0;
 	struct ast_str *var_value = ast_str_create(64);
 	int multi = 0;
+	char previous_dialable_name[AST_CHANNEL_NAME] = "";
 
 	ast_channel_lock(chan);
 	if (!(recall_datastore = ast_channel_datastore_find(chan, &recall_ds_info, NULL))) {
@@ -2857,9 +2858,11 @@
 	/* I kind of feel wrong re-using tree_item_iter here, but eh, it works
 	 */
 	while ((tree_item_iter = AST_LIST_NEXT(tree_item_iter, next))) {
-		if (tree_item_iter->parent_id == exten_id) {
-			ast_str_append(&var_value, 0, "%s%s", multi ? "&" : "", S_OR(tree_item_iter->dialable_name, tree_item_iter->interface->name));
+		if (tree_item_iter->parent_id == exten_id && strcmp(tree_item_iter->dialable_name, previous_dialable_name)) {
+			char *dialable_name = tree_item_iter->dialable_name;
+			ast_str_append(&var_value, 0, "%s%s", multi ? "&" : "", dialable_name);
 			multi = 1;
+			ast_copy_string(previous_dialable_name, dialable_name, sizeof(previous_dialable_name));
 		}
 	}
 




More information about the svn-commits mailing list