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

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


Author: mmichelson
Date: Wed Jan 20 13:34:31 2010
New Revision: 241622

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=241622
Log:
Add available timer handling to request_cc2 operation


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=241622&r1=241621&r2=241622
==============================================================================
--- team/group/CCSS_Monitor_Restructure/main/ccss.c (original)
+++ team/group/CCSS_Monitor_Restructure/main/ccss.c Wed Jan 20 13:34:31 2010
@@ -893,6 +893,9 @@
 	 * least 1 as their parent_id.
 	 */
 	unsigned int parent_id;
+	/* The instance of the CC core to which this monitor belongs
+	 */
+	int core_id;
 	/* What service was offered by the endpoint. Note that
 	 * this field is completely irrelevant for cc_monitors
 	 * representing dialplan extensions.
@@ -1242,15 +1245,17 @@
 
 int ast_cc_available_timer_expire(const void *data)
 {
-	struct ast_cc_monitor_link *link = (struct ast_cc_monitor_link *) data;
-	link->child_avail_id = -1;
-	return ast_cc_monitor_failed(link->core_id, link->child->interface->name, link->child->interface->monitor_type);
+	struct cc_monitor *monitor = (struct cc_monitor *) data;
+	monitor->available_timer_id = -1;
+	return ast_cc_monitor_failed(monitor->core_id, monitor->interface->name, monitor->interface->monitor_type);
 }
 
 static int cc_generic_monitor_request_cc2(struct cc_monitor *monitor, int *available_timer_id)
 {
 	struct generic_monitor_instance_list *generic_list;
 	struct generic_monitor_instance *generic_instance;
+	enum ast_cc_service_type service = monitor->service_offered;
+	int when;
 
 	if (!(generic_list = find_generic_monitor_instance_list(monitor->interface->name))) {
 		if (!(generic_list = create_new_generic_list(monitor))) {
@@ -1265,6 +1270,11 @@
 		cc_unref(generic_list, "Generic monitor instance failed to allocate");
 		return -1;
 	}
+	when = service == AST_CC_CCBS ? ast_get_ccbs_available_timer(monitor->interface->config_params) :
+		ast_get_ccnr_available_timer(monitor->interface->config_params);
+
+	*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;
 }
@@ -1717,7 +1727,7 @@
  * \retval NULL Memory allocation failure
  * \retval non-NULL The new ast_cc_interface created.
  */
-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)
+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, int core_id)
 {
 	struct ast_cc_interface *cc_interface;
 	struct cc_monitor *monitor;
@@ -1753,6 +1763,7 @@
 	strcpy(cc_interface->name, device_name);
 	monitor->id = ast_atomic_fetchadd_int(&dialed_cc_interface_counter, +1);
 	monitor->parent_id = parent_id;
+	monitor->core_id = core_id;
 	monitor->service_offered = cc_data->service;
 	cc_interface->monitor_type = cc_data->monitor_type;
 	cc_interface->monitor_class = AST_CC_DEVICE_MONITOR;
@@ -1848,7 +1859,7 @@
 	AST_DLLIST_UNLOCK(cc_interfaces->interface_tree);
 
 
-	if (!(monitor = cc_device_monitor_init(device_name, dialable_name, cc_data))) {
+	if (!(monitor = cc_device_monitor_init(device_name, dialable_name, cc_data, cc_interfaces->core_id))) {
 		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;




More information about the asterisk-commits mailing list