[asterisk-commits] rmudgett: branch group/CCSS_Monitor_Restructure r244439 - /team/group/CCSS_Mo...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Feb 2 16:02:28 CST 2010


Author: rmudgett
Date: Tue Feb  2 16:02:23 2010
New Revision: 244439

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=244439
Log:
Update chan_dahdi with CCSS monitor restructuring changes.

Modified:
    team/group/CCSS_Monitor_Restructure/channels/chan_dahdi.c
    team/group/CCSS_Monitor_Restructure/channels/sig_analog.c
    team/group/CCSS_Monitor_Restructure/channels/sig_pri.c
    team/group/CCSS_Monitor_Restructure/channels/sig_pri.h

Modified: team/group/CCSS_Monitor_Restructure/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS_Monitor_Restructure/channels/chan_dahdi.c?view=diff&rev=244439&r1=244438&r2=244439
==============================================================================
--- team/group/CCSS_Monitor_Restructure/channels/chan_dahdi.c (original)
+++ team/group/CCSS_Monitor_Restructure/channels/chan_dahdi.c Tue Feb  2 16:02:23 2010
@@ -2864,6 +2864,30 @@
 	snprintf(buf, buf_size, "%s/i%d-%s", args.tech, pvt->pri->span, args.group);
 }
 
+/*!
+ * \internal
+ * \brief Reference this module.
+ * \since 1.8
+ *
+ * \return Nothing
+ */
+static void my_module_ref(void)
+{
+	ast_module_ref(ast_module_info->self);
+}
+
+/*!
+ * \internal
+ * \brief Unreference this module.
+ * \since 1.8
+ *
+ * \return Nothing
+ */
+static void my_module_unref(void)
+{
+	ast_module_unref(ast_module_info->self);
+}
+
 static int dahdi_new_pri_nobch_channel(struct sig_pri_pri *pri);
 
 static struct sig_pri_callback dahdi_pri_callbacks =
@@ -2884,6 +2908,8 @@
 	.new_nobch_intf = dahdi_new_pri_nobch_channel,
 	.get_orig_dialstring = my_get_orig_dialstring,
 	.make_cc_dialstring = my_pri_make_cc_dialstring,
+	.module_ref = my_module_ref,
+	.module_unref = my_module_unref,
 };
 #endif	/* defined(HAVE_PRI) */
 
@@ -12536,7 +12562,7 @@
 #else
 					p->cc_params,
 #endif	/* defined(HAVE_PRI) */
-					monitor_type, full_device_name, dialstring);
+					monitor_type, full_device_name, dialstring, NULL);
 				break;
 			}
 		}
@@ -15967,72 +15993,14 @@
 
 #if defined(HAVE_PRI)
 #if defined(HAVE_PRI_CCSS)
-/*!
- * \internal
- * \brief CC monitor initialization.
- * \since 1.8
- *
- * \param monitor CC core monitor control.
- * \param core_id core_id of the CC transaction.
- *
- * \details
- * Implementers must allocate the monitor's private_data
- * and initialize it to whatever may be necessary.
- *
- * \retval 0 on success
- * \retval -1 on failure.
- */
-static int dahdi_pri_cc_monitor_init(struct ast_cc_monitor *monitor, const int core_id)
-{
-	int res;
-
-	ast_module_ref(ast_module_info->self);
-
-	res = sig_pri_cc_monitor_init(monitor, core_id);
-	if (res) {
-		ast_module_unref(ast_module_info->self);
-	}
-	return res;
-}
-
-#endif	/* defined(HAVE_PRI_CCSS) */
-#endif	/* defined(HAVE_PRI) */
-
-#if defined(HAVE_PRI)
-#if defined(HAVE_PRI_CCSS)
-/*!
- * \internal
- * \brief Destroy private data on the monitor.
- * \since 1.8
- *
- * \param monitor CC core monitor control.
- *
- * \details
- * Implementers of this callback are responsible for destroying
- * all heap-allocated data in the monitor's private_data pointer, including
- * the private_data itself.
- */
-static void dahdi_pri_cc_monitor_destructor(struct ast_cc_monitor *monitor)
-{
-	sig_pri_cc_monitor_destructor(monitor);
-
-	ast_module_unref(ast_module_info->self);
-}
-#endif	/* defined(HAVE_PRI_CCSS) */
-#endif	/* defined(HAVE_PRI) */
-
-#if defined(HAVE_PRI)
-#if defined(HAVE_PRI_CCSS)
 static struct ast_cc_monitor_callbacks dahdi_pri_cc_monitor_callbacks = {
 	.type = dahdi_pri_cc_type,
-	.init = dahdi_pri_cc_monitor_init,
 	.request_cc = sig_pri_cc_monitor_req_cc,
 	.suspend = sig_pri_cc_monitor_suspend,
 	.unsuspend = sig_pri_cc_monitor_unsuspend,
 	.status_response = sig_pri_cc_monitor_status_rsp,
 	.cancel_available_timer = sig_pri_cc_monitor_cancel_available_timer,
-	.destructor = dahdi_pri_cc_monitor_destructor,
-	.instance_destructor = sig_pri_cc_monitor_instance_destructor,
+	.destructor = sig_pri_cc_monitor_destructor,
 };
 #endif	/* defined(HAVE_PRI_CCSS) */
 #endif	/* defined(HAVE_PRI) */

