[asterisk-commits] russell: trunk r75930 - /trunk/res/res_agi.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 19 10:59:19 CDT 2007


Author: russell
Date: Thu Jul 19 10:59:19 2007
New Revision: 75930

URL: http://svn.digium.com/view/asterisk?view=rev&rev=75930
Log:
(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.

Modified:
    trunk/res/res_agi.c

Modified: trunk/res/res_agi.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_agi.c?view=diff&rev=75930&r1=75929&r2=75930
==============================================================================
--- trunk/res/res_agi.c (original)
+++ trunk/res/res_agi.c Thu Jul 19 10:59:19 2007
@@ -2077,8 +2077,11 @@
 
 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 @@
 {
 	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);
 }
 




More information about the asterisk-commits mailing list