[asterisk-commits] dvossel: branch dvossel/hd_confbridge r311428 - /team/dvossel/hd_confbridge/a...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Mar 18 14:12:28 CDT 2011


Author: dvossel
Date: Fri Mar 18 14:12:24 2011
New Revision: 311428

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=311428
Log:
Code organization changes

Modified:
    team/dvossel/hd_confbridge/apps/app_confbridge.c

Modified: team/dvossel/hd_confbridge/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/app_confbridge.c?view=diff&rev=311428&r1=311427&r2=311428
==============================================================================
--- team/dvossel/hd_confbridge/apps/app_confbridge.c (original)
+++ team/dvossel/hd_confbridge/apps/app_confbridge.c Fri Mar 18 14:12:24 2011
@@ -822,17 +822,18 @@
 	};
 	const char *tmp, *join_sound = NULL, *leave_sound = NULL;
 	int quiet = 0;
-
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(conf_name);
 		AST_APP_ARG(b_profile_name);
 		AST_APP_ARG(u_profile_name);
 		AST_APP_ARG(menu_name);
 	);
+	ast_bridge_features_init(&conference_bridge_user.features);
 
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "%s requires an argument (conference name[,options])\n", app);
-		return -1;
+		res = -1; /* invalid PIN */
+		goto confbridge_cleanup;
 	}
 
 	/* We need to make a copy of the input string if we are going to modify it! */
@@ -857,7 +858,8 @@
 	 * prompted for requardless of quiet setting. */
 	if (!ast_strlen_zero(conference_bridge_user.u_profile.pin)) {
 		if (conf_get_pin(chan, conference_bridge_user.u_profile.pin)) {
-			return -1; /* invalid PIN */
+			res = -1; /* invalid PIN */
+			goto confbridge_cleanup;
 		}
 	}
 
@@ -866,16 +868,14 @@
 		conf_rec_name(&conference_bridge_user, args.conf_name);
 	}
 
-	/* Always initialize the features structure, we are in most cases always going to need it. */
-	ast_bridge_features_init(&conference_bridge_user.features);
 	/* menu name */
 	if (args.argc > 3 && !ast_strlen_zero(args.menu_name)) {
 		ast_copy_string(conference_bridge_user.menu_name, args.menu_name, sizeof(conference_bridge_user.menu_name));
 		if (conf_set_menu_to_user(conference_bridge_user.menu_name, &conference_bridge_user)) {
 			ast_log(LOG_WARNING, "Conference menu %s does not exist and can not be applied to confbridge user.\n",
 				args.menu_name);
-			ast_bridge_features_cleanup(&conference_bridge_user.features);
-			return -1;
+			res = -1; /* invalid PIN */
+			goto confbridge_cleanup;
 		}
 	}
 
@@ -886,10 +886,10 @@
 
 	/* Set a talker indicate call back if talking detection is requested */
 	if (ast_test_flag(&conference_bridge_user.u_profile, USER_OPT_TALKER_DETECT)) {
-		char *conf_name = ast_strdup(args.conf_name);
+		char *conf_name = ast_strdup(args.conf_name); /* this is freed during feature cleanup */
 		if (!(conf_name)) {
-			ast_bridge_features_cleanup(&conference_bridge_user.features);
-			return -1;
+			res = -1; /* invalid PIN */
+			goto confbridge_cleanup;
 		}
 		ast_bridge_features_set_talk_detector(&conference_bridge_user.features,
 			conf_handle_talker_cb,
@@ -899,8 +899,8 @@
 
 	/* Look for a conference bridge matching the provided name */
 	if (!(conference_bridge = join_conference_bridge(args.conf_name, &conference_bridge_user))) {
-		ast_bridge_features_cleanup(&conference_bridge_user.features);
-		return -1;
+		res = -1; /* invalid PIN */
+		goto confbridge_cleanup;
 	}
 
 	/* Keep a copy of volume adjustments so we can restore them later if need be */
@@ -995,6 +995,9 @@
 	if (!ast_strlen_zero(conference_bridge_user.name_rec_location)) {
 		ast_filedelete(conference_bridge_user.name_rec_location, NULL);
 	}
+
+confbridge_cleanup:
+	ast_bridge_features_cleanup(&conference_bridge_user.features);
 
 	return res;
 }




More information about the asterisk-commits mailing list