[asterisk-commits] mmichelson: branch group/CCSS_Monitor_Restructure r242411 - in /team/group/CC...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jan 22 13:36:52 CST 2010


Author: mmichelson
Date: Fri Jan 22 13:36:48 2010
New Revision: 242411

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=242411
Log:
Resolve conflict and reset automerge.


Modified:
    team/group/CCSS_Monitor_Restructure/   (props changed)
    team/group/CCSS_Monitor_Restructure/include/asterisk/ccss.h
    team/group/CCSS_Monitor_Restructure/main/ccss.c

Propchange: team/group/CCSS_Monitor_Restructure/
------------------------------------------------------------------------------
--- Monitor_Restructure-integrated (original)
+++ Monitor_Restructure-integrated Fri Jan 22 13:36:48 2010
@@ -1,1 +1,1 @@
-/team/group/CCSS:1-242365
+/team/group/CCSS:1-242410

Propchange: team/group/CCSS_Monitor_Restructure/
------------------------------------------------------------------------------
    automerge = *

Modified: team/group/CCSS_Monitor_Restructure/include/asterisk/ccss.h
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS_Monitor_Restructure/include/asterisk/ccss.h?view=diff&rev=242411&r1=242410&r2=242411
==============================================================================
--- team/group/CCSS_Monitor_Restructure/include/asterisk/ccss.h (original)
+++ team/group/CCSS_Monitor_Restructure/include/asterisk/ccss.h Fri Jan 22 13:36:48 2010
@@ -1288,7 +1288,8 @@
 
 /*!
  * \since 1.8
- * \brief Set the CC_INTERFACES channel variable for a channel
+ * \brief Set the CC_INTERFACES channel variable for a channel using an
+ * agent as input
  *
  * \note
  * Implementers of protocol-specific CC agents should call this function after
@@ -1297,6 +1298,22 @@
  * \details
  * The CC_INTERFACES channel variable will have the interfaces that should be
  * called back for a specific PBX instance.
+ *
+ * \param chan The channel to set the CC_INTERFACES variable on
+ * \param agent The agent in use for the CC transaction
+ */
+int ast_cc_agent_set_interfaces_chanvar(struct ast_channel *chan, struct ast_cc_agent *agent);
+
+/*!
+ * \since 1.8
+ * \brief Set the CC_INTERFACES channel variable for a channel using an
+ * extension at context as a starting point
+ *
+ * \details
+ * The CC_INTERFACES channel variable will have the interfaces that should be
+ * called back for a specific PBX instance. This version of the function is used
+ * mainly by chan_local, wherein we need to set CC_INTERFACES based on an extension
+ * and context that appear in the middle of the tree of dialed interfaces
  *
  * \param chan The channel to set the CC_INTERFACES variable on
  * \param extension The name of the extension for which we're setting the variable.

Modified: team/group/CCSS_Monitor_Restructure/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS_Monitor_Restructure/main/ccss.c?view=diff&rev=242411&r1=242410&r2=242411
==============================================================================
--- team/group/CCSS_Monitor_Restructure/main/ccss.c (original)
+++ team/group/CCSS_Monitor_Restructure/main/ccss.c Fri Jan 22 13:36:48 2010
@@ -2654,8 +2654,7 @@
 	struct cc_recall_ds_data *recall_data;
 	struct ast_cc_interface_tree *interface_tree;
 	char device_name[AST_CHANNEL_NAME];
-	struct cc_monitor *exten_monitor;
-	struct ast_str *extencontext = ast_str_alloca(128);
+	struct cc_monitor *device_monitor;
 
 	ast_assert(core_id != NULL);
 
@@ -2693,36 +2692,61 @@
 
 	interface_tree = cc_ref(recall_data->interface_tree, "Bump refcount for tree while we search for specific channel");
 	ast_channel_get_device_name(chan, device_name, sizeof(device_name));
-	ast_str_set(&extencontext, 0, "%s@%s", S_OR(chan->macroexten, chan->exten), S_OR(chan->macrocontext, chan->context));
 	ast_channel_unlock(chan);
 
-	/* Now we need to find out if the channel in question is in the list of interfaces in the
-	 * called tree. Finding a match based on the device name is not enough here. We need to find
-	 * a match based on device name and a parent extension tree item with the same extension and
-	 * context as the channel.
-	 */
-	AST_DLLIST_LOCK(interface_tree);
-	AST_DLLIST_TRAVERSE(interface_tree, exten_monitor, next) {
-		/* First we try to find an extension interface with the proper
-		 * exten and context.
-		 */
-		if (!strcmp(exten_monitor->interface->name, ast_str_buffer(extencontext))) {
-			/* Found a matching extension, now see if the channel in question is one
-			 * of its children
-			 */
-			struct cc_monitor *device_monitor = exten_monitor;
-			while ((device_monitor = AST_DLLIST_NEXT(device_monitor, next))) {
-				if ((device_monitor->parent_id == exten_monitor->id) &&
-						!strcmp(device_monitor->interface->name, device_name)) {
-					/* BOOM! Device is in the tree! We have a winner! */
-					*core_id = recall_data->core_id;
-					AST_DLLIST_UNLOCK(interface_tree);
-					return 1;
-				}
-			}
+	/*
+	 * Now we need to find out if the channel device name
+	 * is in the list of interfaces in the called tree.
+	 */
+	AST_LIST_LOCK(interface_tree);
+	AST_LIST_TRAVERSE(interface_tree, device_monitor, next) {
+		if (!strcmp(device_monitor->interface->name, device_name)) {
+			/* BOOM! Device is in the tree! We have a winner! */
+			*core_id = recall_data->core_id;
+			AST_LIST_UNLOCK(interface_tree);
+			return 1;
 		}
 	}
 	AST_DLLIST_UNLOCK(interface_tree);
+	return 0;
+}
+
+int ast_cc_agent_set_interfaces_chanvar(struct ast_channel *chan, struct ast_cc_agent *agent)
+{
+	struct ast_datastore *recall_datastore;
+	struct ast_cc_interface_tree *interface_tree;
+	struct cc_monitor *monitor_iter;
+	struct cc_recall_ds_data *recall_data;
+	struct ast_str *var_value = ast_str_create(64);
+	int multi = 0;
+	char previous_dialable_name[AST_CHANNEL_NAME] = "";
+	int top_level_id;
+
+	ast_channel_lock(chan);
+	if (!(recall_datastore = ast_channel_datastore_find(chan, &recall_ds_info, NULL))) {
+		ast_channel_unlock(chan);
+		ast_free(var_value);
+		return -1;
+	}
+
+	recall_data = recall_datastore->data;
+	interface_tree = recall_data->interface_tree;
+	monitor_iter = AST_DLLIST_FIRST(interface_tree);
+	top_level_id = monitor_iter->id;
+
+	while ((monitor_iter = AST_DLLIST_NEXT(monitor_iter, next))) {
+		if (monitor_iter->parent_id == top_level_id && strcmp(monitor_iter->dialable_name, previous_dialable_name)) {
+			char *dialable_name = monitor_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));
+		}
+	}
+
+	pbx_builtin_setvar_helper(chan, "CC_INTERFACES", ast_str_buffer(var_value));
+	ast_log_dynamic_level(cc_logger_level, "CC_INTERFACES set to %s\n", ast_str_buffer(var_value));
+	ast_channel_unlock(chan);
+	ast_free(var_value);
 	return 0;
 }
 




More information about the asterisk-commits mailing list