[Asterisk-cvs] asterisk/res res_agi.c,1.47,1.48

kpfleming kpfleming
Mon Aug 22 18:58:19 CDT 2005


Update of /usr/cvsroot/asterisk/res
In directory mongoose.digium.com:/tmp/cvs-serv10256/res

Modified Files:
	res_agi.c 
Log Message:
allow custom dialplan functions to be called from AGI (issue #4855)


Index: res_agi.c
===================================================================
RCS file: /usr/cvsroot/asterisk/res/res_agi.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- res_agi.c	22 Aug 2005 21:59:24 -0000	1.47
+++ res_agi.c	22 Aug 2005 23:00:23 -0000	1.48
@@ -50,6 +50,7 @@
 #include "asterisk/manager.h"
 #include "asterisk/utils.h"
 #include "asterisk/lock.h"
+#include "asterisk/strings.h"
 #include "asterisk/agi.h"
 
 #define MAX_ARGS 128
@@ -1131,7 +1132,14 @@
 
 	if (argc != 3)
 		return RESULT_SHOWUSAGE;
-	pbx_retrieve_variable(chan, argv[2], &ret, tempstr, sizeof(tempstr), NULL);
+
+	/* check if we want to execute an ast_custom_function */
+	if (!ast_strlen_zero(argv[2]) && (argv[2][strlen(argv[2]) - 1] == ')')) {
+		ret = ast_func_read(chan, argv[2], tempstr, sizeof(tempstr));
+	} else {
+		pbx_retrieve_variable(chan, argv[2], &ret, tempstr, sizeof(tempstr), NULL);
+	}
+
 	if (ret)
 		fdprintf(agi->fd, "200 result=1 (%s)\n", ret);
 	else




More information about the svn-commits mailing list