[asterisk-commits] mmichelson: branch group/CCSS r215930 - in /team/group/CCSS: apps/ channels/ ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 3 09:42:24 CDT 2009


Author: mmichelson
Date: Thu Sep  3 09:42:20 2009
New Revision: 215930

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=215930
Log:
Define frame payload for AST_CONTROL_CC frames.

This information is transferred to the ast_cc_interface
that is created based on the frame data. This is then
used for monitoring purposes later.


Modified:
    team/group/CCSS/apps/app_dial.c
    team/group/CCSS/channels/chan_sip.c
    team/group/CCSS/include/asterisk/ccss.h
    team/group/CCSS/include/asterisk/channel.h
    team/group/CCSS/include/asterisk/frame.h
    team/group/CCSS/main/channel.c

Modified: team/group/CCSS/apps/app_dial.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/apps/app_dial.c?view=diff&rev=215930&r1=215929&r2=215930
==============================================================================
--- team/group/CCSS/apps/app_dial.c (original)
+++ team/group/CCSS/apps/app_dial.c Thu Sep  3 09:42:20 2009
@@ -62,6 +62,7 @@
 #include "asterisk/global_datastores.h"
 #include "asterisk/dsp.h"
 #include "asterisk/cel.h"
+#include "asterisk/ccss.h"
 
 /*** DOCUMENTATION
 	<application name="Dial" language="en_US">
@@ -1807,6 +1808,7 @@
 	cc_interface->id = ast_atomic_fetchadd_int(&dial_cc_interface_counter, +1);
 	cc_interface->parent_id = parent_id;
 	cc_interface->monitor_type = "extension";
+	cc_interface->monitor_class = AST_CC_EXTENSION_MONITOR;
 	strcpy(cc_interface->name, ast_str_buffer(str));
 	ast_log(LOG_NOTICE, "Created an extension cc interface for '%s' with id %d and parent %d\n", cc_interface->name, cc_interface->id, cc_interface->parent_id);
 	return cc_interface;
@@ -1890,7 +1892,8 @@
  * \retval NULL Memory allocation failure
  * \retval non-NULL The new ast_cc_interface created.
  */
-static struct ast_cc_interface *cc_device_interface_init(const char * const name, const size_t name_len, const int parent_id)
+static struct ast_cc_interface *cc_device_interface_init(const char * const name, const size_t name_len,
+		const int parent_id, const struct ast_control_cc_payload *cc_data)
 {
 	struct ast_cc_interface *cc_interface = ast_calloc(1, sizeof(*cc_interface) + name_len);
 
@@ -1905,7 +1908,9 @@
 	 * data. However, to keep things simple for now, always use
 	 * "generic" monitor
 	 */
-	cc_interface->monitor_type = "generic";
+	cc_interface->monitor_type = cc_data->monitor_type;
+	cc_interface->service_offered = cc_data->service;
+	cc_interface->monitor_class = AST_CC_DEVICE_MONITOR;
 	ast_log(LOG_NOTICE, "Created a device cc interface for '%s' with id %d and parent %d\n", cc_interface->name, cc_interface->id, cc_interface->parent_id);
 	return cc_interface;
 }
@@ -1940,6 +1945,7 @@
 	struct ast_cc_interface *cc_interface;
 	struct ast_datastore *cc_datastore;
 	struct dial_cc_interfaces *cc_interfaces;
+	struct ast_control_cc_payload *cc_data = frame_data;
 	int core_id;
 
 	ast_copy_string(device_name, outbound->name, sizeof(device_name));
@@ -1954,7 +1960,7 @@
 
 	cc_interfaces = cc_datastore->data;
 
