[asterisk-commits] russell: branch 1.4 r85540 - /branches/1.4/pbx/pbx_config.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sun Oct 14 10:24:53 CDT 2007
Author: russell
Date: Sun Oct 14 10:24:52 2007
New Revision: 85540
URL: http://svn.digium.com/view/asterisk?view=rev&rev=85540
Log:
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)
Modified:
branches/1.4/pbx/pbx_config.c
Modified: branches/1.4/pbx/pbx_config.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/pbx/pbx_config.c?view=diff&rev=85540&r1=85539&r2=85540
==============================================================================
--- branches/1.4/pbx/pbx_config.c (original)
+++ branches/1.4/pbx/pbx_config.c Sun Oct 14 10:24:52 2007
@@ -2366,13 +2366,10 @@
int len;
int hasvoicemail;
int start, finish, x;
- struct ast_context *con;
+ struct ast_context *con = NULL;
cfg = ast_config_load("users.conf");
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)) {
@@ -2425,6 +2422,16 @@
}
}
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 */
More information about the asterisk-commits
mailing list