From 31707b1d69228b1f0f3585fa30f46336b94c2b9a Mon Sep 17 00:00:00 2001 From: Matthew Jordan Date: Sat, 22 Feb 2014 23:31:10 +0000 Subject: [PATCH] main: Initialize dialplan providing core components prior to module pre-load It is possible to pre-load pbx_config. As a result, pbx_config - which will load and parse the dialplan - will attempt to use various dialplan components, such as device state providers and presence state providers, prior to them being initialized by the core. This would lead to a crash, as the components had not created their Stasis cache entries. This patch moves a number of core component initializations before the module pre-load. This guarantees that if someone does pre-load pbx_config - or other pbx modules - that the Stasis caches for the various core components are created. (closes issue ASTERISK-23320) Reported by: xrobau (closes issue ASTERISK-23265) Reported by: Andrew Nagy Tested by: Andrew Nagy, Rusty Newton ........ Merged revisions 408855 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@408859 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/asterisk.c | 60 ++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/main/asterisk.c b/main/asterisk.c index e2e01a51f3..04af9740c6 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -4426,6 +4426,36 @@ int main(int argc, char *argv[]) exit(1); } + if (ast_features_init()) { + printf("%s", term_quit()); + exit(1); + } + + if (ast_pickup_init()) { + printf("%s", term_quit()); + exit(1); + } + + if (ast_bridging_init()) { + printf("%s", term_quit()); + exit(1); + } + + if (ast_parking_stasis_init()) { + printf("%s", term_quit()); + exit(1); + } + + if (ast_device_state_engine_init()) { + printf("%s", term_quit()); + exit(1); + } + + if (ast_presence_state_engine_init()) { + printf("%s", term_quit()); + exit(1); + } + if ((moduleresult = load_modules(1))) { /* Load modules, pre-load only */ printf("%s", term_quit()); exit(moduleresult == -2 ? 2 : 1); @@ -4453,41 +4483,11 @@ int main(int argc, char *argv[]) exit(1); } - if (ast_features_init()) { - printf("%s", term_quit()); - exit(1); - } - - if (ast_pickup_init()) { - printf("%s", term_quit()); - exit(1); - } - - if (ast_bridging_init()) { - printf("%s", term_quit()); - exit(1); - } - - if (ast_parking_stasis_init()) { - printf("%s", term_quit()); - exit(1); - } - if (ast_cdr_engine_init()) { printf("%s", term_quit()); exit(1); } - if (ast_device_state_engine_init()) { - printf("%s", term_quit()); - exit(1); - } - - if (ast_presence_state_engine_init()) { - printf("%s", term_quit()); - exit(1); - } - ast_dsp_init(); ast_udptl_init();