[Asterisk-cvs] asterisk/res res_features.c,1.73,1.74

kpfleming kpfleming
Thu Oct 13 20:03:56 CDT 2005


Update of /usr/cvsroot/asterisk/res
In directory mongoose.digium.com:/tmp/cvs-serv23603/res

Modified Files:
	res_features.c 
Log Message:
ensure that parking context/extension (and other settings) are properly updated on reload (issue #5401)


Index: res_features.c
===================================================================
RCS file: /usr/cvsroot/asterisk/res/res_features.c,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -d -r1.73 -r1.74
--- res_features.c	28 Sep 2005 23:10:14 -0000	1.73
+++ res_features.c	13 Oct 2005 23:58:33 -0000	1.74
@@ -77,35 +77,35 @@
 static int parkingtime = DEFAULT_PARK_TIME;
 
 /* Context for which parking is made accessible */
-static char parking_con[AST_MAX_EXTENSION] = "parkedcalls";
+static char parking_con[AST_MAX_EXTENSION];
 
 /* Context for dialback for parking (KLUDGE) */
-static char parking_con_dial[AST_MAX_EXTENSION] = "park-dial";
+static char parking_con_dial[AST_MAX_EXTENSION];
 
 /* Extension you type to park the call */
-static char parking_ext[AST_MAX_EXTENSION] = "700";
+static char parking_ext[AST_MAX_EXTENSION];
 
-static char pickup_ext[AST_MAX_EXTENSION] = "*8";
+static char pickup_ext[AST_MAX_EXTENSION];
 
 /* Default sounds */
-static char courtesytone[256] = "";
-static char xfersound[256] = "beep";
-static char xferfailsound[256] = "pbx-invalid";
+static char courtesytone[256];
+static char xfersound[256];
+static char xferfailsound[256];
 
 /* First available extension for parking */
-static int parking_start = 701;
+static int parking_start;
 
 /* Last available extension for parking */
-static int parking_stop = 750;
+static int parking_stop;
 
-static int parking_offset = 0;
+static int parking_offset;
 
-static int parkfindnext = 0;
+static int parkfindnext;
 
-static int adsipark = 0;
+static int adsipark;
 
-static int transferdigittimeout = DEFAULT_TRANSFER_DIGIT_TIMEOUT;
-static int featuredigittimeout = DEFAULT_FEATURE_DIGIT_TIMEOUT;
+static int transferdigittimeout;
+static int featuredigittimeout;
 
 /* Default courtesy tone played when party joins conference */
 
@@ -1816,6 +1816,12 @@
 		}
 		AST_LIST_UNLOCK(&feature_list);
 	}
+	ast_cli(fd, "\nCall parking\n");
+	ast_cli(fd, "------------\n");
+	ast_cli(fd,"%-20s:	%s\n", "Parking extension", parking_ext);
+	ast_cli(fd,"%-20s:	%s\n", "Parking context", parking_con);
+	ast_cli(fd,"%-20s:	%d-%d\n", "Parked call extensions", parking_start, parking_stop);
+	ast_cli(fd,"\n");
 	
 	return RESULT_SUCCESS;
 }
@@ -1945,7 +1951,26 @@
 	struct ast_context *con = NULL;
 	struct ast_config *cfg = NULL;
 	struct ast_variable *var = NULL;
-	
+	char old_parking_ext[AST_MAX_EXTENSION];
+	char old_parking_con[AST_MAX_EXTENSION];
+
+	if (!ast_strlen_zero(parking_con)) {
+		strcpy(old_parking_ext, parking_ext);
+		strcpy(old_parking_con, parking_con);
+	} 
+
+	/* Reset to defaults */
+	strcpy(parking_con, "parkedcalls");
+	strcpy(parking_con_dial, "park-dial");
+	strcpy(parking_ext, "700");
+	strcpy(pickup_ext, "*8");
+	courtesytone[0] = '\0';
+	strcpy(xfersound, "beep");
+	strcpy(xferfailsound, "pbx-invalid");
+	parking_start = 701;
+	parking_stop = 750;
+	parkfindnext = 0;
+
 	transferdigittimeout = DEFAULT_TRANSFER_DIGIT_TIMEOUT;
 	featuredigittimeout = DEFAULT_FEATURE_DIGIT_TIMEOUT;
 
@@ -2083,9 +2108,11 @@
 	}
 	ast_config_destroy(cfg);
 
-	
-	if (con)
-		ast_context_remove_extension2(con, ast_parking_ext(), 1, registrar);
+	/* 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(parking_con))) {
 		if (!(con = ast_context_create(NULL, parking_con, registrar))) {
@@ -2105,6 +2132,8 @@
 	int res;
 	
 	AST_LIST_HEAD_INIT(&feature_list);
+	memset(parking_ext, 0, sizeof(parking_ext));
+	memset(parking_con, 0, sizeof(parking_con));
 
 	if ((res = load_config()))
 		return res;




More information about the svn-commits mailing list