-	if (!(cc_interface = cc_device_interface_init(device_name, strlen(device_name), cc_interfaces->dial_parent_id))) {
+	if (!(cc_interface = cc_device_interface_init(device_name, strlen(device_name), cc_interfaces->dial_parent_id, cc_data))) {
 		ast_log(LOG_WARNING, "Unable to create CC device interface for '%s'. CC services will be unavailable on this interface.\n", device_name);
 		return;
 	}

Modified: team/group/CCSS/channels/chan_sip.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/channels/chan_sip.c?view=diff&rev=215930&r1=215929&r2=215930
==============================================================================
--- team/group/CCSS/channels/chan_sip.c (original)
+++ team/group/CCSS/channels/chan_sip.c Thu Sep  3 09:42:20 2009
@@ -18957,7 +18957,7 @@
 					if (p->owner) {
 						/* XXX TEMPORARY! FOR TESTING ONLY */
 						if (ast_get_cc_monitor_policy(p->cc_params) == AST_CC_MONITOR_GENERIC) {
-							ast_queue_control(p->owner, AST_CONTROL_CC);
+							ast_queue_cc_frame(p->owner, AST_CC_GENERIC_MONITOR_TYPE, AST_CC_CCBS);
 						}
 						ast_queue_control(p->owner, AST_CONTROL_BUSY);
 					}

Modified: team/group/CCSS/include/asterisk/ccss.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/include/asterisk/ccss.h?view=diff&rev=215930&r1=215929&r2=215930
==============================================================================
--- team/group/CCSS/include/asterisk/ccss.h (original)
+++ team/group/CCSS/include/asterisk/ccss.h Thu Sep  3 09:42:20 2009
@@ -442,6 +442,20 @@
 
 /* END TREE STRUCTURES AND API FOR APP_DIAL'S USE */
 
+/*!
+ * It is recommended that monitors use a pointer to
+ * an ast_cc_monitor_callbacks::type when creating
+ * an AST_CONTROL_CC frame. Since the generic monitor
+ * callbacks are opaque and channel drivers will wish
+ * to use that, this string is made globally available
+ * for all to use
+ *
+ * XXX TODO: Remember to set this to
+ * generic_monitor_callbacks.type in ast_cc_init. Need
+ * to write the generic monitor callbacks struct before
+ * I can do that though.
+ */
+const char *AST_CC_GENERIC_MONITOR_TYPE;
 
 /*!
  * \brief a link that connects two monitors in the weighted graph of 

Modified: team/group/CCSS/include/asterisk/channel.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/include/asterisk/channel.h?view=diff&rev=215930&r1=215929&r2=215930
==============================================================================
--- team/group/CCSS/include/asterisk/channel.h (original)
+++ team/group/CCSS/include/asterisk/channel.h Thu Sep  3 09:42:20 2009
@@ -2700,6 +2700,19 @@
  */
 struct ast_cc_config_params *ast_channel_get_cc_config_params(struct ast_channel *chan);
 
+/*!
+ * \since 1.6.4
+ * \brief Queue an AST_CONTROL_CC frame
+ *
+ * Since this function calls ast_queue_frame, the channel will be
+ * locked during the course of this function.
+ *
+ * \param chan The channel onto which to queue the frame
+ * \param monitor_type The type of monitor to use when CC is requested
+ * \retval 0 Success
+ * \retval -1 Error
+ */
+int ast_queue_cc_frame(struct ast_channel *chan, const char * const monitor_type, enum ast_cc_service_type service);
 #if defined(__cplusplus) || defined(c_plusplus)
 }
 #endif

Modified: team/group/CCSS/include/asterisk/frame.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/include/asterisk/frame.h?view=diff&rev=215930&r1=215929&r2=215930
==============================================================================
--- team/group/CCSS/include/asterisk/frame.h (original)
+++ team/group/CCSS/include/asterisk/frame.h Thu Sep  3 09:42:20 2009
@@ -33,6 +33,7 @@
 
 #include "asterisk/endian.h"
 #include "asterisk/linkedlists.h"
+#include "asterisk/ccss.h"
 
 struct ast_codec_pref {
 	char order[32];
@@ -366,6 +367,11 @@
 	AST_TRANSFER_FAILED,      /*!< Transfer request on the channel failed */
 };
 
+struct ast_control_cc_payload {
+	enum ast_cc_service_type service;
+	const char *monitor_type;
+};
+
 #define AST_SMOOTHER_FLAG_G729		(1 << 0)
 #define AST_SMOOTHER_FLAG_BE		(1 << 1)
 

Modified: team/group/CCSS/main/channel.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/main/channel.c?view=diff&rev=215930&r1=215929&r2=215930
==============================================================================
--- team/group/CCSS/main/channel.c (original)
+++ team/group/CCSS/main/channel.c Thu Sep  3 09:42:20 2009
@@ -7145,6 +7145,20 @@
 	return cc_datastore->data;
 }
 
+int ast_queue_cc_frame(struct ast_channel *chan, const char *monitor_type, enum ast_cc_service_type service)
+{
+	struct ast_frame frame = {.frametype = AST_FRAME_CONTROL, .subclass = AST_CONTROL_CC };
+	struct ast_control_cc_payload *payload;
+
+	if (!(payload = ast_calloc(1, sizeof(*payload)))) {
+		return -1;
+	}
+
+	payload->monitor_type = monitor_type;
+	payload->service = service;
+	frame.mallocd = AST_MALLOCD_DATA;
+	return ast_queue_frame(chan, &frame);
+}
 /* DO NOT PUT ADDITIONAL FUNCTIONS BELOW THIS BOUNDARY
  *
  * ONLY FUNCTIONS FOR PROVIDING BACKWARDS ABI COMPATIBILITY BELONG HERE




More information about the asterisk-commits mailing list