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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 21 11:58:55 CST 2010


Author: mmichelson
Date: Thu Jan 21 11:58:51 2010
New Revision: 242029

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=242029
Log:
Initial tweaks to functions which deal with frame handling.

At this point, it is important to point out that I am not building
chan_sip and chan_dahdi in this branch. This change would cause them
to no longer compile without changing them. Right now though, my focus
in on ccss.c and I will adjust chan_dahdi and chan_sip once I have
the rest of things in order.


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

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=242029&r1=242028&r2=242029
==============================================================================
--- team/group/CCSS_Monitor_Restructure/channels/chan_dahdi.c (original)
+++ team/group/CCSS_Monitor_Restructure/channels/chan_dahdi.c Thu Jan 21 11:58:51 2010
@@ -8064,7 +8064,7 @@
 			ast_channel_get_device_name(p->owner, device_name, sizeof(device_name));
 			monitor_type = dahdi_cc_is_possible(p->owner, device_name);
 			if (monitor_type
-				&& !ast_cc_build_frame(p->owner, p->cc_params, monitor_type, device_name, p->dialstring, AST_CC_CCNR, &p->subs[idx].f)) {
+				&& !ast_cc_build_frame(p->owner, p->cc_params, monitor_type, device_name, p->dialstring, AST_CC_CCNR, NULL, &p->subs[idx].f)) {
 				p->subs[idx].ccframesent = 1;
 				return &p->subs[idx].f;
 			}

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=242029&r1=242028&r2=242029
==============================================================================
--- team/group/CCSS_Monitor_Restructure/include/asterisk/ccss.h (original)
+++ team/group/CCSS_Monitor_Restructure/include/asterisk/ccss.h Thu Jan 21 11:58:51 2010
@@ -103,11 +103,15 @@
  * \param monitor_type The type of monitor to use when CC is requested
  * \param dialable_name The dial string used to call the device
  * \param service The type of CC service the device is willing to offer
+ * \param private_data If a native monitor is being used, and some channel-driver-specific private
+ * data has been allocated, then this parameter should contain a pointer to that data. If using a generic
+ * monitor, this parameter should remain NULL. Note that if this function should fail at some point,
+ * it is the responsibility of the caller to free the private data upon return.
  * \retval 0 Success
  * \retval -1 Error
  */
 int ast_queue_cc_frame(struct ast_channel *chan, const char * const monitor_type,
-		const char * const dialable_name, enum ast_cc_service_type service);
+		const char * const dialable_name, enum ast_cc_service_type service, void *private_data);
 
 /*!
  * \brief Allocate and initialize an ast_cc_config_params structure
@@ -1449,6 +1453,10 @@
  * \param monitor_type The type of monitor to use when CC is requested
  * \param device_name The name of the outbound target device.
  * \param dialable_name The dial string used when calling this specific interface
+ * \param private_data If a native monitor is being used, and some channel-driver-specific private
+ * data has been allocated, then this parameter should contain a pointer to that data. If using a generic
+ * monitor, this parameter should remain NULL. Note that if this function should fail at some point,
+ * it is the responsibility of the caller to free the private data upon return.
  *
  * \details
  * For channel types that fail ast_request when the device is busy, we call into the
@@ -1461,7 +1469,7 @@
  * by the channel driver.
  */
 void ast_cc_busy_interface(struct ast_channel *inbound, struct ast_cc_config_params *cc_params,
-	const char *monitor_type, const char * const device_name, const char * const dialable_name);
+	const char *monitor_type, const char * const device_name, const char * const dialable_name, void *private_data);
 
 /*!
  * \since 1.8
@@ -1479,6 +1487,10 @@
  * \param device_name The name of the outbound target device.
  * \param dialable_name The dial string used when calling this specific interface
  * \param service What kind of CC service is being offered. (CCBS/CCNR/etc...)
+ * \param private_data If a native monitor is being used, and some channel-driver-specific private
+ * data has been allocated, then this parameter should contain a pointer to that data. If using a generic
+ * monitor, this parameter should remain NULL. Note that if this function should fail at some point,
+ * it is the responsibility of the caller to free the private data upon return.
  * \param[out] frame. The frame we will be returning to the caller. It is vital that ast_frame_free be called on this frame since the
  * payload will be allocated on the heap.
  * \retval -1 Failure. At some point there was a failure. Do not attempt to use the frame in this case.
@@ -1486,7 +1498,8 @@
  */
 int ast_cc_build_frame(struct ast_channel *chan, struct ast_cc_config_params *cc_params,
 	const char *monitor_type, const char * const device_name,
-	const char * const dialable_name, enum ast_cc_service_type service, struct ast_frame *frame);
+	const char * const dialable_name, enum ast_cc_service_type service, void *private_data,
+	struct ast_frame *frame);
 
 
 /*!
@@ -1498,6 +1511,10 @@
  * \param monitor_type The type of monitor to use when CC is requested
  * \param device_name The name of the outbound target device.
  * \param dialable_name The dial string used when calling this specific interface
+ * \param private_data If a native monitor is being used, and some channel-driver-specific private
+ * data has been allocated, then this parameter should contain a pointer to that data. If using a generic
+ * monitor, this parameter should remain NULL. Note that if this function should fail at some point,
+ * it is the responsibility of the caller to free the private data upon return.
  *
  * \details
  * For channel types that fail ast_request when the device is busy, we call into the
@@ -1507,7 +1524,7 @@
  * \return Nothing
  */
 typedef void (*ast_cc_callback_fn)(struct ast_channel *chan, struct ast_cc_config_params *cc_params,
-	const char *monitor_type, const char * const device_name, const char * const dialable_name);
+	const char *monitor_type, const char * const device_name, const char * const dialable_name, void *private_data);
 
 /*!
  * \since 1.8

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=242029&r1=242028&r2=242029
==============================================================================
--- team/group/CCSS_Monitor_Restructure/main/ccss.c (original)
+++ team/group/CCSS_Monitor_Restructure/main/ccss.c Thu Jan 21 11:58:51 2010
@@ -1571,6 +1571,7 @@
 	enum ast_cc_service_type service;
 	struct ast_cc_config_params config_params;
 	int parent_interface_id;
+	void *private_data;
 	char device_name[AST_CHANNEL_NAME];
 	char dialable_name[AST_CHANNEL_NAME];
 };
@@ -3290,7 +3291,7 @@
 
 static int cc_build_payload(struct ast_channel *chan, struct ast_cc_config_params *cc_params,
 	const char *monitor_type, const char * const device_name, const char * dialable_name,
-	enum ast_cc_service_type service, struct ast_control_cc_payload *payload)
+	enum ast_cc_service_type service, void *private_data, struct ast_control_cc_payload *payload)
 {
 	struct ast_datastore *datastore;
 	struct dialed_cc_interfaces *cc_interfaces;
@@ -3316,7 +3317,7 @@
 }
 
 int ast_queue_cc_frame(struct ast_channel *chan, const char *monitor_type, 
-		const char * const dialable_name, enum ast_cc_service_type service)
+		const char * const dialable_name, enum ast_cc_service_type service, void *private_data)
 {
 	struct ast_frame frame = {0,};
 	char device_name[AST_CHANNEL_NAME];
@@ -3333,7 +3334,7 @@
 		return -1;
 	}
 
-	if (ast_cc_build_frame(chan, cc_params, monitor_type, device_name, dialable_name, service, &frame)) {
+	if (ast_cc_build_frame(chan, cc_params, monitor_type, device_name, dialable_name, service, private_data, &frame)) {
 		/* Frame building failed. We can't use this. */
 		return -1;
 	}
