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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 20 13:38:47 CST 2010


Author: mmichelson
Date: Wed Jan 20 13:38:45 2010
New Revision: 241625

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=241625
Log:
Wipe out traces of old method of requesting CC.


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=241625&r1=241624&r2=241625
==============================================================================
--- team/group/CCSS_Monitor_Restructure/main/ccss.c (original)
+++ team/group/CCSS_Monitor_Restructure/main/ccss.c Wed Jan 20 13:38:45 2010
@@ -923,7 +923,6 @@
 };
 
 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);
 static int cc_extension_monitor_unsuspend(struct ast_cc_monitor *monitor, const int core_id);
@@ -934,7 +933,6 @@
 static struct ast_cc_monitor_callbacks extension_monitor_cbs = {
 	.type = "extension",
 	.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,
 	.unsuspend = cc_extension_monitor_unsuspend,
@@ -945,43 +943,6 @@
 
 static int cc_butt_extension_monitor_init(struct ast_cc_monitor *monitor, const int core_id)
 {
-	return 0;
-}
-
-static int cc_extension_monitor_request_cc(struct ast_cc_monitor *monitor, const int core_id, struct ast_cc_monitor_link *parent_link)
-{
-	struct ast_cc_monitor_link *link_iter;
-	int all_children_failed = 1;
-	AST_LIST_TRAVERSE(&monitor->child_links, link_iter, next_child) {
-		if (link_iter->core_id != core_id) {
-			continue;
-		}
-		ast_assert(link_iter->child != NULL);
-		ast_assert(link_iter->child->callbacks != NULL);
-		if (link_iter->child->callbacks->request_cc(link_iter->child, core_id, link_iter)) {
-			prune_links(link_iter->child, core_id, link_iter);
-		} else {
-			all_children_failed = 0;
-			if (link_iter->child->interface->monitor_class == AST_CC_DEVICE_MONITOR) {
-				manager_event(EVENT_FLAG_CC, "CCRequestSent",
-					"CoreID: %d\r\n"
-					"Callee: %s\r\n",
-					link_iter->core_id, link_iter->child->interface->name);
-			}
-		}
-	}
-	if (all_children_failed) {
-		/* None of the child monitors successfully requested
-		 * CC, and so all of the child links were pruned. If this
-		 * is an extension monitor, just return -1. If this is the
-		 * root monitor, then that means failure all around, so request
-		 * a state change to CC_FAILED
-		 */
-		if (monitor->interface->monitor_class == AST_CC_ROOT_MONITOR) {
-			ast_cc_failed(core_id, "All monitors failed to request CC");
-		}
-		return -1;
-	}
 	return 0;
 }
 
@@ -1058,7 +1019,6 @@
 }
 
 static int cc_generic_monitor_init(struct ast_cc_monitor *monitor, const int core_id);
-static int cc_generic_monitor_request_cc(struct ast_cc_monitor *monitor, const int core_id, struct ast_cc_monitor_link *parent_link);
 static int cc_generic_monitor_request_cc2(struct cc_monitor *monitor, int *available_timer_id);
 static int cc_generic_monitor_suspend(struct ast_cc_monitor *monitor, const int core_id);
 static int cc_generic_monitor_status_response(struct ast_cc_monitor *monitor, const int core_id, enum ast_device_state devstate);
@@ -1070,7 +1030,6 @@
 static struct ast_cc_monitor_callbacks generic_monitor_cbs = {
 	.type = "generic",
 	.init = cc_generic_monitor_init,
-	.request_cc = cc_generic_monitor_request_cc,
 	.request_cc2 = cc_generic_monitor_request_cc2,
 	.suspend = cc_generic_monitor_suspend,
 	.status_response = cc_generic_monitor_status_response,
@@ -1276,51 +1235,6 @@
 	*available_timer_id = ast_sched_thread_add(cc_sched_thread, when * 1000,
 			ast_cc_available_timer_expire, monitor);
 	cc_unref(generic_list, "Finished with monitor instance reference in request cc callback");
-	return 0;
-}
-
-static int cc_generic_monitor_request_cc(struct ast_cc_monitor *monitor, const int core_id, struct ast_cc_monitor_link *parent_link)
-{
-	struct generic_monitor_pvt *gen_mon_pvt = monitor->private_data;
-	enum ast_cc_service_type service = parent_link->service;
-	int when;
-
-	gen_mon_pvt->current_state = ast_device_state(monitor->interface->name);
-
-	/* We can monitor a device for one of two services, CCBS or CCNR.
-	 *
-	 * In the case of CCBS, When the state of the device changes to "not in use" then
-	 * this means that it is ready to be called back. Also, with CCBS, it is important that
-	 * we check the current device state in case it changed to "not in use" between when
-	 * the initial call failed and now.
-	 *
-	 * In the case of CCNR, the state of the device will likely already be "not in use." However,
-	 * the next time that the device state *changes* to "not in use" that will be indication that
-	 * the phone has been used and that we may try ringing the phone again.
-	 */
-
-	/* XXX Is there a race condition here? If we happen to see that the status is not "not in use" but then
-	 * the device state changes to "not in use" before we are able to subscribe to the device state event, then
-	 * will that mean a missed opportunity?
-	 */
-	if (service == AST_CC_CCBS && gen_mon_pvt->current_state == AST_DEVICE_NOT_INUSE) {
-		ast_cc_monitor_request_acked(core_id, "Formality. Device is already available but we have to go through the motions\n");
-		return ast_cc_monitor_callee_available(monitor);
-	}
-
-	when = service == AST_CC_CCBS ? ast_get_ccbs_available_timer(monitor->interface->config_params) :
-		ast_get_ccnr_available_timer(monitor->interface->config_params);
-
-	parent_link->child_avail_id = ast_sched_thread_add(cc_sched_thread, when * 1000,
-			ast_cc_available_timer_expire, parent_link);
-
-	if (!gen_mon_pvt->sub && !(gen_mon_pvt->sub = ast_event_subscribe(
-			AST_EVENT_DEVICE_STATE, generic_monitor_devstate_cb, "Requesting CC", monitor,
-			AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, monitor->interface->name,
-			AST_EVENT_IE_END))) {
-		return -1;
-	}
-	ast_cc_monitor_request_acked(core_id, "Generic monitor subscribed to device state.\n");
 	return 0;
 }
 




More information about the asterisk-commits mailing list