I assume you aren’t using FastAGI for the fast part, as shelling is the sort of thing that is avoided to make it fast, but rather because it is running on a different machine, so can’t directly access the file.
The only thing that will cause a dialplan variable or function to be dereferenced, in this context, is get variable. Note that this will only do one level of dereferncing.
The normal dereferencing is done when the dialiplan line is fetched, not when the application is running.
I don’t understand this. When I hear ‘dereferencing’ I think of using the dereference operator on a pointer to variable like in C. In Asterisk, I think of ‘evaluating’ a variable, but if I apply that to your sentence, I would interpret it as saying that variables are evaluated when the dialplan is parsed, not when it is executed, which would be incorrect. Can you clarify your meaning?
Dereferencing might be loose. Asterisks variables and functions are actually processed as text macros. When a dialplan line has been matched, at run time, a complete macro expansion (which I think includes the application name - although I thought wrong, see below) is performed, before the application name is examined. It is then parsed into application name and data, and the selected application is run with the fully expanded data.
When you use EXEC from AGI, I think that the application and data are already parsed out. In any case no macro expansion is performed.
When you use get variable, a single variable or function is substituted.
In case it is not clear, my suggestion (which assumes that ) the above is not possible because the AGI isn’t running on the same machine, is to retrieve the SHELL functin execution as though it were a channel variable.
Ok i got it to work this is the command: GetFullVariable("${SET(ci=${SHELL(sox filename.wav -n stat 2>&1 | awk '/Maximum amplitude:/ {printf $3 * 1000000}')})}")
I wasn’t aware of their being a get full variable, as well as a get variable. However, it seems overkill in this case, unless you really need the a real channel variable setting.