[Asterisk-code-review] res_agi: Evaluate dialplan functions and variables in agi exec (asterisk[16])

Shloime Rosenblum asteriskteam at digium.com
Wed May 11 16:03:38 CDT 2022


Shloime Rosenblum has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/18540 )


Change subject: res_agi: Evaluate dialplan functions and variables in agi exec
......................................................................

res_agi: Evaluate dialplan functions and variables in agi exec

Improve agi exec to evaluate dialplan functions and
variables in agi exec this can be usefull to SAYFILES
in Playback and Read.

ASTERISK-30058 #close

Change-Id: I669991f540496e7bddd096fec82b52c083036832
---
M res/res_agi.c
1 file changed, 3 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/40/18540/1

diff --git a/res/res_agi.c b/res/res_agi.c
index af85445..892b852 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -3121,6 +3121,7 @@
 {
 	int res, workaround;
 	struct ast_app *app_to_exec;
+	struct ast_str *data_with_var;
 
 	if (argc < 2)
 		return RESULT_SHOWUSAGE;
@@ -3133,7 +3134,8 @@
 			ast_set_flag(ast_channel_flags(chan), AST_FLAG_DISABLE_WORKAROUNDS);
 		}
 		ast_channel_unlock(chan);
-		res = pbx_exec(chan, app_to_exec, argc == 2 ? "" : argv[2]);
+		ast_str_substitute_variables(&data_with_var, 0, chan, argv[2]);
+		res = pbx_exec(chan, app_to_exec, argc == 2 ? "" : ast_str_buffer(data_with_var));
 		if (!workaround) {
 			ast_channel_clear_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS);
 		}

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/18540
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I669991f540496e7bddd096fec82b52c083036832
Gerrit-Change-Number: 18540
Gerrit-PatchSet: 1
Gerrit-Owner: Shloime Rosenblum <shloimerosenblum at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220511/73f8585e/attachment-0001.html>


More information about the asterisk-code-review mailing list