summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2007-07-19 15:59:19 +0000
committerRussell Bryant <russell@russellbryant.com>2007-07-19 15:59:19 +0000
commita971b4bfc4fa9141bc43485877c1f3a869507a20 (patch)
treef83f3cb4682ba1819147867901ae64142b227655 /res
parent7b09e738f0c479d5ee2d6e780e4c7bde12047004 (diff)
(closes issue #10210, reported and patched by juggie)
This merges the trunk only part of the patches from this issue. In 1.4, res_agi will issue a warning if you try to use DeadAGI on a channel that is not hung up. Now, in trunk, it just plain won't let you do it. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75930 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res')
-rw-r--r--res/res_agi.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/res/res_agi.c b/res/res_agi.c
index e5b62fe58..13fe23224 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -2077,8 +2077,11 @@ static int agi_exec_full(struct ast_channel *chan, void *data, int enhanced, int
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");
+ 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;
+ }
+
return agi_exec_full(chan, data, 0, 0);
}
@@ -2086,8 +2089,10 @@ 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 eagi_exec(struct ast_channel *chan, void *data)
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);
}