[asterisk-commits] mmichelson: branch group/CCSS_Monitor_Restructure r241235 - /team/group/CCSS_...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 19 12:13:45 CST 2010


Author: mmichelson
Date: Tue Jan 19 12:13:42 2010
New Revision: 241235

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=241235
Log:
Change "cc_tree_item" to "cc_monitor"

This, like several commits to come, removes many
functions that simply won't be necessary any more. In this
case, since the cc_tree_items are morphing into monitors, there
is no more need to have functions to translate tree items
into monitors. I have avoided tremendous conflicts by
renaming the structure to just "cc_monitor" as opposed to
ast_cc_monitor for now. This is only temporary, I assure you.


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

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=241235&r1=241234&r2=241235
==============================================================================
--- team/group/CCSS_Monitor_Restructure/main/ccss.c (original)
+++ team/group/CCSS_Monitor_Restructure/main/ccss.c Tue Jan 19 12:13:42 2010
@@ -871,7 +871,7 @@
 	}
 }
 
-static int cc_extension_monitor_init(struct ast_cc_monitor *monitor, const int core_id);
+static int cc_butt_extension_monitor_init(struct ast_cc_monitor *monitor, const int core_id);
 static int cc_extension_monitor_request_cc(struct ast_cc_monitor *monitor, const int core_id, struct ast_cc_monitor_link *parent_link);
 static int cc_extension_monitor_suspend(struct ast_cc_monitor *monitor, const int core_id);
 static int cc_extension_monitor_status_response(struct ast_cc_monitor *monitor, const int core_id, enum ast_device_state devstate);
@@ -882,7 +882,7 @@
 
 static struct ast_cc_monitor_callbacks extension_monitor_cbs = {
 	.type = "extension",
-	.init = cc_extension_monitor_init,
+	.init = cc_butt_extension_monitor_init,
 	.request_cc = cc_extension_monitor_request_cc,
 	.suspend = cc_extension_monitor_suspend,
 	.status_response = cc_extension_monitor_status_response,
@@ -892,7 +892,7 @@
 	.instance_destructor = cc_extension_monitor_instance_destructor,
 };
 
-static int cc_extension_monitor_init(struct ast_cc_monitor *monitor, const int core_id)
+static int cc_butt_extension_monitor_init(struct ast_cc_monitor *monitor, const int core_id)
 {
 	return 0;
 }
@@ -1232,7 +1232,7 @@
  * is that this structure contains data which is intrinsic to the item's
  * placement in the tree, such as who its parent is.
  */
