[asterisk-commits] rmudgett: branch rmudgett/dahdi_ccss r238636 - /team/rmudgett/dahdi_ccss/chan...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jan 8 13:40:03 CST 2010


Author: rmudgett
Date: Fri Jan  8 13:40:00 2010
New Revision: 238636

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=238636
Log:
Stubs for DAHDI/PRI CCSS agent and monitor.

Modified:
    team/rmudgett/dahdi_ccss/channels/chan_dahdi.c
    team/rmudgett/dahdi_ccss/channels/sig_pri.c
    team/rmudgett/dahdi_ccss/channels/sig_pri.h

Modified: team/rmudgett/dahdi_ccss/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_ccss/channels/chan_dahdi.c?view=diff&rev=238636&r1=238635&r2=238636
==============================================================================
--- team/rmudgett/dahdi_ccss/channels/chan_dahdi.c (original)
+++ team/rmudgett/dahdi_ccss/channels/chan_dahdi.c Fri Jan  8 13:40:00 2010
@@ -607,6 +607,11 @@
 };
 
 static struct dahdi_pri pris[NUM_SPANS];
+
+#if defined(HAVE_PRI_CCSS)
+/*! DAHDI PRI CCSS agent and monitor type name. */
+static const char dahdi_pri_cc_type[] = "DAHDI/PRI";
+#endif	/* defined(HAVE_PRI_CCSS) */
 
 #else
 /*! Shut up the compiler */
@@ -7960,15 +7965,20 @@
 	enum ast_cc_monitor_policies monitor_policy = ast_get_cc_monitor_policy(cc_params);
 	const char *monitor_type;
 
-	if (monitor_policy == AST_CC_MONITOR_GENERIC || monitor_policy == AST_CC_MONITOR_ALWAYS) {
-		monitor_type = "generic";
-	} else if (monitor_policy == AST_CC_MONITOR_NATIVE) {
-		monitor_type = "DAHDI";
-	} else {
-		return 0;
-	}
-
-	if (ast_cc_monitor_count(device_name, monitor_type) >= ast_get_cc_max_monitors(cc_params)) {
+	monitor_type = NULL;
+	switch (monitor_policy) {
+	case AST_CC_MONITOR_NEVER:
+		break;
+	case AST_CC_MONITOR_NATIVE:
+	case AST_CC_MONITOR_GENERIC:
+	case AST_CC_MONITOR_ALWAYS:
+		monitor_type = AST_CC_GENERIC_MONITOR_TYPE;
+		break;
+	}
+
+	if (monitor_type
+		&& ast_cc_monitor_count(device_name, monitor_type)
+		>= ast_get_cc_max_monitors(cc_params)) {
 		return 0;
 	}
 
@@ -15691,6 +15701,168 @@
 };
 #endif	/* defined(HAVE_SS7) */
 