Modified: team/group/CCSS_Monitor_Restructure/channels/sig_analog.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS_Monitor_Restructure/channels/sig_analog.c?view=diff&rev=244439&r1=244438&r2=244439
==============================================================================
--- team/group/CCSS_Monitor_Restructure/channels/sig_analog.c (original)
+++ team/group/CCSS_Monitor_Restructure/channels/sig_analog.c Tue Feb  2 16:02:23 2010
@@ -962,7 +962,7 @@
 				case AST_CC_MONITOR_ALWAYS:
 				case AST_CC_MONITOR_GENERIC:
 					ast_queue_cc_frame(p->subs[index].owner, AST_CC_GENERIC_MONITOR_TYPE,
-						analog_get_orig_dialstring(p), AST_CC_CCNR);
+						analog_get_orig_dialstring(p), AST_CC_CCNR, NULL);
 					break;
 				}
 			}

Modified: team/group/CCSS_Monitor_Restructure/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS_Monitor_Restructure/channels/sig_pri.c?view=diff&rev=244439&r1=244438&r2=244439
==============================================================================
--- team/group/CCSS_Monitor_Restructure/channels/sig_pri.c (original)
+++ team/group/CCSS_Monitor_Restructure/channels/sig_pri.c Tue Feb  2 16:02:23 2010
@@ -66,12 +66,6 @@
 };
 
 struct sig_pri_cc_monitor_instance {
-	/*!
-	 * \brief CC core monitor structure associted with this monitor instance.
-	 * \note NULL if no association established.
-	 * \note Holds a reference to the CC core monitor if not NULL.
-	 */
-	struct ast_cc_monitor *monitor;
 	/*! \brief Asterisk span D channel control structure. */
 	struct sig_pri_pri *pri;
 	/*! CC id value to use with libpri. (-1 if already canceled). */
@@ -1629,32 +1623,6 @@
 #if defined(HAVE_PRI_CCSS)
 /*!
  * \internal
- * \brief Find the CC monitor instance by CC core_id.
- * \since 1.8
- *
- * \param core_id CC core ID.
- *
- * \note
- * Since monitor_instances are refcounted, and this function returns
- * a reference to the instance, it is imperative that you decrement
- * the refcount of the instance once you have finished using it.
- *
- * \retval monitor_instance on success.
- * \retval NULL not found.
- */
-static struct sig_pri_cc_monitor_instance *sig_pri_find_cc_monitor_by_core_id(int core_id)
-{
-	struct sig_pri_cc_monitor_instance finder = {
-		.core_id = core_id,
-	};
-
-	return ao2_find(sig_pri_cc_monitors, &finder, OBJ_POINTER);
-}
-#endif	/* defined(HAVE_PRI_CCSS) */
-
-#if defined(HAVE_PRI_CCSS)
-/*!
- * \internal
  * \brief Destroy the given monitor instance.
  * \since 1.8
  *
@@ -1671,10 +1639,7 @@
 		pri_cc_cancel(monitor_instance->pri->pri, monitor_instance->cc_id);
 		ast_mutex_unlock(&monitor_instance->pri->lock);
 	}
-
-	if (monitor_instance->monitor) {
-		ao2_ref(monitor_instance->monitor, -1);
-	}
+	monitor_instance->pri->calls->module_unref();
 }
 #endif	/* defined(HAVE_PRI_CCSS) */
 
@@ -1701,6 +1666,10 @@
 {
 	struct sig_pri_cc_monitor_instance *monitor_instance;
 
+	if (!pri->calls->module_ref || !pri->calls->module_unref) {
+		return NULL;
+	}
+
 	monitor_instance = ao2_alloc(sizeof(*monitor_instance) + strlen(device_name),
 		sig_pri_cc_monitor_instance_destroy);
 	if (!monitor_instance) {
@@ -1711,6 +1680,8 @@
 	monitor_instance->pri = pri;
 	monitor_instance->core_id = core_id;
 	strcpy(monitor_instance->name, device_name);
+
+	pri->calls->module_ref();
 
 	ao2_link(sig_pri_cc_monitors, monitor_instance);
 	return monitor_instance;
@@ -1773,16 +1744,20 @@
 		ast_channel_get_device_name(pvt->owner, device_name, sizeof(device_name));
 		sig_pri_make_cc_dialstring(pvt, dialstring, sizeof(dialstring));
 		monitor = sig_pri_cc_monitor_instance_init(core_id, pri, cc_id, device_name);
-		res = ast_queue_cc_frame(pvt->owner, sig_pri_cc_type_name, dialstring, service);
+		if (!monitor) {
+			break;
+		}
+		res = ast_queue_cc_frame(pvt->owner, sig_pri_cc_type_name, dialstring, service,
+			monitor);
 		if (res) {
+			monitor->cc_id = -1;
 			ao2_unlink(sig_pri_cc_monitors, monitor);
-			monitor->cc_id = -1;
-		}
-		ao2_ref(monitor, -1);
+			ao2_ref(monitor, -1);
+		}
 		break;
 	case AST_CC_MONITOR_GENERIC:
 		ast_queue_cc_frame(pvt->owner, AST_CC_GENERIC_MONITOR_TYPE,
-			sig_pri_get_orig_dialstring(pvt), service);
+			sig_pri_get_orig_dialstring(pvt), service, NULL);
 		/* Say it failed to force caller to cancel native CC. */
 		break;
 	}
