diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-10-13 23:58:33 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-10-13 23:58:33 +0000 |
commit | 86e61af35389cfff372b2504370c29bf3be30984 (patch) | |
tree | c5a039b76a7cb5b00ae3eda6404ba8a6ee95e409 /res | |
parent | 23cd76b172a83eec49e5e82920e24f2c3abe3933 (diff) |
ensure that parking context/extension (and other settings) are properly updated on reload (issue #5401)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6780 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rwxr-xr-x | res/res_features.c | 65 |
1 files changed, 47 insertions, 18 deletions
diff --git a/res/res_features.c b/res/res_features.c index 8ee672ac4..87fe851d5 100755 --- a/res/res_features.c +++ b/res/res_features.c @@ -77,35 +77,35 @@ static char *parkedcall = "ParkedCall"; 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 @@ static int handle_showfeatures(int fd, int argc, char *argv[]) } 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 @@ static int load_config(void) 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 @@ static int load_config(void) } 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 load_module(void) 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; |