@@ -3344,14 +3345,15 @@
 
 int ast_cc_build_frame(struct ast_channel *chan, struct ast_cc_config_params *cc_params,
 	const char *monitor_type, const char * const device_name,
-	const char * const dialable_name, enum ast_cc_service_type service, struct ast_frame *frame)
+	const char * const dialable_name, enum ast_cc_service_type service, void *private_data,
+	struct ast_frame *frame)
 {
 	struct ast_control_cc_payload *payload = ast_calloc(1, sizeof(*payload));
 
 	if (!payload) {
 		return -1;
 	}
-	if (cc_build_payload(chan, cc_params, monitor_type, device_name, dialable_name, service, payload)) {
+	if (cc_build_payload(chan, cc_params, monitor_type, device_name, dialable_name, service, private_data, payload)) {
 		/* Something screwed up, we can't make a frame with this */
 		ast_free(payload);
 		return -1;
@@ -3390,7 +3392,7 @@
 
 	ast_channel_get_device_name(outgoing, device_name, sizeof(device_name));
 	if (cc_build_payload(outgoing, cc_params, AST_CC_GENERIC_MONITOR_TYPE, device_name,
-		dialstring, AST_CC_CCBS, &payload)) {
+		dialstring, AST_CC_CCBS, NULL, &payload)) {
 		/* Something screwed up, we can't make a frame with this */
 		return;
 	}
@@ -3398,10 +3400,10 @@
 }
 
 void ast_cc_busy_interface(struct ast_channel *inbound, struct ast_cc_config_params *cc_params,
-	const char *monitor_type, const char * const device_name, const char * const dialable_name)
+	const char *monitor_type, const char * const device_name, const char * const dialable_name, void *private_data)
 {
 	struct ast_control_cc_payload payload;
-	if (cc_build_payload(inbound, cc_params, monitor_type, device_name, dialable_name, AST_CC_CCBS, &payload)) {
+	if (cc_build_payload(inbound, cc_params, monitor_type, device_name, dialable_name, AST_CC_CCBS, private_data, &payload)) {
 		/* Something screwed up. Don't try to handle this payload */
 		return;
 	}




More information about the asterisk-commits mailing list