[asterisk-commits] jpeeler: branch jpeeler/feature14882 r282303 - /team/jpeeler/feature14882/main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Aug 13 17:25:25 CDT 2010


Author: jpeeler
Date: Fri Aug 13 17:25:14 2010
New Revision: 282303

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=282303
Log:
can't overload data parameter to builtin_parkcall safely

Modified:
    team/jpeeler/feature14882/main/features.c

Modified: team/jpeeler/feature14882/main/features.c
URL: http://svnview.digium.com/svn/asterisk/team/jpeeler/feature14882/main/features.c?view=diff&rev=282303&r1=282302&r2=282303
==============================================================================
--- team/jpeeler/feature14882/main/features.c (original)
+++ team/jpeeler/feature14882/main/features.c Fri Aug 13 17:25:14 2010
@@ -1303,6 +1303,38 @@
 	}
 }
 
+static int parkcall_helper(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, const char *code, int sense, struct ast_park_call_args *args)
+{
+	int res = 0;
+
+	if (args) {
+		ast_debug(1, "Parkinglot specified for builtin_parkcall: %s\n", args->parkinglot->name);
+	}
+
+	/* we used to set chan's exten and priority to "s" and 1
+	   here, but this generates (in some cases) an invalid
+	   extension, and if "s" exists, could errantly
+	   cause execution of extensions you don't expect. It
+	   makes more sense to let nature take its course
+	   when chan finishes, and let the pbx do its thing
+	   and hang up when the park is over.
+	*/
+	if (chan->_state != AST_STATE_UP)
+		res = ast_answer(chan);
+	if (!res)
+		res = ast_safe_sleep(chan, 1000);
+
+	if (!res) { /* one direction used to call park_call.... */
+		struct ast_channel *parker;
+		struct ast_channel *parkee;
+		set_peers(&parker, &parkee, peer, chan, sense);
+		res = masq_park_call_announce(parkee, parker, args);
+		/* PBX should hangup zombie channel if a masquerade actually occurred (res=0) */
+	}
+
+	return res;
+}
+
 /*! 
  * \brief support routing for one touch call parking
  * \param chan channel parking call
@@ -1315,39 +1347,9 @@
  * Setup channel, set return exten,priority to 's,1'
  * answer chan, sleep chan, park call
 */
-/* JPEELER should pass args as data instead of parkinglot */
 static int builtin_parkcall(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, const char *code, int sense, void *data)
 {
-	struct ast_channel *parker;
-	struct ast_channel *parkee;
-	int res = 0;
-	struct ast_park_call_args args = {0,};
-
-	if (data) {
-		args.parkinglot = (struct ast_parkinglot *) data;
-		ast_debug(1, "Parkinglot specified for builtin_parkcall: %s\n", args.parkinglot->name);
-	}
-
-	set_peers(&parker, &parkee, peer, chan, sense);
-	/* we used to set chan's exten and priority to "s" and 1
-	   here, but this generates (in some cases) an invalid
-	   extension, and if "s" exists, could errantly
-	   cause execution of extensions you don't expect. It
-	   makes more sense to let nature take its course
-	   when chan finishes, and let the pbx do its thing
-	   and hang up when the park is over.
-	*/
-	if (chan->_state != AST_STATE_UP)
-		res = ast_answer(chan);
-	if (!res)
-		res = ast_safe_sleep(chan, 1000);
-
-	if (!res) { /* one direction used to call park_call.... */
-		res = masq_park_call_announce(parkee, parker, &args);
-		/* PBX should hangup zombie channel if a masquerade actually occurred (res=0) */
-	}
-
-	return res;
+	return parkcall_helper(chan, peer, config, code, sense, NULL);
 }
 
 /*! \brief Play message to both caller and callee in bridged call, plays synchronously, autoservicing the
@@ -1855,16 +1857,14 @@
 		return AST_FEATURE_RETURN_SUCCESS;
 	}
 
-	/* If we are attended transfering to parking, just use builtin_parkcall instead of trying to track all of
+	/* If we are attended transfering to parking, just use parkcall_helper instead of trying to track all of
 	 * the different variables for handling this properly with a builtin_atxfer */
-
-	/* if there are more possible parkingextensions to choose from, you need to figure out the proper parkinglot
-	 * and pass it to builtin_parkcall */
-
 	parkinglot = ao2_callback(parkinglots, 0, find_parkinglot_by_exten_cb, &xferto);
 	if (parkinglot) {
+		struct ast_park_call_args args = {0,};
+		args.parkinglot = parkinglot;
 		finishup(transferee);
-		return builtin_parkcall(chan, peer, config, code, sense, parkinglot);
+		return parkcall_helper(chan, peer, config, code, sense, &args);
 	}
 
 	l = strlen(xferto);
@@ -4214,7 +4214,6 @@
 		return NULL;
 
 	newlot = ao2_alloc(sizeof(*newlot), parkinglot_destroy);
-ast_log(LOG_WARNING, "jpeeler: ref count %d\n", ao2_ref(newlot, 0));
 	if (!newlot)
 		return NULL;
 	
@@ -5139,7 +5138,6 @@
  * Get channels involved in park, create event.
  * \return Always 0
 */
-/* JPEELER add ability to set parkinglot */
 static int manager_park(struct mansession *s, const struct message *m)
 {
 	const char *channel = astman_get_header(m, "Channel");
@@ -5611,7 +5609,6 @@
 	ast_register_application2(app_bridge, bridge_exec, NULL, NULL, NULL);
 
 	parkinglots = ao2_container_alloc(7, parkinglot_hash_cb, parkinglot_cmp_cb);
-ast_log(LOG_WARNING, "jpeeler: ref count %d\n", ao2_ref(parkinglots, 0));
 
 	if ((res = load_config()))
 		return res;




More information about the asterisk-commits mailing list