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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jan 22 14:28:42 CST 2010


Author: mmichelson
Date: Fri Jan 22 14:28:39 2010
New Revision: 242416

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=242416
Log:
Remove agent->interface_tree since the core_instance has that information
and there's no need to duplicate it.


Modified:
    team/group/CCSS_Monitor_Restructure/include/asterisk/ccss.h
    team/group/CCSS_Monitor_Restructure/main/ccss.c

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=242416&r1=242415&r2=242416
==============================================================================
--- team/group/CCSS_Monitor_Restructure/include/asterisk/ccss.h (original)
+++ team/group/CCSS_Monitor_Restructure/include/asterisk/ccss.h Fri Jan 22 14:28:39 2010
@@ -722,18 +722,6 @@
 	 * agent's operation.
 	 */
 	struct ast_cc_config_params *cc_params;
-	/*!
-	 * \brief The "tree" of interfaces dialed by the caller
-	 *
-	 * \details
-	 * In actuality, this is a linked list. Each element
-	 * contains an integer which tells who its parent is
-	 * in the tree. The tree is arranged in such a way that
-	 * all children of an interface will always appear later
-	 * in the list. We take advantage of this fact later when
-	 * creating the monitor structure.
-	 */
-	struct ast_cc_interface_tree *interface_tree;
 	/*!
 	 * \brief Flags for agent operation
 	 *

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=242416&r1=242415&r2=242416
==============================================================================
--- team/group/CCSS_Monitor_Restructure/main/ccss.c (original)
+++ team/group/CCSS_Monitor_Restructure/main/ccss.c Fri Jan 22 14:28:39 2010
@@ -155,6 +155,15 @@
 };
 
 /*!
+ * \brief The "tree" of interfaces that is dialed.
+ *
+ * It is reference counted since several threads may need
+ * to use it, and it may last beyond the lifetime of a single
+ * thread.
+ */
+AST_DLLIST_HEAD(ast_cc_interface_tree, cc_monitor);
+
+/*!
  * \internal
  * \brief Request that the core change states
  * \param state The state to which we wish to change
@@ -1208,15 +1217,6 @@
 	cc_unref(generic_list, "Done with generic list in generic monitor destructor");
 	ast_free((char *)gen_mon_pvt->device_name);
 }
-
-/*!
- * \brief The "tree" of interfaces that is dialed.
- *
- * It is reference counted since several threads may need
- * to use it, and it may last beyond the lifetime of a single
- * thread.
- */
-AST_DLLIST_HEAD(ast_cc_interface_tree, cc_monitor);
 
 static void cc_interface_destroy(void *data)
 {
@@ -1856,7 +1856,6 @@
 	if (agent->callbacks) {
 		agent->callbacks->destructor(agent);
 	}
-	agent->interface_tree = cc_unref(agent->interface_tree, "Destroying agent, removing ref to interface tree");
 	ast_cc_config_params_destroy(agent->cc_params);
 }
 
@@ -1873,7 +1872,6 @@
 
 	agent->core_id = core_id;
 	strcpy(agent->interface, caller_name);
-	agent->interface_tree = cc_ref(interface_tree, "Agent now has reference to interface tree");
 
 	cc_params = ast_channel_get_cc_config_params(caller_chan);
 	if (!cc_params) {
@@ -1956,6 +1954,22 @@
 	 * is the caller's name.
 	 */
 	char cid_name[AST_CHANNEL_NAME];
+	/*!
+	 * Extension dialed
+	 *
+	 * The original extension dialed. This is used
+	 * so that when performing a recall, we can
+	 * call the proper extension.
+	 */
+	char exten[AST_CHANNEL_NAME];
+	/*!
+	 * Context dialed
+	 *
+	 * The original context dialed. This is used
+	 * so that when performaing a recall, we can
+	 * call into the proper context
+	 */
+	char context[AST_CHANNEL_NAME];
 };
 
 static int cc_generic_agent_init(struct ast_cc_agent *agent, struct ast_channel *chan)
@@ -1969,6 +1983,8 @@
 	generic_pvt->offer_timer_id = -1;
 	ast_copy_string(generic_pvt->cid_num, chan->cid.cid_num, sizeof(generic_pvt->cid_num));
 	ast_copy_string(generic_pvt->cid_name, chan->cid.cid_name, sizeof(generic_pvt->cid_name));
+	ast_copy_string(generic_pvt->exten, S_OR(chan->macroexten, chan->exten), sizeof(generic_pvt->exten));
+	ast_copy_string(generic_pvt->context, S_OR(chan->macrocontext, chan->context), sizeof(generic_pvt->context));
 	agent->private_data = generic_pvt;
 	ast_set_flag(agent, AST_CC_AGENT_SKIP_OFFER);
 	return 0;
@@ -2092,10 +2108,6 @@
 	char *target;
 	int reason;
 	struct ast_channel *chan;
-	struct cc_monitor *monitor = AST_DLLIST_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);
 
 	tech = interface;
@@ -2123,14 +2135,10 @@
 	 * function to do so.
 	 */
 	ast_setup_cc_recall_datastore(chan, agent->core_id);
-	ast_set_cc_interfaces_chanvar(chan, full_extension);
-	/* Now we can bust apart the outbound name so that the PBX will run. */
-	exten = full_extension;
-	if ((context = strchr(full_extension, '@'))) {
-		*context++ = '\0';
-	}
-	ast_copy_string(chan->exten, exten, sizeof(chan->exten));
-	ast_copy_string(chan->context, context, sizeof(chan->context));
+	ast_cc_agent_set_interfaces_chanvar(chan, agent);
+	
+	ast_copy_string(chan->exten, generic_pvt->exten, sizeof(chan->exten));
+	ast_copy_string(chan->context, generic_pvt->context, sizeof(chan->context));
 	chan->priority = 1;
 	ast_cc_agent_recalling(agent->core_id, "Generic agent is recalling");
 	ast_pbx_start(chan);
@@ -2636,7 +2644,7 @@
 		return -1;
 	}
 
-	recall_data->interface_tree = cc_ref(core_instance->agent->interface_tree,
+	recall_data->interface_tree = cc_ref(core_instance->monitors,
 			"Bump refcount for interface tree for agent");
 	recall_data->core_id = core_id;
 	recall_datastore->data = recall_data;




More information about the asterisk-commits mailing list