+#if defined(HAVE_PRI)
+#if defined(HAVE_PRI_CCSS)
+/*!
+ * \internal
+ * \brief CC agent initialization.
+ * \since 1.8
+ *
+ * \param agent CC core agent control.
+ * \param chan Original channel the agent will attempt to recall.
+ *
+ * \details
+ * This callback is called when the CC core is initialized.  Agents should allocate
+ * any private data necessary for the call and assign it to the private_data
+ * on the agent.  Additionally, if any ast_cc_agent_flags are pertinent to the
+ * specific agent type, they should be set in this function as well.
+ *
+ * \retval 0 on success.
+ * \retval -1 on error.
+ */
+static int dahdi_pri_cc_agent_init(struct ast_cc_agent *agent, struct ast_channel *chan)
+{
+	struct dahdi_pvt *pvt;
+	struct sig_pri_chan *pvt_chan;
+	int res;
+
+	ast_assert(!strcmp(chan->tech->type, "DAHDI"));
+
+	pvt = chan->tech_pvt;
+	if (dahdi_sig_pri_lib_handles(pvt->sig)) {
+		pvt_chan = pvt->sig_pvt;
+	} else {
+		pvt_chan = NULL;
+	}
+	if (!pvt_chan) {
+		return -1;
+	}
+
+	/* BUGBUG Need chan_dahdi to increment module ref count. */
+
+	res = sig_pri_cc_agent_init(agent, pvt_chan);
+	if (res) {
+		/* BUGBUG Need chan_dahdi to decrement module ref count. */
+	}
+	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 agent.
+ * \since 1.8
+ *
+ * \param agent CC core agent control.
+ *
+ * \details
+ * The core will call this function upon completion
+ * or failure of CC.
+ *
+ * \return Nothing
+ */
+static void dahdi_pri_cc_agent_destructor(struct ast_cc_agent *agent)
+{
+	sig_pri_cc_agent_destructor(agent);
+
+	/* BUGBUG Need chan_dahdi to decrement module ref count. */
+}
+#endif	/* defined(HAVE_PRI_CCSS) */
+#endif	/* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
+#if defined(HAVE_PRI_CCSS)
+static struct ast_cc_agent_callbacks dahdi_pri_cc_agent_callbacks = {
+	.type = dahdi_pri_cc_type,
+	.init = dahdi_pri_cc_agent_init,
+	.start_offer_timer = sig_pri_cc_agent_start_offer_timer,
+	.stop_offer_timer = sig_pri_cc_agent_stop_offer_timer,
+	.ack = sig_pri_cc_agent_req_ack,
+	.status_request = sig_pri_cc_agent_status_req,
+	.stop_ringing = sig_pri_cc_agent_stop_ringing,
+	.party_b_free = sig_pri_cc_agent_party_b_free,
+	.start_monitoring = sig_pri_cc_agent_start_monitoring,
+	.callee_available = sig_pri_cc_agent_callee_available,
+	.destructor = dahdi_pri_cc_agent_destructor,
+};
+#endif	/* defined(HAVE_PRI_CCSS) */
+#endif	/* defined(HAVE_PRI) */
+
+#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;
+
+	/* BUGBUG Need chan_dahdi to increment module ref count. */
+
+	res = sig_pri_cc_monitor_init(monitor, core_id);
+	if (res) {
+		/* BUGBUG Need chan_dahdi to decrement module ref count. */
+	}
+	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);
+
+	/* BUGBUG Need chan_dahdi to decrement module ref count. */
+}
+#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,
+};
+#endif	/* defined(HAVE_PRI_CCSS) */
+#endif	/* defined(HAVE_PRI) */
+
 static int __unload_module(void)
 {
 	struct dahdi_pvt *p;
@@ -15759,6 +15931,10 @@
 			dahdi_close_pri_fd(&(pris[i]), j);
 		}
 	}
+#if defined(HAVE_PRI_CCSS)
+	ast_cc_agent_unregister(&dahdi_pri_cc_agent_callbacks);
+	ast_cc_monitor_unregister(&dahdi_pri_cc_monitor_callbacks);
+#endif	/* defined(HAVE_PRI_CCSS) */
 #endif
 
 #if defined(HAVE_SS7)
@@ -17120,6 +17296,13 @@
 #ifdef HAVE_PRI_PROG_W_CAUSE
 	ast_register_application_xml(dahdi_send_callrerouting_facility_app, dahdi_send_callrerouting_facility_exec);
 #endif
+#if defined(HAVE_PRI_CCSS)
+	if (ast_cc_agent_register(&dahdi_pri_cc_agent_callbacks)
+		|| ast_cc_monitor_register(&dahdi_pri_cc_monitor_callbacks)) {
+		__unload_module();
+		return AST_MODULE_LOAD_FAILURE;
+	}
+#endif	/* defined(HAVE_PRI_CCSS) */
 #endif
 #ifdef HAVE_SS7
 	memset(linksets, 0, sizeof(linksets));

Modified: team/rmudgett/dahdi_ccss/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_ccss/channels/sig_pri.c?view=diff&rev=238636&r1=238635&r2=238636
==============================================================================
--- team/rmudgett/dahdi_ccss/channels/sig_pri.c (original)
+++ team/rmudgett/dahdi_ccss/channels/sig_pri.c Fri Jan  8 13:40:00 2010
@@ -60,6 +60,17 @@
 #else
 #define DEFAULT_PRI_DEBUG 0
 #endif