@@ -1809,7 +1784,8 @@
 	struct ast_channel *owner;
 	struct ast_cc_config_params *cc_params;
 #if defined(HAVE_PRI_CCSS)
-	struct sig_pri_cc_monitor_instance *monitor;
+	struct ast_cc_monitor *monitor;
+	char device_name[AST_CHANNEL_NAME];
 #endif	/* defined(HAVE_PRI_CCSS) */
 	enum ast_cc_monitor_policies monitor_policy;
 	int core_id;
@@ -1837,7 +1813,8 @@
 	}
 
 #if defined(HAVE_PRI_CCSS)
-	monitor = sig_pri_find_cc_monitor_by_core_id(core_id);
+	ast_channel_get_device_name(owner, device_name, sizeof(device_name));
+	monitor = ast_cc_get_monitor_by_recall_core_id(core_id, device_name);
 	if (monitor) {
 		/* CC monitor is already present so no need for generic CC. */
 		ao2_ref(monitor, -1);
@@ -1854,7 +1831,7 @@
 		if (pri->sig == SIG_BRI_PTMP && pri->nodetype == PRI_NETWORK) {
 			/* Request generic CC monitor. */
 			ast_queue_cc_frame(owner, AST_CC_GENERIC_MONITOR_TYPE,
-				sig_pri_get_orig_dialstring(pri->pvts[chanpos]), service);
+				sig_pri_get_orig_dialstring(pri->pvts[chanpos]), service, NULL);
 		}
 		break;
 	case AST_CC_MONITOR_ALWAYS:
@@ -1872,13 +1849,13 @@
 		 * Request generic CC monitor.
 		 */
 		ast_queue_cc_frame(owner, AST_CC_GENERIC_MONITOR_TYPE,
-			sig_pri_get_orig_dialstring(pri->pvts[chanpos]), service);
+			sig_pri_get_orig_dialstring(pri->pvts[chanpos]), service, NULL);
 		break;
 	case AST_CC_MONITOR_GENERIC:
 		if (pri->sig == SIG_BRI_PTMP && pri->nodetype == PRI_NETWORK) {
 			/* Request generic CC monitor. */
 			ast_queue_cc_frame(owner, AST_CC_GENERIC_MONITOR_TYPE,
-				sig_pri_get_orig_dialstring(pri->pvts[chanpos]), service);
+				sig_pri_get_orig_dialstring(pri->pvts[chanpos]), service, NULL);
 		}
 		break;
 	}
