diff options
author | Russell Bryant <russell@russellbryant.com> | 2007-10-14 15:34:54 +0000 |
---|---|---|
committer | Russell Bryant <russell@russellbryant.com> | 2007-10-14 15:34:54 +0000 |
commit | ac46e63a414401ffcf6d23ad3db5e8b70ed073bb (patch) | |
tree | 37225ffea5a2ba6f0ff9f5bfb6104e3c39501c9b /pbx | |
parent | 8af0a88c901b3c82840a7560c289e21c554dfe7b (diff) |
Merged revisions 85540 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r85540 | russell | 2007-10-14 10:24:52 -0500 (Sun, 14 Oct 2007) | 7 lines
Don't create the context for users in users.conf until we know at least one user exists.
(closes issue #10971)
Reported by: dimas
Patches:
pbxconfig.patch uploaded by dimas (license 88)
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@85541 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'pbx')
-rw-r--r-- | pbx/pbx_config.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c index 4c7c42ae2..8596264ca 100644 --- a/pbx/pbx_config.c +++ b/pbx/pbx_config.c @@ -1543,15 +1543,12 @@ static void pbx_load_users(void) int len; int hasvoicemail; int start, finish, x; - struct ast_context *con; + struct ast_context *con = NULL; struct ast_flags config_flags = { 0 }; cfg = ast_config_load("users.conf", config_flags); if (!cfg) return; - con = ast_context_find_or_create(&local_contexts, userscontext, registrar); - if (!con) - return; for (cat = ast_category_browse(cfg, NULL); cat ; cat = ast_category_browse(cfg, cat)) { if (!strcasecmp(cat, "general")) @@ -1603,6 +1600,16 @@ static void pbx_load_users(void) } } if (!ast_strlen_zero(iface)) { + /* Only create a context here when it is really needed. Otherwise default empty context + created by pbx_config may conflict with the one explicitly created by pbx_ael */ + if (!con) + con = ast_context_find_or_create(&local_contexts, userscontext, registrar); + + if (!con) { + ast_log(LOG_ERROR, "Can't find/create user context '%s'\n", userscontext); + return; + } + /* Add hint */ ast_add_extension2(con, 0, cat, -1, NULL, NULL, iface, NULL, NULL, registrar); /* If voicemail, use "stdexten" else use plain old dial */ |