[asterisk-commits] branch oej/multiparking - r8295 /team/oej/multiparking/res/res_features.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Jan 19 14:28:17 MST 2006


Author: oej
Date: Thu Jan 19 15:28:16 2006
New Revision: 8295

URL: http://svn.digium.com/view/asterisk?rev=8295&view=rev
Log:
Quoting previous committers: Oops :-)

Modified:
    team/oej/multiparking/res/res_features.c

Modified: team/oej/multiparking/res/res_features.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/res/res_features.c?rev=8295&r1=8294&r2=8295&view=diff
==============================================================================
--- team/oej/multiparking/res/res_features.c (original)
+++ team/oej/multiparking/res/res_features.c Thu Jan 19 15:28:16 2006
@@ -295,6 +295,23 @@
 	return adsi_print(chan, message, justify, 1);
 }
 
+static char *findparkinglotname(struct ast_channel *chan)
+{
+	char *temp, *parkinglot;
+
+	/* Check if the channel has a parking lot */
+	if (!ast_strlen_zero(chan->parkinglot))
+		parkinglot = chan->parkinglot;
+
+	/* Channel variables override everything */
+
+	temp  = pbx_builtin_getvar_helper(chan, "PARKINGLOT");
+
+	if (temp)
+		return temp;
+	return parkinglot;
+}
+
 /*--- ast_park_call: Park a call */
 /* We put the user in the parking list, then wake up the parking 
 	thread to be sure it looks after these channels too */
@@ -310,12 +327,8 @@
 	if (!parkinglot)
 		parkinglot = default_parkinglot;
 
-	/* Check if the channel has a parking lot */
-	if (!ast_strlen_zero(chan->parkinglot))
-		parkinglotname = chan->parkinglot;
-
-	/* Channel variables override everything */
-	parkinglotname = pbx_builtin_getvar_helper(chan, "PARKINGLOT");
+	parkinglotname = findparkinglotname(chan);
+
 	if (parkinglotname) {
 		if (option_debug)
 			ast_log(LOG_DEBUG, "---------**--------- Found chanvar Parkinglot: %s\n", parkinglotname);
@@ -1748,10 +1761,8 @@
 	LOCAL_USER_ADD(u);
 
 	/* Check if the channel has a parking lot */
-	if (!ast_strlen_zero(chan->parkinglot))
-		parkinglotname = chan->parkinglot;
-
-	parkinglotname = pbx_builtin_getvar_helper(chan, "PARKINGLOT");
+	parkinglotname = findparkinglotname(chan);
+
 	if (parkinglotname) {
 		ast_log(LOG_DEBUG, "---------**--------- Found chanvar Parkinglot: %s\n", parkinglotname);
 		parkinglot = find_parkinglot(parkinglotname);	
@@ -1794,10 +1805,7 @@
 	park = atoi((char *)data);
 	ast_mutex_lock(&parking_lock);
 
-	/* Check if the channel has a parking lot */
-	if (!ast_strlen_zero(chan->parkinglot))
-		parkinglotname = chan->parkinglot;
-	parkinglotname = pbx_builtin_getvar_helper(chan, "PARKINGLOT");
+	parkinglotname = findparkinglotname(chan);
 	if (parkinglotname) {
 		ast_log(LOG_DEBUG, "---------**--------- Found chanvar Parkinglot: %s\n", parkinglotname);
 		parkinglot = find_parkinglot(parkinglotname);	



More information about the asterisk-commits mailing list