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

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Aug 5 19:57:39 CDT 2011


Author: rmudgett
Date: Fri Aug  5 19:57:35 2011
New Revision: 330997

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=330997
Log:
* Make features unit test test more dynamic parking config channel
variables.

* Fix two dynamic parking lot creation bugs.

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=330997&r1=330996&r2=330997
==============================================================================
--- team/rmudgett/parking/main/features.c (original)
+++ team/rmudgett/parking/main/features.c Fri Aug  5 19:57:35 2011
@@ -455,7 +455,9 @@
  * The list belongs to a parkinglot.
  */
 struct parkeduser {
-	struct ast_channel *chan;                   /*!< Parked channel */
+/* BUGBUG need to make hold a channel reference! */
+	/*! Parked channel. */
+	struct ast_channel *chan;
 	struct timeval start;                       /*!< Time the park started */
 	int parkingnum;                             /*!< Parking lot space used */
 	char parkingexten[AST_MAX_EXTENSION];       /*!< If set beforehand, parking extension used for this call */
@@ -1084,7 +1086,7 @@
 				sizeof(parkinglot->cfg.parking_con));
 		}
 		if (!ast_strlen_zero(dyn_exten)) {
-			ast_copy_string(parkinglot->cfg.parking_con, dyn_exten,
+			ast_copy_string(parkinglot->cfg.parkext, dyn_exten,
 				sizeof(parkinglot->cfg.parkext));
 		}
 		if (!ast_strlen_zero(dyn_range)) {
@@ -1108,7 +1110,8 @@
 		 * a reload.
 		 */
 		if (!strcmp(parkinglot->cfg.parking_con, template_parkinglot->cfg.parking_con)) {
-			if (!strcmp(parkinglot->cfg.parkext, template_parkinglot->cfg.parkext)) {
+			if (!strcmp(parkinglot->cfg.parkext, template_parkinglot->cfg.parkext)
+				&& parkinglot->cfg.parkext_exclusive) {
 				ast_log(LOG_WARNING,
 					"Parking lot '%s' conflicts with template parking lot '%s'!\n"
 					"Change either PARKINGDYNCONTEXT or PARKINGDYNEXTEN.\n",
@@ -3602,14 +3605,17 @@
 
 /*!
  * \brief bridge the call and set CDR
- * \param chan,peer,config
- * 
+ *
+ * \param chan The bridge considers this channel the caller.
+ * \param peer The bridge considers this channel the callee.
+ * \param config Configuration for this bridge.
+ *
  * Set start time, check for two channels,check if monitor on
  * check for feature activation, create new CDR
  * \retval res on success.
  * \retval -1 on failure to bridge.
  */
-int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast_bridge_config *config)
+int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config)
 {
 	/* Copy voice back and forth between the two channels.  Give the peer
 	   the ability to transfer calls with '#<extension' syntax. */
@@ -7634,8 +7640,12 @@
 		.fixup = fake_fixup, /* silence warning from masquerade */
 	};
 
-	static const char unique_parkinglot[] = "myuniquetestparkinglot3141592654";
-	static const char parkinglot_range[] = "750-760";
+	static const char unique_lot_1[] = "myuniquetestparkinglot314";
+	static const char unique_lot_2[] = "myuniquetestparkinglot3141592654";
+	static const char unique_context_1[] = "myuniquetestcontext314";
+	static const char unique_context_2[] = "myuniquetestcontext3141592654";
+	static const char parkinglot_parkext[] = "750";
+	static const char parkinglot_range[] = "751-760";
 
 	switch (cmd) {
 	case TEST_INIT:
@@ -7677,7 +7687,9 @@
 		res = -1;
 		goto exit_features_test;
 	}
-	pbx_builtin_setvar_helper(test_channel1, "PARKINGLOT", unique_parkinglot);
+	pbx_builtin_setvar_helper(test_channel1, "PARKINGLOT", unique_lot_1);
+	pbx_builtin_setvar_helper(test_channel1, "PARKINGDYNCONTEXT", unique_context_1);
+	pbx_builtin_setvar_helper(test_channel1, "PARKINGDYNEXTEN", parkinglot_parkext);
 	pbx_builtin_setvar_helper(test_channel1, "PARKINGDYNPOS", parkinglot_range);
 	if (park_call_full(test_channel1, NULL, &args)) {
 		res = -1;
@@ -7685,11 +7697,19 @@
 	}
 	/* grab newly created parking lot for destruction in the end */
 	dynlot = args.pu->parkinglot;
-	if (args.pu->parkingnum != 750
-		|| strcasecmp(dynlot->name, unique_parkinglot)
-		|| dynlot->cfg.parking_start != 750
+	if (args.pu->parkingnum != 751
+		|| strcmp(dynlot->name, unique_lot_1)
+		|| strcmp(dynlot->cfg.parking_con, unique_context_1)
+		|| strcmp(dynlot->cfg.parkext, parkinglot_parkext)
+		|| dynlot->cfg.parking_start != 751
 		|| dynlot->cfg.parking_stop != 760) {
 		ast_test_status_update(test, "Parking settings were not respected\n");
+		ast_test_status_update(test, "Dyn-name:%s\n", dynlot->name);
+		ast_test_status_update(test, "Dyn-context:%s\n", dynlot->cfg.parking_con);
+		ast_test_status_update(test, "Dyn-parkext:%s\n", dynlot->cfg.parkext);
+		ast_test_status_update(test, "Dyn-parkpos:%d-%d\n", dynlot->cfg.parking_start,
+			dynlot->cfg.parking_stop);
+		ast_test_status_update(test, "Parked in space:%d\n", args.pu->parkingnum);
 		if (!unpark_test_channel(test_channel1, &args)) {
 			test_channel1 = NULL;
 		}
@@ -7709,7 +7729,9 @@
 		res = -1;
 		goto exit_features_test;
 	}
-	pbx_builtin_setvar_helper(test_channel1, "PARKINGLOT", unique_parkinglot);
+	pbx_builtin_setvar_helper(test_channel1, "PARKINGLOT", unique_lot_2);
+	pbx_builtin_setvar_helper(test_channel1, "PARKINGDYNCONTEXT", unique_context_2);
+	pbx_builtin_setvar_helper(test_channel1, "PARKINGDYNEXTEN", parkinglot_parkext);
 	pbx_builtin_setvar_helper(test_channel1, "PARKINGDYNPOS", parkinglot_range);
 	if (masq_park_call(test_channel1, NULL, 0, NULL, 0, &args)) {
 		res = -1;
@@ -7720,11 +7742,19 @@
 	test_channel1 = NULL;
 
 	dynlot = args.pu->parkinglot;
-	if (args.pu->parkingnum != 750
-		|| strcasecmp(dynlot->name, unique_parkinglot)
-		|| dynlot->cfg.parking_start != 750
+	if (args.pu->parkingnum != 751
+		|| strcmp(dynlot->name, unique_lot_2)
+		|| strcmp(dynlot->cfg.parking_con, unique_context_2)
+		|| strcmp(dynlot->cfg.parkext, parkinglot_parkext)
+		|| dynlot->cfg.parking_start != 751
 		|| dynlot->cfg.parking_stop != 760) {
 		ast_test_status_update(test, "Parking settings were not respected\n");
+		ast_test_status_update(test, "Dyn-name:%s\n", dynlot->name);
+		ast_test_status_update(test, "Dyn-context:%s\n", dynlot->cfg.parking_con);
+		ast_test_status_update(test, "Dyn-parkext:%s\n", dynlot->cfg.parkext);
+		ast_test_status_update(test, "Dyn-parkpos:%d-%d\n", dynlot->cfg.parking_start,
+			dynlot->cfg.parking_stop);
+		ast_test_status_update(test, "Parked in space:%d\n", args.pu->parkingnum);
 		res = -1;
 	} else {
 		ast_test_status_update(test, "Parking settings for masquerading park verified\n");




More information about the svn-commits mailing list