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

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Feb 28 05:22:28 MST 2006


Author: oej
Date: Tue Feb 28 06:22:26 2006
New Revision: 11355

URL: http://svn.digium.com/view/asterisk?rev=11355&view=rev
Log:
Fix some reload issues.

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=11355&r1=11354&r2=11355&view=diff
==============================================================================
--- team/oej/multiparking/res/res_features.c (original)
+++ team/oej/multiparking/res/res_features.c Tue Feb 28 06:22:26 2006
@@ -292,9 +292,9 @@
 }
 
 /*! \brief Find parking lot name from channel */
-static char *findparkinglotname(struct ast_channel *chan)
-{
-	char *temp, *parkinglot;
+static const char *findparkinglotname(struct ast_channel *chan)
+{
+	const char *temp, *parkinglot = NULL;
 
 	/* Check if the channel has a parking lot */
 	if (!ast_strlen_zero(chan->parkinglot))
@@ -309,7 +309,7 @@
 }
 
 /*! \brief Park a call 
- 	We put the user in the parking list, then wake up the parking thread to be sure it looks
+ 	\note We put the user in the parking list, then wake up the parking thread to be sure it looks
 	after these channels too */
 int ast_park_call_full(struct ast_channel *chan, struct ast_channel *peer, int timeout, int *extout, struct ast_parkinglot *parkinglot)
 {
@@ -2226,9 +2226,14 @@
 	struct ast_config *cfg = NULL;
 	struct ast_variable *var = NULL;
 	char *section;
-
-
-	if (!default_parkinglot) {
+	char old_parking_ext[AST_MAX_EXTENSION];
+	char old_parking_con[AST_MAX_EXTENSION] = "";
+
+
+	strcpy(old_parking_ext, parking_ext);
+	if (default_parkinglot) {
+		strcpy(old_parking_con, default_parkinglot->parking_con);
+	} else {
 		default_parkinglot = build_parkinglot(DEFAULT_PARKINGLOT, NULL);
 		if (default_parkinglot) {
 			default_parkinglot->parking_start = 701;
@@ -2238,10 +2243,11 @@
 			default_parkinglot->parkingtime = 0;
 		}
 	}
-	if (default_parkinglot)
-		ast_log(LOG_DEBUG, "Configuration of default parkinglot done.\n");
-	else {
-		ast_log(LOG_DEBUG, "Configuration of default parkinglot failed.\n");
+	if (default_parkinglot) {
+		if (option_debug)
+			ast_log(LOG_DEBUG, "Configuration of default parkinglot done.\n");
+	} else {
+		ast_log(LOG_ERROR, "Configuration of default parkinglot failed.\n");
 		return -1;
 	}
 	
@@ -2391,23 +2397,28 @@
 	/* Now, find parking lot definitions */
 	section = NULL;
 	while ((section = ast_category_browse(cfg, section))) {
-		ast_log(LOG_DEBUG, "*** Found section %s\n", section);
+		if (option_debug)
+			ast_log(LOG_DEBUG, "*** Found section %s\n", section);
 		if (!strcasecmp(section, "general") || !strcasecmp(section, "featuremap") || !strcasecmp(section, "applicationmap") )
 			continue;
 		if (option_debug)
 			ast_log(LOG_DEBUG, "Found configuration section %s, assume parking context\n", section);
 		if(!build_parkinglot(section, ast_variable_browse(cfg, section)))
 			ast_log(LOG_ERROR, "Could not build parking lot %s. Configuration error.\n", section);
-		else
+		else if (option_debug)
 			ast_log(LOG_DEBUG, "Configured parking context %s\n", section);
 	}
 
 	ast_config_destroy(cfg);
 	
-	if (con)
-		ast_context_remove_extension2(con, ast_parking_ext(), 1, registrar);
-	
-	ast_log(LOG_DEBUG, "Trying to find contexts for default parking lot\n");
+	if (option_debug)
+		ast_log(LOG_DEBUG, "Trying to find contexts for default parking lot\n");
+	
+	/* Remove the old parking extension */
+	if (!ast_strlen_zero(old_parking_con) && (con = ast_context_find(old_parking_con)))	{
+		ast_context_remove_extension2(con, old_parking_ext, 1, registrar);
+		ast_log(LOG_DEBUG, "Removed old parking extension %s@%s\n", old_parking_ext, old_parking_con);
+	}
 
 	if (!(con = ast_context_find(default_parkinglot->parking_con))) {
 		if (!(con = ast_context_create(NULL, default_parkinglot->parking_con, registrar))) {



More information about the asterisk-commits mailing list