Initialize channels prior to loading "preload" modules.
authorMark Michelson <mmichelson@digium.com>
Mon, 22 Mar 2010 20:32:15 +0000 (20:32 +0000)
committerMark Michelson <mmichelson@digium.com>
Mon, 22 Mar 2010 20:32:15 +0000 (20:32 +0000)
We can have bad results when a module, upon being loaded, attempts
to reference the channels container if the container hasn't yet
been initialized. I saw this happen by trying to preload pbx_config.so
and having a hint defined which referenced a non-existent SIP peer.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@253872 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/asterisk.c

index b94a48c..3b0c7c9 100644 (file)
@@ -3603,6 +3603,8 @@ int main(int argc, char *argv[])
        ast_xmldoc_load_documentation();
 #endif
 
+       ast_channels_init();
+
        if ((moduleresult = load_modules(1))) {         /* Load modules, pre-load only */
                printf("%s", term_quit());
                exit(moduleresult == -2 ? 2 : 1);
@@ -3615,8 +3617,6 @@ int main(int argc, char *argv[])
 
        ast_http_init();                /* Start the HTTP server, if needed */
 
-       ast_channels_init();
-
        if (init_manager()) {
                printf("%s", term_quit());
                exit(1);