[asterisk-commits] branch oej/test-this-branch r11352 - /team/oej/test-this-branch/res/

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


Author: oej
Date: Tue Feb 28 06:15:17 2006
New Revision: 11352

URL: http://svn.digium.com/view/asterisk?rev=11352&view=rev
Log:
Remove old default parking lot and extension properly

Modified:
    team/oej/test-this-branch/res/Makefile
    team/oej/test-this-branch/res/res_features.c

Modified: team/oej/test-this-branch/res/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/res/Makefile?rev=11352&r1=11351&r2=11352&view=diff
==============================================================================
--- team/oej/test-this-branch/res/Makefile (original)
+++ team/oej/test-this-branch/res/Makefile Tue Feb 28 06:15:17 2006
@@ -32,11 +32,11 @@
   MODS:=$(filter-out res_osp.so,$(MODS))
 endif
 
-ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/net-snmp/net-snmp-config.h),)
-  MODS:=$(filter-out res_snmp.so,$(MODS))
-else
-  SNMP_LDLIBS+=$(shell net-snmp-config --agent-libs)
-endif
+#ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/net-snmp/net-snmp-config.h),)
+  #MODS:=$(filter-out res_snmp.so,$(MODS))
+#else
+  #SNMP_LDLIBS+=$(shell net-snmp-config --agent-libs)
+#endif
 
 ifeq (${WITH_SMDI},)
   MODS:=$(filter-out res_smdi.so,$(MODS))

Modified: team/oej/test-this-branch/res/res_features.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/res/res_features.c?rev=11352&r1=11351&r2=11352&view=diff
==============================================================================
--- team/oej/test-this-branch/res/res_features.c (original)
+++ team/oej/test-this-branch/res/res_features.c Tue Feb 28 06:15:17 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