From 71f3dc01daa5cb349ece178634859a46c7889cc0 Mon Sep 17 00:00:00 2001 From: Alec L Davis Date: Wed, 7 Sep 2011 07:33:39 +0000 Subject: [PATCH] Prevent segfault if call arrives before Asterisk is fully booted. Prevent ast_pbx_start and ast_run_start from starting a new thread unless asterisk is fully booted. alecdavis (license 585) Tested by: alecdavis Review: https://reviewboard.asterisk.org/r/1407/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@334616 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/pbx.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/main/pbx.c b/main/pbx.c index dd6e66fdbf..031db87607 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -5191,6 +5191,11 @@ enum ast_pbx_result ast_pbx_start(struct ast_channel *c) return AST_PBX_FAILED; } + if (!ast_test_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED)) { + ast_log(LOG_WARNING, "PBX requires Asterisk to be fully booted\n"); + return AST_PBX_FAILED; + } + if (increase_call_count(c)) return AST_PBX_CALL_LIMIT; @@ -5208,6 +5213,11 @@ enum ast_pbx_result ast_pbx_run_args(struct ast_channel *c, struct ast_pbx_args { enum ast_pbx_result res = AST_PBX_SUCCESS; + if (!ast_test_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED)) { + ast_log(LOG_WARNING, "PBX requires Asterisk to be fully booted\n"); + return AST_PBX_FAILED; + } + if (increase_call_count(c)) { return AST_PBX_CALL_LIMIT; }