[asterisk-commits] mvanbaak: branch group/multiparking r110086 - /team/group/multiparking/main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Mar 19 15:37:40 CDT 2008


Author: mvanbaak
Date: Wed Mar 19 15:37:39 2008
New Revision: 110086

URL: http://svn.digium.com/view/asterisk?view=rev&rev=110086
Log:
- miss a couple of AST_UNLOCK calls.
- 'features show' now shows all configured parking lots

Modified:
    team/group/multiparking/main/features.c

Modified: team/group/multiparking/main/features.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/main/features.c?view=diff&rev=110086&r1=110085&r2=110086
==============================================================================
--- team/group/multiparking/main/features.c (original)
+++ team/group/multiparking/main/features.c Wed Mar 19 15:37:39 2008
@@ -478,6 +478,7 @@
 			parkinglot_unref(parkinglot);
 			ast_free(pu);
 			ast_log(LOG_WARNING, "Requested parking extension already exists: %s@%s\n", parkingexten, parkinglot->parking_con);
+			ASTOBJ_UNLOCK(parkinglot);
 			return 1;	/* Continue execution if possible */
 		}
 		ast_copy_string(pu->parkingexten, parkingexten, sizeof(pu->parkingexten));
@@ -2589,6 +2590,7 @@
 	if (chan->_state != AST_STATE_UP)
 		ast_answer(chan);
 
+	//XXX Why do we unlock here ?
 	ASTOBJ_UNLOCK(parkinglot);
 
 	if (peer) {
@@ -2853,6 +2855,7 @@
 			default_parkinglot->parking_offset = 0;
 			default_parkinglot->parkfindnext = 0;
 			default_parkinglot->parkingtime = 0;
+			ASTOBJ_UNLOCK(default_parkinglot);
 		}
 	}
 	if (default_parkinglot) {
@@ -3182,12 +3185,18 @@
 			ast_cli(a->fd, HFS_FORMAT, feature->sname, "no def", feature->exten);
 		AST_LIST_UNLOCK(&feature_list);
 	}
-	ast_cli(a->fd, "\nCall parking (default parking lot)\n");
-	ast_cli(a->fd, "------------\n");
-	ast_cli(a->fd,"%-20s:      %s\n", "Parking extension", parking_ext);
-	ast_cli(a->fd,"%-20s:      %s\n", "Parking context", default_parkinglot->parking_con);
-	ast_cli(a->fd,"%-20s:      %d-%d\n", "Parked call extensions", default_parkinglot->parking_start, default_parkinglot->parking_stop);
-	ast_cli(a->fd,"\n");
+
+	// loop throug all the parking lots
+	ASTOBJ_CONTAINER_TRAVERSE(&parkinglots, 1, do {
+		ASTOBJ_RDLOCK(iterator);
+		ast_cli(a->fd, "\nCall parking (Parking lot: %s)\n", iterator->name);
+		ast_cli(a->fd, "------------\n");
+		ast_cli(a->fd,"%-20s:      %s\n", "Parking extension", parking_ext);
+		ast_cli(a->fd,"%-20s:      %s\n", "Parking context", iterator->parking_con);
+		ast_cli(a->fd,"%-20s:      %d-%d\n", "Parked call extensions", iterator->parking_start, iterator->parking_stop);
+		ast_cli(a->fd,"\n");
+		ASTOBJ_UNLOCK(iterator);
+	} while (0) );
 
 	return CLI_SUCCESS;
 }
@@ -3765,8 +3774,7 @@
 		res = ast_register_application2(parkcall, park_call_exec, synopsis2, descrip2, NULL);
 	if (!res) {
 		ast_manager_register("ParkedCalls", 0, manager_parking_status, "List parked calls");
-		ast_manager_register2("Park", EVENT_FLAG_CALL, manager_park,
-			"Park a channel", mandescr_park); 
+		ast_manager_register2("Park", EVENT_FLAG_CALL, manager_park, "Park a channel", mandescr_park); 
 		ast_manager_register2("Bridge", EVENT_FLAG_CALL, action_bridge, "Bridge two channels already in the PBX", mandescr_bridge);
 	}
 




More information about the asterisk-commits mailing list