+
+#if defined(HAVE_PRI_CCSS)
+struct sig_pri_cc_agent_prv {
+	/*! Asterisk span D channel control structure. */
+	struct sig_pri_pri *pri;
+	/*! CC id value to use with libpri. -1 if invalid. */
+	long cc_id;
+	/*! TRUE if CC has been requested and we are waiting for the response. */
+	unsigned char cc_request_response_pending;
+};
+#endif	/* defined(HAVE_PRI_CCSS) */
 
 static int pri_matchdigittimeout = 3000;
 
@@ -4177,4 +4188,476 @@
 	}
 }
 
+#if defined(HAVE_PRI_CCSS)
+/*!
+ * \brief PRI CC agent initialization.
+ * \since 1.8
+ *
+ * \param agent CC core agent control.
+ * \param pvt_chan Original channel the agent will attempt to recall.
+ *
+ * \details
+ * This callback is called when the CC core is initialized.  Agents should allocate
+ * any private data necessary for the call and assign it to the private_data
+ * on the agent.  Additionally, if any ast_cc_agent_flags are pertinent to the
+ * specific agent type, they should be set in this function as well.
+ *
+ * \retval 0 on success.
+ * \retval -1 on error.
+ */
+int sig_pri_cc_agent_init(struct ast_cc_agent *agent, struct sig_pri_chan *pvt_chan)
+{
+	struct sig_pri_cc_agent_prv *cc_pvt;
+
+	cc_pvt = ast_calloc(1, sizeof(*cc_pvt));
+	if (!cc_pvt) {
+		return -1;
+	}
+
+	ast_mutex_lock(&pvt_chan->pri->lock);
+	cc_pvt->pri = pvt_chan->pri;
+	cc_pvt->cc_id = pri_cc_available(pvt_chan->pri->pri, pvt_chan->call);
+	ast_mutex_unlock(&pvt_chan->pri->lock);
+	if (cc_pvt->cc_id == -1) {
+		ast_free(cc_pvt);
+		return -1;
+	}
+	agent->private_data = cc_pvt;
+	return 0;
+}
+#endif	/* defined(HAVE_PRI_CCSS) */
+
+#if defined(HAVE_PRI_CCSS)
+/*!
+ * \brief Start the offer timer.
+ * \since 1.8
+ *
+ * \param agent CC core agent control.
+ *
+ * \details
+ * This is called by the core when the caller hangs up after
+ * a call for which CC may be requested. The agent should
+ * begin the timer as configured.
+ *
+ * The primary reason why this functionality is left to
+ * the specific agent implementations is due to the differing
+ * use of schedulers throughout the code. Some channel drivers
+ * may already have a scheduler context they wish to use, and
+ * amongst those, some may use the ast_sched API while others
+ * may use the ast_sched_thread API, which are incompatible.
+ *
+ * \retval 0 on success.
+ * \retval -1 on error.
+ */
+int sig_pri_cc_agent_start_offer_timer(struct ast_cc_agent *agent)
+{
+	/*! \todo BUGBUG sig_pri_cc_agent_start_offer_timer() not written */
+	return -1;
+}
+#endif	/* defined(HAVE_PRI_CCSS) */
+
+#if defined(HAVE_PRI_CCSS)
+/*!
+ * \brief Stop the offer timer.
+ * \since 1.8
+ *
+ * \param agent CC core agent control.
+ *
+ * \details
+ * This callback is called by the CC core when the caller
+ * has requested CC.
+ *
+ * \retval 0 on success.
+ * \retval -1 on error.
+ */
+int sig_pri_cc_agent_stop_offer_timer(struct ast_cc_agent *agent)
+{
+	/*! \todo BUGBUG sig_pri_cc_agent_stop_offer_timer() not written */
+	return -1;
+}
+#endif	/* defined(HAVE_PRI_CCSS) */
+
+#if defined(HAVE_PRI_CCSS)
+/*!
+ * \brief Acknowledge CC request.
+ * \since 1.8
+ *
+ * \param agent CC core agent control.
+ *
+ * \details
+ * When the core receives knowledge that a called
+ * party has accepted a CC request, it will call
+ * this callback.
+ *
+ * The duty of this is to accept a CC request from
+ * the caller by acknowledging receipt of that request.
+ *
+ * \return Nothing
+ */
+void sig_pri_cc_agent_req_ack(struct ast_cc_agent *agent)
+{
+	struct sig_pri_cc_agent_prv *cc_pvt;
+	int res;
+
+	cc_pvt = agent->private_data;
+	ast_mutex_lock(&cc_pvt->pri->lock);
+	if (cc_pvt->cc_request_response_pending) {
+		res = pri_cc_req_rsp(cc_pvt->pri->pri, cc_pvt->cc_id, 0/* success */);
+	} else {
+		res = 0;
+	}
+	ast_mutex_unlock(&cc_pvt->pri->lock);
+	if (res) {
+		ast_cc_failed(agent->core_id, "Failed to send the CC request ack.");
+	}
+}
+#endif	/* defined(HAVE_PRI_CCSS) */
+
+#if defined(HAVE_PRI_CCSS)
+/*!
+ * \brief Request the status of the agent's device.
+ * \since 1.8
+ *
+ * \param agent CC core agent control.
+ *
+ * \details
+ * Asynchronous request for the status of any caller
+ * which may be a valid caller for the CC transaction.
+ * Status responses should be made using the
+ * ast_cc_status_response function.
+ *
+ * \retval 0 on success.
+ * \retval -1 on error.
+ */
+int sig_pri_cc_agent_status_req(struct ast_cc_agent *agent)
+{
+	/*! \todo BUGBUG sig_pri_cc_agent_status_req() not written */
+	return -1;
+}
+#endif	/* defined(HAVE_PRI_CCSS) */
+
+#if defined(HAVE_PRI_CCSS)
+/*!
+ * \brief Request for an agent's phone to stop ringing.
+ * \since 1.8
+ *
+ * \param agent CC core agent control.
+ *
+ * \details
+ * The usefulness of this is quite limited. The only specific
+ * known case for this is if Asterisk requests CC over an ISDN
+ * PTMP link as the TE side. If other phones are in the same
+ * recall group as the Asterisk server, and one of those phones
+ * picks up the recall notice, then Asterisk will receive a
+ * "stop ringing" notification from the NT side of the PTMP
+ * link. This indication needs to be passed to the phone
+ * on the other side of the Asterisk server which originally
+ * placed the call so that it will stop ringing. Since the
+ * phone may be of any type, it is necessary to have a callback
+ * that the core can know about.
+ *
+ * \retval 0 on success.
+ * \retval -1 on error.
+ */
+int sig_pri_cc_agent_stop_ringing(struct ast_cc_agent *agent)
+{
+	/*! \todo BUGBUG sig_pri_cc_agent_stop_ringing() not written */
+	return -1;
+}
+#endif	/* defined(HAVE_PRI_CCSS) */
+
+#if defined(HAVE_PRI_CCSS)
+/*!
+ * \brief Let the caller know that the callee has become free
+ * but that the caller cannot attempt to call back because
+ * he is either busy or there is congestion on his line.
+ * \since 1.8
+ *
+ * \param agent CC core agent control.
+ *
+ * \details
+ * This is something that really only affects a scenario where
+ * a phone places a call over ISDN PTMP to Asterisk, who then
+ * connects over PTMP again to the ISDN network. For most agent
+ * types, there is no need to implement this callback at all
+ * because they don't really need to actually do anything in
+ * this situation. If you're having trouble understanding what
+ * the purpose of this callback is, then you can be safe simply
+ * not implementing it.
+ *
+ * \retval 0 on success.
+ * \retval -1 on error.
+ */
+int sig_pri_cc_agent_party_b_free(struct ast_cc_agent *agent)
+{
+	/*! \todo BUGBUG sig_pri_cc_agent_party_b_free() not written */
+	return -1;
+}
+#endif	/* defined(HAVE_PRI_CCSS) */
+
+#if defined(HAVE_PRI_CCSS)
+/*!
+ * \brief Begin monitoring a busy device.
+ * \since 1.8
+ *
+ * \param agent CC core agent control.
+ *
+ * \details
+ * The core will call this callback if the callee becomes
+ * available but the caller has reported that he is busy.
+ * The agent should begin monitoring the caller's device.
+ * When the caller becomes available again, the agent should
+ * call ast_cc_agent_caller_available.
+ *
+ * \retval 0 on success.
+ * \retval -1 on error.
+ */
+int sig_pri_cc_agent_start_monitoring(struct ast_cc_agent *agent)
+{
+	/*! \todo BUGBUG sig_pri_cc_agent_start_monitoring() not written */
+	return -1;
+}
+#endif	/* defined(HAVE_PRI_CCSS) */
+
+#if defined(HAVE_PRI_CCSS)
+/*!
+ * \brief Alert the caller that it is time to try recalling.
+ * \since 1.8
+ *
+ * \param agent CC core agent control.
+ *
+ * \details
+ * The core will call this function when it receives notice
+ * that a monitored party has become available.
+ *
+ * The agent's job is to send a message to the caller to
+ * notify it of such a change. If the agent is able to
+ * discern that the caller is currently unavailable, then
+ * the agent should react by calling the ast_cc_caller_unavailable
+ * function.
+ *
+ * \retval 0 on success.
+ * \retval -1 on error.
+ */
+int sig_pri_cc_agent_callee_available(struct ast_cc_agent *agent)
+{
+	/*! \todo BUGBUG sig_pri_cc_agent_callee_available() not written */
+	return -1;
+}
+#endif	/* defined(HAVE_PRI_CCSS) */
+
+#if defined(HAVE_PRI_CCSS)
+/*!
+ * \brief Destroy private data on the agent.
+ * \since 1.8
+ *
+ * \param agent CC core agent control.
+ *
+ * \details
+ * The core will call this function upon completion
+ * or failure of CC.
+ *
+ * \return Nothing
+ */
+void sig_pri_cc_agent_destructor(struct ast_cc_agent *agent)
+{
+	struct sig_pri_cc_agent_prv *cc_pvt;
+	int res;
+
+	cc_pvt = agent->private_data;
+	ast_mutex_lock(&cc_pvt->pri->lock);
+	res = -1;
+	if (cc_pvt->cc_request_response_pending) {
+		res = pri_cc_req_rsp(cc_pvt->pri->pri, cc_pvt->cc_id, 2/* short_term_denial */);
+	}
+	if (res) {
+		pri_cc_cancel(cc_pvt->pri->pri, cc_pvt->cc_id);
+	}
+	ast_free(cc_pvt);
+	ast_mutex_unlock(&cc_pvt->pri->lock);
+}
+#endif	/* defined(HAVE_PRI_CCSS) */
+
+#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)
+{
+	/*! \todo BUGBUG sig_pri_cc_monitor_init() not written */
+	return -1;
+}
+#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.
+ * Will never be NULL for a device monitor.
+ *
+ * \details
+ * Perform whatever steps are necessary in order to request CC.
+ * In addition, the monitor implementation is responsible for
+ * starting the available timer in this callback. The scheduler
+ * ID for the callback must be stored in the parent_link's child_avail_id
+ * field.
+ *
+ * \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)
+{
+	/*! \todo BUGBUG sig_pri_cc_monitor_req_cc() not written */
+	return -1;
+}
+#endif	/* defined(HAVE_PRI_CCSS) */
+
+#if defined(HAVE_PRI_CCSS)
+/*!
+ * \brief Suspend monitoring.
+ * \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
+ * monitoring.
+ *
+ * \retval 0 on success
+ * \retval -1 on failure.
+ */
+int sig_pri_cc_monitor_suspend(struct ast_cc_monitor *monitor, const int core_id)
+{
+	/*! \todo BUGBUG sig_pri_cc_monitor_suspend() not written */
+	return -1;
+}
+#endif	/* defined(HAVE_PRI_CCSS) */
+
+#if defined(HAVE_PRI_CCSS)
+/*!
+ * \brief Unsuspend monitoring.
+ * \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.
+ *
+ * \retval 0 on success
+ * \retval -1 on failure.
+ */
+int sig_pri_cc_monitor_unsuspend(struct ast_cc_monitor *monitor, const int core_id)
+{
+	/*! \todo BUGBUG sig_pri_cc_monitor_unsuspend() not written */
+	return -1;
+}
+#endif	/* defined(HAVE_PRI_CCSS) */
+
+#if defined(HAVE_PRI_CCSS)
+/*!
+ * \brief Status response to an ast_cc_monitor_status_request().
+ * \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
+ * Alert a monitor as to the status of the agent for which
+ * the monitor had previously requested a status request.
+ *
+ * \note Zero or more responses may come as a result.
+ *
+ * \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)
+{
+	/*! \todo BUGBUG sig_pri_cc_monitor_status_rsp() not written */
+	return -1;
+}
+#endif	/* defined(HAVE_PRI_CCSS) */
+
+#if defined(HAVE_PRI_CCSS)
+/*!
+ * \brief Cancel the running available timer.
+ * \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.
+ *
+ * \details
+ * In most cases, this function will likely consist of just a
+ * call to AST_SCHED_DEL. It might have been possible to do this
+ * within the core, but unfortunately the mixture of sched_thread
+ * and sched usage in Asterisk prevents such usage.
+ *
+ * \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)
+{
+	/*! \todo BUGBUG sig_pri_cc_monitor_cancel_available_timer() not written */
+	return -1;
+}
+#endif	/* defined(HAVE_PRI_CCSS) */
+
+#if defined(HAVE_PRI_CCSS)
+/*!
+ * \brief Destroy PRI 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.
+ */
+void sig_pri_cc_monitor_destructor(struct ast_cc_monitor *monitor)
+{
+	/*! \todo BUGBUG sig_pri_cc_monitor_destructor() not written */
+}
+#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)
+{
+	/*! \todo BUGBUG sig_pri_cc_monitor_instance_destructor() not written */
+}
+#endif	/* defined(HAVE_PRI_CCSS) */
+
 #endif /* HAVE_PRI */

