[svn-commits] mmichelson: branch group/CCSS r213883 - in /team/group/CCSS: apps/ include/as...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Aug 24 16:59:23 CDT 2009


Author: mmichelson
Date: Mon Aug 24 16:59:20 2009
New Revision: 213883

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=213883
Log:
Save list of interfaces to the core.

This introduces an intentional memory leak into the code. It will
be cleared up once the timer logic is built into the CCSS agent code.


Modified:
    team/group/CCSS/apps/app_dial.c
    team/group/CCSS/include/asterisk/ccss.h
    team/group/CCSS/main/ccss.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=213883&r1=213882&r2=213883
==============================================================================
--- team/group/CCSS/apps/app_dial.c (original)
+++ team/group/CCSS/apps/app_dial.c Mon Aug 24 16:59:20 2009
@@ -582,7 +582,7 @@
 
 static int detect_disconnect(struct ast_channel *chan, char code, struct ast_str *featurecode);
 static void cc_set_done_flag(struct ast_channel *chan);
-static void handle_cc_control_frame(struct ast_channel *chan, void *frame_data);
+static void handle_cc_control_frame(struct ast_channel *inbound, struct ast_channel *outbound, void *frame_data, int *first);
 
 static void hanguptree(struct chanlist *outgoing, struct ast_channel *exception, int answered_elsewhere)
 {
@@ -886,6 +886,7 @@
 #endif
 	struct ast_party_connected_line connected_caller;
 	struct ast_str *featurecode = ast_str_alloca(FEATURE_MAX_LEN + 1);
+	int first_cc_frame = 1;
 
 	ast_party_connected_line_init(&connected_caller);
 	if (single) {
@@ -987,7 +988,7 @@
 						/* This channel is forwarding the call, and is capable of CC, so
 						 * be sure to add the new device interface to the list
 						 */
-						handle_cc_control_frame(c, f->data.ptr);
+						handle_cc_control_frame(in, c, f->data.ptr, &first_cc_frame);
 					}
 					ast_frfree(f);
 				}
@@ -1140,7 +1141,7 @@
 					break;
 				case AST_CONTROL_CC:
 					if (!ignore_cc) {
-						handle_cc_control_frame(c, f->data.ptr);
+						handle_cc_control_frame(in, c, f->data.ptr, &first_cc_frame);
 					}
 					break;
 				case -1:
@@ -1790,7 +1791,7 @@
 	return cc_interface;
 }
 
-static void handle_cc_control_frame(struct ast_channel *chan, void *frame_data)
+static void handle_cc_control_frame(struct ast_channel *inbound, struct ast_channel *outbound, void *frame_data, int *first)
 {
 	char device_name[AST_CHANNEL_NAME];
 	char *dash;
@@ -1798,12 +1799,12 @@
 	struct ast_datastore *cc_datastore;
 	struct dial_cc_interfaces *cc_interfaces;
 
-	ast_copy_string(device_name, chan->name, sizeof(device_name));
+	ast_copy_string(device_name, outbound->name, sizeof(device_name));
 	if ((dash = strrchr(device_name, '-'))) {
 		*dash = '\0';
 	}
 
-	if (!(cc_datastore = ast_channel_datastore_find(chan, &dial_cc_interfaces_info, NULL))) {
+	if (!(cc_datastore = ast_channel_datastore_find(outbound, &dial_cc_interfaces_info, NULL))) {
 		ast_log(LOG_WARNING, "Unable to retrieve CC datastore while processing CC frame from '%s'. CC services will be unavailable.\n", device_name);
 		return;
 	}
@@ -1818,6 +1819,14 @@
 	AST_LIST_LOCK(cc_interfaces->interface_tree);
 	AST_LIST_INSERT_TAIL(cc_interfaces->interface_tree, cc_interface, next);
 	AST_LIST_UNLOCK(cc_interfaces->interface_tree);
+
+	/* If this is the first CC frame we're processing, we need to
+	 * save the list in the core.
+	 */
+	if (*first) {
+		ast_cc_core_init_instance(inbound, cc_interfaces->interface_tree);
+		*first = 0;
+	}
 }
 
 static int create_root_cc_interface(struct ast_channel *chan, int *ignore_cc)

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=213883&r1=213882&r2=213883
==============================================================================
--- team/group/CCSS/include/asterisk/ccss.h (original)
+++ team/group/CCSS/include/asterisk/ccss.h Mon Aug 24 16:59:20 2009
@@ -585,16 +585,14 @@
 /*!
  * \since 1.6.4
  * \brief Allocate and initialize an instance of the CCSS core
- * \param caller The identity of the caller
+ * \param caller The caller's channel
  * \param called_tree A tree indicating the interfaces dialed during 
  * this call, as well as which type of call completion service should 
  * be requested for each device
  * \retval negative The CCSS core failed to be initialized.
  * \retval non-negative The identifier for this instance of the CCSS core
  */
-/*
-int ast_cc_core_init_instance(const char *caller,  called_tree);
-*/
+int ast_cc_core_init_instance(struct ast_channel *caller, struct ast_cc_interface_tree *called_tree);
 
 /*!
  * \since 1.6.4

Modified: team/group/CCSS/main/ccss.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=213883&r1=213882&r2=213883
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Mon Aug 24 16:59:20 2009
@@ -368,3 +368,10 @@
 		ast_free(cc_interface);
 	}
 }
+
+int ast_cc_core_init_instance(struct ast_channel *caller, struct ast_cc_interface_tree *called_tree)
+{
+	ao2_ref(called_tree, +1);
+	/* ADD REST OF LOGIC LATER */
+	return 0;
+}




More information about the svn-commits mailing list