Index: res/res_agi.c =================================================================== --- res/res_agi.c (revision 74923) +++ res/res_agi.c (working copy) @@ -2077,17 +2077,22 @@ static int agi_exec(struct ast_channel *chan, void *data) { - if (chan->_softhangup) - ast_log(LOG_WARNING, "If you want to run AGI on hungup channels you should use DeadAGI!\n"); - return agi_exec_full(chan, data, 0, 0); + if (ast_check_hangup(chan)) { + ast_log(LOG_ERROR, "If you want to run AGI on hungup channels you should use DeadAGI!\n"); + return 0; + } + else + return agi_exec_full(chan, data, 0, 0); } static int eagi_exec(struct ast_channel *chan, void *data) { int readformat, res; - if (chan->_softhangup) - ast_log(LOG_WARNING, "If you want to run AGI on hungup channels you should use DeadAGI!\n"); + if (ast_check_hangup(chan)) { + ast_log(LOG_ERROR, "If you want to run AGI on hungup channels you should use DeadAGI!\n"); + return 0; + } readformat = chan->readformat; if (ast_set_read_format(chan, AST_FORMAT_SLINEAR)) { ast_log(LOG_WARNING, "Unable to set channel '%s' to linear mode\n", chan->name); @@ -2104,6 +2109,10 @@ static int deadagi_exec(struct ast_channel *chan, void *data) { + if (!ast_check_hangup(chan)) { + ast_log(LOG_ERROR,"Running DeadAGI on a live channel is not permitted, please use AGI\n"); + return 0; + } return agi_exec_full(chan, data, 0, 1); }