# # patch "res/res_agi.c" # from [f10428af1545961ad59af8fabad7fc896c287d66] # to [ab40cd8ab6c03e252e6fdbe7c295c11b7edcef55] # --- res/res_agi.c +++ res/res_agi.c @@ -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 @@ -1077,7 +1078,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