@@ -1917,10 +1894,9 @@
 		if (!monitor) {
 			return;
 		}
-		ao2_unlink(sig_pri_cc_monitors, monitor);
 		monitor->cc_id = -1;
 		ast_cc_monitor_failed(monitor->core_id, monitor->name,
-			sig_pri_cc_type_name);
+			"ISDN monitor got canceled by link");
 		ao2_ref(monitor, -1);
 	}
 }
@@ -2026,37 +2002,29 @@
 			case 1:/* timeout */
 				ast_verb(2, "core_id:%d %s CC request timeout\n", monitor->core_id,
 					sig_pri_cc_type_name);
-				ao2_unlink(sig_pri_cc_monitors, monitor);
-				monitor->cc_id = -1;
 				ast_cc_monitor_failed(monitor->core_id, monitor->name,
-					sig_pri_cc_type_name);
+					"ISDN CC request timeout");
 				break;
 			case 2:/* error */
 				ast_verb(2, "core_id:%d %s CC request error: %s\n", monitor->core_id,
 					sig_pri_cc_type_name,
 					pri_facility_error2str(subcmd->u.cc_request_rsp.fail_code));
-				ao2_unlink(sig_pri_cc_monitors, monitor);
-				monitor->cc_id = -1;
 				ast_cc_monitor_failed(monitor->core_id, monitor->name,
-					sig_pri_cc_type_name);
+					"ISDN CC request error");
 				break;
 			case 3:/* reject */
 				ast_verb(2, "core_id:%d %s CC request reject: %s\n", monitor->core_id,
 					sig_pri_cc_type_name,
 					pri_facility_reject2str(subcmd->u.cc_request_rsp.fail_code));
-				ao2_unlink(sig_pri_cc_monitors, monitor);
-				monitor->cc_id = -1;
 				ast_cc_monitor_failed(monitor->core_id, monitor->name,
-					sig_pri_cc_type_name);
+					"ISDN CC request reject");
 				break;
 			default:
 				ast_verb(2, "core_id:%d %s CC request unknown status %d\n",
 					monitor->core_id, sig_pri_cc_type_name,
 					subcmd->u.cc_request_rsp.status);
-				ao2_unlink(sig_pri_cc_monitors, monitor);
-				monitor->cc_id = -1;
 				ast_cc_monitor_failed(monitor->core_id, monitor->name,
-					sig_pri_cc_type_name);
+					"ISDN CC request unknown status");
 				break;
 			}
 			ao2_ref(monitor, -1);
@@ -2070,9 +2038,7 @@
 				pri_cc_cancel(pri->pri, subcmd->u.cc_remote_user_free.cc_id);
 				break;
 			}
-			if (ast_cc_monitor_callee_available(monitor->monitor)) {
-				ao2_unlink(sig_pri_cc_monitors, monitor);
-			}
+			ast_cc_monitor_callee_available(monitor->core_id);
 			ao2_ref(monitor, -1);
 			break;
 #endif	/* defined(HAVE_PRI_CCSS) */
@@ -2084,9 +2050,7 @@
 				pri_cc_cancel(pri->pri, subcmd->u.cc_b_free.cc_id);
 				break;
 			}
-			if (ast_cc_monitor_party_b_free(monitor->core_id)) {
-				ao2_unlink(sig_pri_cc_monitors, monitor);
-			}
+			ast_cc_monitor_party_b_free(monitor->core_id);
 			ao2_ref(monitor, -1);
 			break;
 #endif	/* defined(HAVE_PRI_CCSS) */
@@ -2098,9 +2062,7 @@
 				pri_cc_cancel(pri->pri, subcmd->u.cc_status_req.cc_id);
 				break;
 			}
-			if (ast_cc_monitor_status_request(monitor->core_id)) {
-				ao2_unlink(sig_pri_cc_monitors, monitor);
-			}
+			ast_cc_monitor_status_request(monitor->core_id);
 			ao2_ref(monitor, -1);
 			break;
 #endif	/* defined(HAVE_PRI_CCSS) */
@@ -2147,9 +2109,7 @@
 				pri_cc_cancel(pri->pri, subcmd->u.cc_stop_alerting.cc_id);
 				break;
 			}