Modified: team/rmudgett/dahdi_ccss/channels/sig_pri.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_ccss/channels/sig_pri.h?view=diff&rev=238636&r1=238635&r2=238636
==============================================================================
--- team/rmudgett/dahdi_ccss/channels/sig_pri.h (original)
+++ team/rmudgett/dahdi_ccss/channels/sig_pri.h Fri Jan  8 13:40:00 2010
@@ -27,8 +27,11 @@
 
 #include "asterisk/channel.h"
 #include "asterisk/frame.h"
+#include "asterisk/ccss.h"
 #include <libpri.h>
 #include <dahdi/user.h>
+/* BUGBUG the HAVE_PRI_CCSS line is to be removed when the CCSS branch is merged to trunk and the configure script is updated. */
+#define HAVE_PRI_CCSS 1
 
 enum sig_pri_tone {
 	SIG_PRI_TONE_RINGTONE = 0,
@@ -293,4 +296,24 @@
 
 void sig_pri_fixup(struct ast_channel *oldchan, struct ast_channel *newchan, struct sig_pri_chan *pchan);
 
+int sig_pri_cc_agent_init(struct ast_cc_agent *agent, struct sig_pri_chan *pvt_chan);
+int sig_pri_cc_agent_start_offer_timer(struct ast_cc_agent *agent);
+int sig_pri_cc_agent_stop_offer_timer(struct ast_cc_agent *agent);
+void sig_pri_cc_agent_req_ack(struct ast_cc_agent *agent);
+int sig_pri_cc_agent_status_req(struct ast_cc_agent *agent);
+int sig_pri_cc_agent_stop_ringing(struct ast_cc_agent *agent);
+int sig_pri_cc_agent_party_b_free(struct ast_cc_agent *agent);
+int sig_pri_cc_agent_start_monitoring(struct ast_cc_agent *agent);
+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);
+
 #endif /* _SIG_PRI_H */




More information about the asterisk-commits mailing list