[asterisk-commits] mmichelson: branch group/CCSS r248659 - /team/group/CCSS/main/ccss.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Feb 24 16:03:59 CST 2010


Author: mmichelson
Date: Wed Feb 24 16:03:55 2010
New Revision: 248659

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=248659
Log:
Latest batch of reviewboard comments.

Before I post a new diff, I need to resolve a problem where
chan_sip will not load when I start Asterisk.


Modified:
    team/group/CCSS/main/ccss.c

Modified: team/group/CCSS/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=248659&r1=248658&r2=248659
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Wed Feb 24 16:03:55 2010
@@ -2005,6 +2005,7 @@
 		}
 	}
 
+	cc_ref(cc_interfaces, "Bumping ref in case channel is hung up");
 	ast_channel_unlock(inbound);
 
 	/* Yeah this kind of sucks, but luckily most people
@@ -2019,7 +2020,8 @@
 			ast_log_dynamic_level(cc_logger_level, "Core %d: Device %s sent us multiple CC control frames. Ignoring those beyond the first.\n",
 					core_instance->core_id, device_name);
 			AST_LIST_UNLOCK(cc_interfaces->interface_tree);
-			cc_unref(core_instance, "Returning early from ast_handle_cc_control_frame");
+			cc_unref(core_instance, "Returning early from ast_handle_cc_control_frame. Unref core_instance");
+			cc_unref(cc_interfaces, "Returning early from ast_handle_cc_control_frame. Unref cc_interfaces");
 			call_destructor_with_no_monitor(cc_data->monitor_type, cc_data->private_data);
 			return;
 		}
@@ -2028,7 +2030,8 @@
 
 	if (!(monitor = cc_device_monitor_init(device_name, dialstring, cc_data, cc_interfaces->core_id))) {
 		ast_log(LOG_WARNING, "Unable to create CC device interface for '%s'. CC services will be unavailable on this interface.\n", device_name);
-		cc_unref(core_instance, "Returning early from ast_handle_cc_control_frame");
+		cc_unref(core_instance, "Returning early from ast_handle_cc_control_frame. Unref core_instance");
+		cc_unref(cc_interfaces, "Returning early from ast_handle_cc_control_frame. Unref cc_interfaces");
 		call_destructor_with_no_monitor(cc_data->monitor_type, cc_data->private_data);
 		return;
 	}
@@ -2049,6 +2052,7 @@
 
 	cc_unref(core_instance, "Done with core_instance after handling CC control frame");
 	cc_unref(monitor, "Unref reference from allocating monitor");
+	cc_unref(cc_interfaces, "Done with cc_interfaces after handling CC control frame.");
 }
 
 int ast_cc_call_init(struct ast_channel *chan, int *ignore_cc)
@@ -2099,19 +2103,22 @@
 		ast_channel_unlock(chan);
 		return cc_interfaces_datastore_init(chan);
 	}
+	interfaces = cc_interfaces_datastore->data;
+	cc_ref(interfaces->interface_tree, "Bump refcount on interface tree before unlocking channel");
 	ast_channel_unlock(chan);
 
-	interfaces = cc_interfaces_datastore->data;
 	if (interfaces->ignore) {
 		/* Situation 3 has occurred */
 		*ignore_cc = 1;
 		ast_log_dynamic_level(cc_logger_level, "Datastore is present with ignore flag set. Ignoring CC offers on this call\n");
+		cc_unref(interfaces->interface_tree, "Drop refcount on interface tree");
 		return 0;
 	}
 
 	/* Situation 2 has occurred */
 	if (!(monitor = cc_extension_monitor_init(S_OR(chan->macroexten, chan->exten),
 			S_OR(chan->macrocontext, chan->context), interfaces->dial_parent_id))) {
+		cc_unref(interfaces->interface_tree, "Drop refcount on interface tree");
 		return -1;
 	}
 	/* In situation 2, chan_local will have set the extension's dialable name
@@ -2125,6 +2132,7 @@
 	AST_LIST_UNLOCK(interfaces->interface_tree);
 	interfaces->dial_parent_id = monitor->id;
 	cc_unref(monitor, "Unref monitor's allocation reference");
+	cc_unref(interfaces->interface_tree, "Drop refcount on interface tree");
 	return 0;
 }
 
@@ -2538,13 +2546,13 @@
 	int recall_core_id;
 
 	cc_params = ast_channel_get_cc_config_params(caller_chan);
+	ast_channel_get_device_name(caller_chan, caller, sizeof(caller));
 	if (!cc_params) {
 		ast_log_dynamic_level(cc_logger_level, "Could not get CC parameters for %s\n",
 			caller);
 		call_destructor_with_no_monitor(cc_data->monitor_type, cc_data->private_data);
 		return NULL;
 	}
-	ast_channel_get_device_name(caller_chan, caller, sizeof(caller));
 	/* First, we need to kill off other pending CC offers from caller. If the caller is going
 	 * to request a CC service, it may only be for the latest call he made.
 	 */
@@ -3845,7 +3853,7 @@
 	return 0;
 }
 
-static char *ccreq_app = "CallCompletionRequest";
+static const char *ccreq_app = "CallCompletionRequest";
 
 static int ccreq_exec(struct ast_channel *chan, const char *data)
 {
@@ -3888,7 +3896,7 @@
 	return res;
 }
 
-static char *cccancel_app = "CallCompletionCancel";
+static const char *cccancel_app = "CallCompletionCancel";
 
 static int cccancel_exec(struct ast_channel *chan, const char *data)
 {




More information about the asterisk-commits mailing list