-			if (ast_cc_monitor_stop_ringing(monitor->core_id)) {
-				ao2_unlink(sig_pri_cc_monitors, monitor);
-			}
+			ast_cc_monitor_stop_ringing(monitor->core_id);
 			ao2_ref(monitor, -1);
 			break;
 #endif	/* defined(HAVE_PRI_CCSS) */
@@ -4520,18 +4480,24 @@
 
 #if defined(HAVE_PRI_CCSS)
 	if (ast_cc_is_recall(ast, &core_id, sig_pri_cc_type_name)) {
-		struct sig_pri_cc_monitor_instance *monitor;
+		struct ast_cc_monitor *monitor;
+		char device_name[AST_CHANNEL_NAME];
 
 		/* This is a CC recall call. */
-		monitor = sig_pri_find_cc_monitor_by_core_id(core_id);
+		ast_channel_get_device_name(ast, device_name, sizeof(device_name));
+		monitor = ast_cc_get_monitor_by_recall_core_id(core_id, device_name);
 		if (monitor) {
+			struct sig_pri_cc_monitor_instance *instance;
+
+			instance = monitor->private_data;
+
 			/* If this fails then we have monitor instance ambiguity. */
-			ast_assert(p->pri == monitor->pri);
-
-			if (pri_cc_call(p->pri->pri, monitor->cc_id, p->call, sr)) {
+			ast_assert(p->pri == instance->pri);
+
+			if (pri_cc_call(p->pri->pri, instance->cc_id, p->call, sr)) {
 				/* The CC recall call failed for some reason. */
 				ast_log(LOG_WARNING, "Unable to setup CC recall call to device %s\n",
-					monitor->name);
+					device_name);
 				ao2_ref(monitor, -1);
 				pri_rel(p->pri);
 				pri_sr_free(sr);
@@ -5416,33 +5382,11 @@
 
 #if defined(HAVE_PRI_CCSS)
 /*!
- * \brief PRI CC monitor initialization.
- * \since 1.8
- *
- * \param monitor CC core monitor control.
- * \param core_id core_id of the CC transaction.
- *
- * \details
- * Implementers must allocate the monitor's private_data
- * and initialize it to whatever may be necessary.
- *
- * \retval 0 on success
- * \retval -1 on failure.
- */
-int sig_pri_cc_monitor_init(struct ast_cc_monitor *monitor, const int core_id)
-{
-	return 0;
-}
-#endif	/* defined(HAVE_PRI_CCSS) */
-
-#if defined(HAVE_PRI_CCSS)
-/*!
  * \brief Request CCSS.
  * \since 1.8
  *
  * \param monitor CC core monitor control.
- * \param core_id core_id of the CC transaction.
- * \param parent_link The extention monitor of this monitor.
+ * \param available_timer_id Where to put the available timer scheduler id.
  * Will never be NULL for a device monitor.
  *
  * \details
@@ -5455,13 +5399,13 @@
  * \retval 0 on success
  * \retval -1 on failure.
  */
-int sig_pri_cc_monitor_req_cc(struct ast_cc_monitor *monitor, const int core_id, struct ast_cc_monitor_link *parent_link)
+int sig_pri_cc_monitor_req_cc(struct ast_cc_monitor *monitor, int *available_timer_id)
 {
 	struct sig_pri_cc_monitor_instance *instance;
 	int cc_mode;
 	int res;
 
-	switch (parent_link->service) {
+	switch (monitor->service_offered) {
 	case AST_CC_CCBS:
 		cc_mode = 0;/* CCBS */
 		break;
@@ -5473,21 +5417,13 @@
 		return -1;
 	}
 
-	instance = sig_pri_find_cc_monitor_by_core_id(core_id);
-	if (!instance) {
-		return -1;
-	}
-
-	/* Attach the core monitor to our monitor instance. */
-	instance->monitor = monitor;
-	ao2_ref(monitor, +1);
+	instance = monitor->private_data;
 
 	/* libpri handles it's own available timer. */
 	ast_mutex_lock(&instance->pri->lock);
 	res = pri_cc_req(instance->pri->pri, instance->cc_id, cc_mode);
 	ast_mutex_unlock(&instance->pri->lock);
 
-	ao2_ref(instance, -1);
 	return res;
 }
 #endif	/* defined(HAVE_PRI_CCSS) */
@@ -5498,7 +5434,6 @@
  * \since 1.8
  *
  * \param monitor CC core monitor control.
- * \param core_id core_id of the CC transaction.
  *
  * \details
  * Implementers must perform the necessary steps to suspend
@@ -5507,19 +5442,15 @@
  * \retval 0 on success
  * \retval -1 on failure.
  */
-int sig_pri_cc_monitor_suspend(struct ast_cc_monitor *monitor, const int core_id)
+int sig_pri_cc_monitor_suspend(struct ast_cc_monitor *monitor)
 {
 	struct sig_pri_cc_monitor_instance *instance;
 
-	instance = sig_pri_find_cc_monitor_by_core_id(core_id);
-	if (!instance) {
-		return -1;
-	}
+	instance = monitor->private_data;
 	ast_mutex_lock(&instance->pri->lock);
 	pri_cc_status(instance->pri->pri, instance->cc_id, 1/* busy */);
 	ast_mutex_unlock(&instance->pri->lock);
 
-	ao2_ref(instance, -1);
 	return 0;
 }
 #endif	/* defined(HAVE_PRI_CCSS) */
@@ -5530,7 +5461,6 @@
  * \since 1.8
  *
  * \param monitor CC core monitor control.
- * \param core_id core_id of the CC transaction.
  *
  * \details
  * Perform the necessary steps to unsuspend monitoring.
@@ -5538,19 +5468,15 @@
  * \retval 0 on success
  * \retval -1 on failure.
  */
-int sig_pri_cc_monitor_unsuspend(struct ast_cc_monitor *monitor, const int core_id)
+int sig_pri_cc_monitor_unsuspend(struct ast_cc_monitor *monitor)
 {
 	struct sig_pri_cc_monitor_instance *instance;
 
-	instance = sig_pri_find_cc_monitor_by_core_id(core_id);
-	if (!instance) {
-		return -1;
-	}
+	instance = monitor->private_data;
 	ast_mutex_lock(&instance->pri->lock);
 	pri_cc_status(instance->pri->pri, instance->cc_id, 0/* free */);
 	ast_mutex_unlock(&instance->pri->lock);
 
-	ao2_ref(instance, -1);
 	return 0;
 }
 #endif	/* defined(HAVE_PRI_CCSS) */
@@ -5561,7 +5487,6 @@
  * \since 1.8
  *
  * \param monitor CC core monitor control.
- * \param core_id core_id of the CC transaction.
  * \param devstate Current status of a Party A device.
  *
  * \details
@@ -5573,7 +5498,7 @@
  * \retval 0 on success
  * \retval -1 on failure.
  */
-int sig_pri_cc_monitor_status_rsp(struct ast_cc_monitor *monitor, const int core_id, enum ast_device_state devstate)
+int sig_pri_cc_monitor_status_rsp(struct ast_cc_monitor *monitor, enum ast_device_state devstate)
 {
 	struct sig_pri_cc_monitor_instance *instance;
 	int cc_status;
@@ -5591,15 +5516,11 @@
 		/* Don't know how to interpret this device state into free/busy status. */
 		return 0;
 	}
-	instance = sig_pri_find_cc_monitor_by_core_id(core_id);
-	if (!instance) {
-		return -1;
-	}
+	instance = monitor->private_data;
 	ast_mutex_lock(&instance->pri->lock);
 	pri_cc_status_req_rsp(instance->pri->pri, instance->cc_id, cc_status);
 	ast_mutex_unlock(&instance->pri->lock);
 
-	ao2_ref(instance, -1);
 	return 0;
 }
 #endif	/* defined(HAVE_PRI_CCSS) */
@@ -5610,7 +5531,6 @@
  * \since 1.8
  *
  * \param monitor CC core monitor control.
- * \param core_id core_id of the CC transaction.
  * \param sched_id Available timer scheduler id to cancel.
  * Will never be NULL for a device monitor.
  *
@@ -5623,7 +5543,7 @@
  * \retval 0 on success
  * \retval -1 on failure.
  */
-int sig_pri_cc_monitor_cancel_available_timer(struct ast_cc_monitor *monitor, const int core_id, int *sched_id)
+int sig_pri_cc_monitor_cancel_available_timer(struct ast_cc_monitor *monitor, int *sched_id)
 {
 	/*
 	 * libpri maintains it's own available timer as one of:
@@ -5639,39 +5559,18 @@
  * \brief Destroy PRI private data on the monitor.
  * \since 1.8
  *
- * \param monitor CC core monitor control.
+ * \param monitor_pvt CC device monitor private data pointer.
  *
  * \details
  * Implementers of this callback are responsible for destroying
  * all heap-allocated data in the monitor's private_data pointer, including
  * the private_data itself.
  */
-void sig_pri_cc_monitor_destructor(struct ast_cc_monitor *monitor)
-{
-	/* Move along.  Move along.  Nothing to do here. */
-}
-#endif	/* defined(HAVE_PRI_CCSS) */
-
-#if defined(HAVE_PRI_CCSS)
-/*!
- * \brief Destroy private data for a specific monitor instance.
- * \since 1.8
- *
- * \param core_id core_id of the CC transaction.
- *
- * \details
- * This callback is called when a specific call completion transaction
- * fails or completes. The main difference between this and the monitor destructor
- * is that this will be called for every CC call that occurs, whereas the destructor
- * function is only called when all activities on a monitor are completed. To drive
- * the point home, this destructor only has a core ID as a parameter. Use this to
- * locate the correct data to destroy.
- */
-void sig_pri_cc_monitor_instance_destructor(const int core_id)
+void sig_pri_cc_monitor_destructor(void *monitor_pvt)
 {
 	struct sig_pri_cc_monitor_instance *instance;
 
-	instance = sig_pri_find_cc_monitor_by_core_id(core_id);
+	instance = monitor_pvt;
 	if (!instance) {
 		return;
 	}

Modified: team/group/CCSS_Monitor_Restructure/channels/sig_pri.h
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS_Monitor_Restructure/channels/sig_pri.h?view=diff&rev=244439&r1=244438&r2=244439
==============================================================================
--- team/group/CCSS_Monitor_Restructure/channels/sig_pri.h (original)
+++ team/group/CCSS_Monitor_Restructure/channels/sig_pri.h Tue Feb  2 16:02:23 2010
@@ -116,6 +116,11 @@
 	int (* const new_nobch_intf)(struct sig_pri_pri *pri);
 	const char *(* const get_orig_dialstring)(void *pvt);
 	void (* const make_cc_dialstring)(void *pvt, char *buf, size_t buf_size);
+
+	/*! Reference the parent module. */
+	void (*module_ref)(void);
+	/*! Unreference the parent module. */
+	void (*module_unref)(void);
 };
 
 #define NUM_DCHANS		4	/*!< No more than 4 d-channels */
@@ -348,14 +353,12 @@
 int sig_pri_cc_agent_callee_available(struct ast_cc_agent *agent);
 void sig_pri_cc_agent_destructor(struct ast_cc_agent *agent);
 
-int sig_pri_cc_monitor_init(struct ast_cc_monitor *monitor, const int core_id);
-int sig_pri_cc_monitor_req_cc(struct ast_cc_monitor *monitor, const int core_id, struct ast_cc_monitor_link *parent_link);
-int sig_pri_cc_monitor_suspend(struct ast_cc_monitor *monitor, const int core_id);
-int sig_pri_cc_monitor_unsuspend(struct ast_cc_monitor *monitor, const int core_id);
-int sig_pri_cc_monitor_status_rsp(struct ast_cc_monitor *monitor, const int core_id, enum ast_device_state devstate);
-int sig_pri_cc_monitor_cancel_available_timer(struct ast_cc_monitor *monitor, const int core_id, int *sched_id);
-void sig_pri_cc_monitor_destructor(struct ast_cc_monitor *monitor);
-void sig_pri_cc_monitor_instance_destructor(const int core_id);
+int sig_pri_cc_monitor_req_cc(struct ast_cc_monitor *monitor, int *available_timer_id);
+int sig_pri_cc_monitor_suspend(struct ast_cc_monitor *monitor);
+int sig_pri_cc_monitor_unsuspend(struct ast_cc_monitor *monitor);
+int sig_pri_cc_monitor_status_rsp(struct ast_cc_monitor *monitor, enum ast_device_state devstate);
+int sig_pri_cc_monitor_cancel_available_timer(struct ast_cc_monitor *monitor, int *sched_id);
+void sig_pri_cc_monitor_destructor(void *monitor_pvt);
 
 int sig_pri_load(const char *cc_type_name);
 void sig_pri_unload(void);




More information about the asterisk-commits mailing list