-struct cc_tree_item {
+struct cc_monitor {
 	/* Information regarding the interface.
 	 */
 	struct ast_cc_interface *interface;
@@ -1246,7 +1246,7 @@
 	 */
 	unsigned int parent_id;
 	/* What service was offered by the endpoint. Note that
-	 * this field is completely irrelevant for cc_tree_items
+	 * this field is completely irrelevant for cc_monitors
 	 * representing dialplan extensions.
 	 */
 	enum ast_cc_service_type service_offered;
@@ -1268,7 +1268,7 @@
 	 * Monitor callbacks
 	 */
 	const struct ast_cc_monitor_callbacks *callbacks;
-	AST_LIST_ENTRY(cc_tree_item) next;
+	AST_LIST_ENTRY(cc_monitor) next;
 };
 
 /*!
@@ -1278,7 +1278,7 @@
  * to use it, and it may last beyond the lifetime of a single
  * thread.
  */
-AST_LIST_HEAD(ast_cc_interface_tree, cc_tree_item);
+AST_LIST_HEAD(ast_cc_interface_tree, cc_monitor);
 
 static void cc_interface_destroy(void *data)
 {
@@ -1287,19 +1287,19 @@
 	ast_cc_config_params_destroy(interface->config_params);
 }
 
-static void cc_tree_item_destroy(struct cc_tree_item *tree_item)
-{
-	cc_unref(tree_item->interface, "Unreffing tree's reference to interface");
-	ast_free(tree_item->dialable_name);
-	ast_free(tree_item);
+static void cc_monitor_destroy(struct cc_monitor *monitor)
+{
+	cc_unref(monitor->interface, "Unreffing tree's reference to interface");
+	ast_free(monitor->dialable_name);
+	ast_free(monitor);
 }
 
 static void cc_interface_tree_destroy(void *data)
 {
 	struct ast_cc_interface_tree *cc_interface_tree = data;
-	struct cc_tree_item *tree_item;
-	while ((tree_item = AST_LIST_REMOVE_HEAD(cc_interface_tree, next))) {
-		cc_tree_item_destroy(tree_item);
+	struct cc_monitor *monitor;
+	while ((monitor = AST_LIST_REMOVE_HEAD(cc_interface_tree, next))) {
+		cc_monitor_destroy(monitor);
 	}
 	AST_LIST_HEAD_DESTROY(cc_interface_tree);
 }
@@ -1324,12 +1324,12 @@
 	 * This value serves a dual-purpose. When dial starts, if the
 	 * dialed_cc_interfaces datastore currently exists on the calling
 	 * channel, then the dial_parent_id will serve as a means of
-	 * letting the new extension cc_tree_item we create know
+	 * letting the new extension cc_monitor we create know
 	 * who his parent is. This value will be the extension
-	 * cc_tree_item that dialed the local channel that resulted
+	 * cc_monitor that dialed the local channel that resulted
 	 * in the new Dial app being called.
 	 *
-	 * In addition, once an extension cc_tree_item is created,
+	 * In addition, once an extension cc_monitor is created,
 	 * the dial_parent_id will be changed to the id of that newly
 	 * created interface. This way, device interfaces created from
 	 * receiving AST_CONTROL_CC frames can use this field to determine
@@ -1459,19 +1459,19 @@
  *
  * When app_dial starts, this function is called in order to set up the
  * information about the extension in which this Dial is occurring. Any
- * devices dialed will have this particular cc_tree_item as a parent.
+ * devices dialed will have this particular cc_monitor as a parent.
  *
  * \param exten Extension from which Dial is occurring
  * \param context Context to which exten belongs
  * \param parent_id What should we set the parent_id of this interface to?
  * \retval NULL Memory allocation failure
- * \retval non-NULL The newly-created cc_tree_item for the extension
+ * \retval non-NULL The newly-created cc_monitor for the extension
  */
-static struct cc_tree_item *cc_extension_tree_item_init(const char * const exten, const char * const context, const unsigned int parent_id)
+static struct cc_monitor *cc_extension_monitor_init(const char * const exten, const char * const context, const unsigned int parent_id)
 {
 	struct ast_str *str = ast_str_alloca(2 * AST_MAX_EXTENSION);
 	struct ast_cc_interface *cc_interface;
-	struct cc_tree_item *tree_item;
+	struct cc_monitor *monitor;
 
 	ast_str_set(&str, 0, "%s@%s", exten, context);
 
@@ -1479,19 +1479,19 @@
 		return NULL;
 	}
 
-	if (!(tree_item = ast_calloc(1, sizeof(*tree_item)))) {
+	if (!(monitor = ast_calloc(1, sizeof(*monitor)))) {
 		ao2_t_ref(cc_interface, -1, "failed to allocate the tree item, so unref the interface");
 		return NULL;
 	}
 
-	tree_item->id = ast_atomic_fetchadd_int(&dialed_cc_interface_counter, +1);
-	tree_item->parent_id = parent_id;
+	monitor->id = ast_atomic_fetchadd_int(&dialed_cc_interface_counter, +1);
+	monitor->parent_id = parent_id;
 	cc_interface->monitor_type = "extension";
 	cc_interface->monitor_class = AST_CC_EXTENSION_MONITOR;
 	strcpy(cc_interface->name, ast_str_buffer(str));
-	tree_item->interface = cc_interface;
-	ast_log_dynamic_level(cc_logger_level, "Created an extension cc interface for '%s' with id %d and parent %d\n", cc_interface->name, tree_item->id, tree_item->parent_id);
-	return tree_item;
+	monitor->interface = cc_interface;
+	ast_log_dynamic_level(cc_logger_level, "Created an extension cc interface for '%s' with id %d and parent %d\n", cc_interface->name, monitor->id, monitor->parent_id);
+	return monitor;
 }
 
 /*!
@@ -1512,7 +1512,7 @@
  */
 static int cc_interfaces_datastore_init(struct ast_channel *chan) {
 	struct dialed_cc_interfaces *interfaces;
-	struct cc_tree_item *tree_item;
+	struct cc_monitor *monitor;
 	struct ast_datastore *dial_cc_datastore;
 
 	/*XXX This may be a bit controversial. In an attempt to not allocate
@@ -1530,13 +1530,13 @@
 		return -1;
 	}
 
-	if (!(tree_item = cc_extension_tree_item_init(S_OR(chan->macroexten, chan->exten), S_OR(chan->macrocontext, chan->context), 0))) {
+	if (!(monitor = cc_extension_monitor_init(S_OR(chan->macroexten, chan->exten), S_OR(chan->macrocontext, chan->context), 0))) {
 		ast_free(interfaces);
 		return -1;
 	}
 
 	if (!(dial_cc_datastore = ast_datastore_alloc(&dialed_cc_interfaces_info, NULL))) {
-		cc_tree_item_destroy(tree_item);
+		cc_monitor_destroy(monitor);
 		ast_free(interfaces);
 		return -1;
 	}
@@ -1544,17 +1544,17 @@
 	if (!(interfaces->interface_tree = ao2_t_alloc(sizeof(*interfaces->interface_tree), cc_interface_tree_destroy,
 					"Allocate interface tree"))) {
 		ast_datastore_free(dial_cc_datastore);
-		cc_tree_item_destroy(tree_item);
+		cc_monitor_destroy(monitor);
 		ast_free(interfaces);
 		return -1;
 	}
 
 	/* Finally, all that allocation is done... */
 	AST_LIST_HEAD_INIT(interfaces->interface_tree);
-	AST_LIST_INSERT_TAIL(interfaces->interface_tree, tree_item, next);
+	AST_LIST_INSERT_TAIL(interfaces->interface_tree, monitor, next);
 	dial_cc_datastore->data = interfaces;
 	dial_cc_datastore->inheritance = DATASTORE_INHERIT_FOREVER;
-	interfaces->dial_parent_id = tree_item->id;
+	interfaces->dial_parent_id = monitor->id;
 	interfaces->core_id = ast_atomic_fetchadd_int(&core_id_counter, +1);
 	interfaces->is_original_caller = 1;
 	ast_channel_lock(chan);
@@ -1584,10 +1584,10 @@
 
 /*!
  * \internal
- * \brief Allocate and intitialize a device cc_tree_item
+ * \brief Allocate and intitialize a device cc_monitor
  *
  * For all intents and purposes, this is the same as
- * cc_extension_tree_item_init, except that there is only
+ * cc_extension_monitor_init, except that there is only
  * a single parameter used for naming the interface.
  *
  * This function is called when handling AST_CONTROL_CC frames.
@@ -1607,10 +1607,10 @@
  * \retval NULL Memory allocation failure
  * \retval non-NULL The new ast_cc_interface created.
  */
-static struct cc_tree_item *cc_device_tree_item_init(const char * const device_name, const char * const dialable_name, const struct ast_control_cc_payload *cc_data)
+static struct cc_monitor *cc_device_monitor_init(const char * const device_name, const char * const dialable_name, const struct ast_control_cc_payload *cc_data)
 {
 	struct ast_cc_interface *cc_interface;
-	struct cc_tree_item *tree_item;
+	struct cc_monitor *monitor;
 	size_t device_name_len = strlen(device_name);
 	int parent_id = cc_data->parent_interface_id;
 
@@ -1623,34 +1623,34 @@
 		return NULL;
 	}
 
-	if (!(tree_item = ast_calloc(1, sizeof(*tree_item)))) {
+	if (!(monitor = ast_calloc(1, sizeof(*monitor)))) {
 		ao2_t_ref(cc_interface, -1, "Failed to allocate tree item, unref interface");
 		return NULL;
 	}
 
-	if (!(tree_item->dialable_name = ast_strdup(dialable_name))) {
+	if (!(monitor->dialable_name = ast_strdup(dialable_name))) {
 		ao2_t_ref(cc_interface, -1, "Failed to copy dialable name");
-		cc_tree_item_destroy(tree_item);
+		cc_monitor_destroy(monitor);
 		return NULL;
 	}
 
-	if (!(tree_item->callbacks = find_monitor_callbacks(cc_interface->monitor_type))) {
+	if (!(monitor->callbacks = find_monitor_callbacks(cc_interface->monitor_type))) {
 		ao2_t_ref(cc_interface, -1, "Failed to find monitor callbacks\n");
-		cc_tree_item_destroy(tree_item);
+		cc_monitor_destroy(monitor);
 		return NULL;
 	}
 
 	strcpy(cc_interface->name, device_name);
-	tree_item->id = ast_atomic_fetchadd_int(&dialed_cc_interface_counter, +1);
-	tree_item->parent_id = parent_id;
-	tree_item->service_offered = cc_data->service;
+	monitor->id = ast_atomic_fetchadd_int(&dialed_cc_interface_counter, +1);
+	monitor->parent_id = parent_id;
+	monitor->service_offered = cc_data->service;
 	cc_interface->monitor_type = cc_data->monitor_type;
 	cc_interface->monitor_class = AST_CC_DEVICE_MONITOR;
-	tree_item->interface = cc_interface;
-	tree_item->available_timer_id = -1;
+	monitor->interface = cc_interface;
+	monitor->available_timer_id = -1;
 	ast_cc_copy_config_params(cc_interface->config_params, &cc_data->config_params);
-	ast_log_dynamic_level(cc_logger_level, "Created a device cc interface for '%s' with id %d and parent %d\n", cc_interface->name, tree_item->id, tree_item->parent_id);
-	return tree_item;
+	ast_log_dynamic_level(cc_logger_level, "Created a device cc interface for '%s' with id %d and parent %d\n", cc_interface->name, monitor->id, monitor->parent_id);
+	return monitor;
 }
 
 /*!
@@ -1659,8 +1659,8 @@
  * call this function when we read an AST_CONTROL_CC frame
  * from an outbound channel.
  *
- * This function will call cc_device_tree_item_init to
- * create the new cc_tree_item for the device from which
+ * This function will call cc_device_monitor_init to
+ * create the new cc_monitor for the device from which
  * we read the frame. In addition, the new device will be added
  * to the interface tree on the dialed_cc_interfaces datastore
  * on the inbound channel.
@@ -1673,7 +1673,7 @@
 {
 	char *device_name;
 	char *dialable_name;
-	struct cc_tree_item *tree_item;
+	struct cc_monitor *monitor;
 	struct ast_datastore *cc_datastore;
 	struct dialed_cc_interfaces *cc_interfaces;
 	struct ast_control_cc_payload *cc_data = frame_data;
@@ -1727,8 +1727,8 @@
 	 * case a device queues multiple CC control frames.
 	 */
 	AST_LIST_LOCK(cc_interfaces->interface_tree);
-	AST_LIST_TRAVERSE(cc_interfaces->interface_tree, tree_item, next) {
-		if (!strcmp(tree_item->interface->name, device_name)) {
+	AST_LIST_TRAVERSE(cc_interfaces->interface_tree, monitor, next) {
+		if (!strcmp(monitor->interface->name, device_name)) {
 			ast_log_dynamic_level(cc_logger_level, "Device %s sent us multiple CC control frames. Ignoring those beyond the first.\n", device_name);
 			AST_LIST_UNLOCK(cc_interfaces->interface_tree);
 			cc_unref(core_instance, "Returning early from ast_handle_cc_control_frame");
@@ -1738,14 +1738,14 @@
 	AST_LIST_UNLOCK(cc_interfaces->interface_tree);
 
 
-	if (!(tree_item = cc_device_tree_item_init(device_name, dialable_name, cc_data))) {
+	if (!(monitor = cc_device_monitor_init(device_name, dialable_name, cc_data))) {
 		ast_log(LOG_WARNING, "Unable to create CC device interface for '%s'. CC services will be unavailable on this interface.\n", device_name);
 		cc_unref(core_instance, "Returning early from ast_handle_cc_control_frame");
 		return;
 	}
 
 	AST_LIST_LOCK(cc_interfaces->interface_tree);
-	AST_LIST_INSERT_TAIL(cc_interfaces->interface_tree, tree_item, next);
+	AST_LIST_INSERT_TAIL(cc_interfaces->interface_tree, monitor, next);
 	AST_LIST_UNLOCK(cc_interfaces->interface_tree);
 
 	manager_event(EVENT_FLAG_CC, "CCAvailable",
@@ -1782,7 +1782,7 @@
 
 	struct ast_datastore *cc_interfaces_datastore;
 	struct dialed_cc_interfaces *interfaces;
-	struct cc_tree_item *tree_item;
+	struct cc_monitor *monitor;
 	ast_channel_lock(chan);
 
 	if (ast_get_cc_agent_policy(ast_channel_get_cc_config_params(chan)) == AST_CC_AGENT_NEVER) {
@@ -1810,18 +1810,18 @@
 	}
 
 	/* Situation 2 has occurred */
-	if (!(tree_item = cc_extension_tree_item_init(S_OR(chan->macroexten, chan->exten),
+	if (!(monitor = cc_extension_monitor_init(S_OR(chan->macroexten, chan->exten),
 			S_OR(chan->macrocontext, chan->context), interfaces->dial_parent_id))) {
 		return -1;
 	}
 	/* In situation 2, chan_local will have set the extension's dialable name
-	 * on the datastore, so we need to copy that into this tree_item.
-	 */
-	tree_item->dialable_name = ast_strdup(interfaces->current_extension_dialable_name);
+	 * on the datastore, so we need to copy that into this monitor.
+	 */
+	monitor->dialable_name = ast_strdup(interfaces->current_extension_dialable_name);
 	AST_LIST_LOCK(interfaces->interface_tree);
-	AST_LIST_INSERT_TAIL(interfaces->interface_tree, tree_item, next);
+	AST_LIST_INSERT_TAIL(interfaces->interface_tree, monitor, next);
 	AST_LIST_UNLOCK(interfaces->interface_tree);
-	interfaces->dial_parent_id = tree_item->id;
+	interfaces->dial_parent_id = monitor->id;
 	return 0;
 }
 
@@ -2114,8 +2114,8 @@
 	char *target;
 	int reason;
 	struct ast_channel *chan;
-	struct cc_tree_item *tree_item = AST_LIST_FIRST(agent->interface_tree);
-	char *full_extension = ast_strdupa(tree_item->interface->name);
+	struct cc_monitor *monitor = AST_LIST_FIRST(agent->interface_tree);
+	char *full_extension = ast_strdupa(monitor->interface->name);
 	char *context;
 	char *exten;
 	const char *callback_macro = ast_get_cc_callback_macro(agent->cc_params);
@@ -2221,20 +2221,20 @@
 static void kill_interface_tree_monitors(struct ast_cc_interface_tree *interface_tree, const int core_id)
 {
 	const struct ast_cc_monitor_callbacks *monitor_callbacks;
-	struct cc_tree_item *tree_item_iter;
+	struct cc_monitor *monitor_iter;
 
 	/* Locking is necessary here since a channel thread could possibly be mucking
 	 * with this list while we try to traverse it
 	 */
 	AST_LIST_LOCK(interface_tree);
-	AST_LIST_TRAVERSE(interface_tree, tree_item_iter, next) {
-		if (tree_item_iter->interface->monitor_class == AST_CC_DEVICE_MONITOR) {
+	AST_LIST_TRAVERSE(interface_tree, monitor_iter, next) {
+		if (monitor_iter->interface->monitor_class == AST_CC_DEVICE_MONITOR) {
 			monitor_callbacks =
-				find_monitor_callbacks(tree_item_iter->interface->monitor_type);
+				find_monitor_callbacks(monitor_iter->interface->monitor_type);
 			if (!monitor_callbacks) {
 				ast_log(LOG_WARNING,
 					"We may have a memory leak here. Couldn't find callbacks for monitor type %s\n",
-					tree_item_iter->interface->monitor_type);
+					monitor_iter->interface->monitor_type);
 				continue;
 			}
 			monitor_callbacks->instance_destructor(core_id);
@@ -2366,80 +2366,6 @@
 	finder.interface = finder_interface;
 
 	return ao2_t_find(cc_monitors, &finder, OBJ_POINTER, "Trying to find specific monitor");
-}
-
-static struct ast_cc_monitor *find_or_create_monitor(struct ast_cc_monitor *parent, struct cc_tree_item *tree_item, const int core_id)
-{
-	struct ast_cc_monitor *new_monitor;
-	struct ast_cc_monitor_link *new_link;
-	struct ast_cc_interface *interface = tree_item->interface;
-
-	if ((new_monitor = find_monitor(interface->name, interface->monitor_type))) {
-		ast_log_dynamic_level(cc_logger_level, "Found monitor %s in tree. Re-using\n", new_monitor->interface->name);
-	} else if (!(new_monitor = cc_monitor_instance_init(interface, core_id))) {
-		return NULL;
-	}
-
-	if (!(new_link = ast_calloc(1, sizeof(*new_link)))) {
-		cc_unref(new_monitor, "Couldn't allocate link, so unref monitor");
-		ao2_t_unlink(cc_monitors, new_monitor, "Couldn't allocate link, so unlink monitor");
-		return NULL;
-	}
-
-	new_link->child = cc_ref(new_monitor, "Link's child reference");
-	new_link->parent = cc_ref(parent, "Link's parent reference");
-	new_link->core_id = core_id;
-	new_link->service = tree_item->service_offered;
-	new_link->child_avail_id = -1;
-	ast_atomic_fetchadd_int(&new_monitor->num_requests, +1);
-	AST_LIST_INSERT_TAIL(&parent->child_links, new_link, next_child);
-	AST_LIST_INSERT_TAIL(&new_monitor->parent_links, new_link, next_parent);
-	ast_log_dynamic_level(cc_logger_level, "Created link with core_id %d, parent %s and child %s\n", new_link->core_id, new_link->parent->interface->name, new_link->child->interface->name);
-	return new_monitor;
-}
-
-static void interface_tree_to_monitor(struct cc_tree_item *current_place, struct ast_cc_monitor *parent, const int core_id)
-{
-	struct cc_tree_item *tree_item = current_place;
-	struct ast_cc_monitor *monitor = find_or_create_monitor(parent, current_place, core_id);
-
-	if (!monitor) {
-		/* Um, that's messed up */
-		return;
-	}
-
-	/* Device monitors won't have children, so don't bother looking.
-	 */
-	if (current_place->interface->monitor_class == AST_CC_DEVICE_MONITOR) {
-		cc_unref(monitor, "Device monitor unref from finding or creating");
-		return;
-	}
-
-	while ((tree_item = AST_LIST_NEXT(tree_item, next))) {
-		if (tree_item->parent_id == current_place->id) {
-			interface_tree_to_monitor(tree_item, monitor, core_id);
-		}
-	}
-	cc_unref(monitor, "Unref extension monitor from finding or creating");
-}
-
-static int cc_monitor_tree_init(const int core_id)
-{
-	struct cc_core_instance *core_instance;
-
-	if (!(core_instance = find_cc_core_instance(core_id))) {
-		return -1;
-	}
-
-	ast_assert(core_instance->monitor == NULL);
-
-	interface_tree_to_monitor(AST_LIST_FIRST(core_instance->agent->interface_tree),
-			root_monitor, core_instance->core_id);
-	core_instance->monitor = root_monitor;
-	ast_atomic_fetchadd_int(&cc_request_count, +1);
-
-	cc_unref(core_instance, "Unref the core instance we just found");
-	return 0;
 }
 
 /*!
@@ -2656,7 +2582,6 @@
 		return -1;
 	}
 	core_instance->agent->callbacks->stop_offer_timer(core_instance->agent);
-	cc_monitor_tree_init(args->core_id);
 	/* It doesn't matter what service we state for the root monitor, so we just use AST_CC_NONE */
 	core_instance->monitor->callbacks->request_cc(core_instance->monitor, core_instance->core_id, NULL);
 	manager_event(EVENT_FLAG_CC, "CCRequested",
@@ -2877,7 +2802,7 @@
 	struct cc_recall_ds_data *recall_data;
 	struct ast_cc_interface_tree *interface_tree;
 	char device_name[AST_CHANNEL_NAME];
-	struct cc_tree_item *exten_tree_item;
+	struct cc_monitor *exten_monitor;
 	struct ast_str *extencontext = ast_str_alloca(128);
 
 	ast_assert(core_id != NULL);
@@ -2925,18 +2850,18 @@
 	 * context as the channel.
 	 */
 	AST_LIST_LOCK(interface_tree);
-	AST_LIST_TRAVERSE(interface_tree, exten_tree_item, next) {
+	AST_LIST_TRAVERSE(interface_tree, exten_monitor, next) {
 		/* First we try to find an extension interface with the proper
 		 * exten and context.
 		 */
-		if (!strcmp(exten_tree_item->interface->name, ast_str_buffer(extencontext))) {
+		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_tree_item *device_tree_item = exten_tree_item;
-			while ((device_tree_item = AST_LIST_NEXT(device_tree_item, next))) {
-				if ((device_tree_item->parent_id == exten_tree_item->id) &&
-						!strcmp(device_tree_item->interface->name, device_name)) {
+			struct cc_monitor *device_monitor = exten_monitor;
+			while ((device_monitor = AST_LIST_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_LIST_UNLOCK(interface_tree);
@@ -2953,7 +2878,7 @@
 {
 	struct ast_datastore *recall_datastore;
 	struct ast_cc_interface_tree *interface_tree;
-	struct cc_tree_item *tree_item_iter;
+	struct cc_monitor *monitor_iter;
 	struct cc_recall_ds_data *recall_data;
 	unsigned int exten_id = 0;
 	struct ast_str *var_value = ast_str_create(64);
@@ -2970,9 +2895,9 @@
 	recall_data = recall_datastore->data;
 	interface_tree = recall_data->interface_tree;
 
-	AST_LIST_TRAVERSE(interface_tree, tree_item_iter, next) {
-		if (!strcmp(tree_item_iter->interface->name, extension)) {
-			exten_id = tree_item_iter->id;
+	AST_LIST_TRAVERSE(interface_tree, monitor_iter, next) {
+		if (!strcmp(monitor_iter->interface->name, extension)) {
+			exten_id = monitor_iter->id;
 			break;
 		}
 	}
@@ -2987,11 +2912,11 @@
 		return -1;
 	}
 
-	/* 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 && strcmp(tree_item_iter->dialable_name, previous_dialable_name)) {
-			char *dialable_name = tree_item_iter->dialable_name;
+	/* I kind of feel wrong re-using monitor_iter here, but eh, it works
+	 */
+	while ((monitor_iter = AST_LIST_NEXT(monitor_iter, next))) {
+		if (monitor_iter->parent_id == exten_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));




More information about the asterisk-commits mailing list