[svn-commits] rmudgett: branch rmudgett/parking r331137 - /team/rmudgett/parking/main/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Aug 9 10:37:46 CDT 2011


Author: rmudgett
Date: Tue Aug  9 10:37:42 2011
New Revision: 331137

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=331137
Log:
Reimplement parking findslot option broken since -r114655.

Modified:
    team/rmudgett/parking/main/features.c

Modified: team/rmudgett/parking/main/features.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/parking/main/features.c?view=diff&rev=331137&r1=331136&r2=331137
==============================================================================
--- team/rmudgett/parking/main/features.c (original)
+++ team/rmudgett/parking/main/features.c Tue Aug  9 10:37:42 2011
@@ -476,7 +476,6 @@
 
 /*! Parking lot configuration options. */
 struct parkinglot_cfg {
-/* BUGBUG need to reimplement parking findslot option.  Broken since -r114655 */
 	/*! Music class used for parking */
 	char mohclass[MAX_MUSICCLASS];
 	/*! Extension to park calls in this parking lot. */
@@ -530,6 +529,8 @@
 	 */
 	int parkedcallrecording;
 
+	/*! TRUE if findslot is set to next */
+	unsigned int parkfindnext:1;
 	/*! TRUE if the parking lot is exclusively accessed by parkext */
 	unsigned int parkext_exclusive:1;
 	/*! Add parking hints automatically */
@@ -544,6 +545,9 @@
 	char name[AST_MAX_CONTEXT];
 	/*! Parking lot user configuration. */
 	struct parkinglot_cfg cfg;
+
+	/*! Parking space to start next park search. */
+	int next_parking_space;
 
 	/*! That which bears the_mark shall be deleted if parking lot empty! (Used during reloads.) */
 	unsigned int the_mark:1;
@@ -1225,9 +1229,9 @@
 		if (parking_space < parkinglot->cfg.parking_start
 			|| parkinglot->cfg.parking_stop < parking_space) {
 			/*
-			 * Cannot allow park because parkinglot not setup for spaces
-			 * outside of lot.  (Things like dialplan hints don't exist for
-			 * outside lot space.)
+			 * Cannot allow park because parking lots are not setup for
+			 * spaces outside of the lot.  (Things like dialplan hints don't
+			 * exist for outside lot space.)
 			 */
 			ast_log(LOG_WARNING, "PARKINGEXTEN=%d is not in %s (%d-%d).\n",
 				parking_space, parkinglot->name, parkinglot->cfg.parking_start,
@@ -1258,7 +1262,13 @@
 		if (ast_test_flag(args, AST_PARK_OPT_RANDOMIZE)) {
 			start = ast_random() % (parkinglot->cfg.parking_stop - parkinglot->cfg.parking_start + 1);
 			start += parkinglot->cfg.parking_start;
-		} else { /* Otherwise, just set it to the start position. */
+		} else if (parkinglot->cfg.parkfindnext
+			&& parkinglot->cfg.parking_start <= parkinglot->next_parking_space
+			&& parkinglot->next_parking_space <= parkinglot->cfg.parking_stop) {
+			/* Start looking with the next parking space in the lot. */
+			start = parkinglot->next_parking_space;
+		} else {
+			/* Otherwise, just set it to the start position. */
 			start = parkinglot->cfg.parking_start;
 		}
 
@@ -1300,6 +1310,9 @@
 			return NULL;
 		}
 	}
+
+	/* Prepare for next parking space search. */
+	parkinglot->next_parking_space = parking_space + 1;
 
 	snprintf(pu->parkingexten, sizeof(pu->parkingexten), "%d", parking_space);
 	pu->notquiteyet = 1;
@@ -5163,6 +5176,8 @@
 				cfg->parking_start = start;
 				cfg->parking_stop = end;
 			}
+		} else if (!strcasecmp(var->name, "findslot")) {
+			cfg->parkfindnext = (!strcasecmp(var->value, "next"));
 		} else if (!strcasecmp(var->name, "parkedcalltransfers")) {
 			parkinglot_feature_flag_cfg(pl_name, &cfg->parkedcalltransfers, var);
 		} else if (!strcasecmp(var->name, "parkedcallreparking")) {




More information about the svn-commits mailing list