Index: res/res_features.c =================================================================== RCS file: /usr/cvsroot/asterisk/res/res_features.c,v retrieving revision 1.73 diff -u -r1.73 res_features.c --- res/res_features.c 28 Sep 2005 23:10:14 -0000 1.73 +++ res/res_features.c 6 Oct 2005 08:11:34 -0000 @@ -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,27 @@ 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 (parking_con[0]) { + 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; @@ -2084,8 +2110,12 @@ ast_config_destroy(cfg); - if (con) - ast_context_remove_extension2(con, ast_parking_ext(), 1, registrar); + /* Remove the old parking extension */ + if (old_parking_con[0] && (con = ast_context_find(old_parking_con))) { + int res; + res = 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 +2135,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;