Executes a command as if you were at a shell. Introduced in Asterisk 1.6.x.
Description:
SHELL(command)
Runs command and returns its output
Notes
Uses /bin/sh , regardless of what shell you actually set for Asterisk.
Return value
The output of the command
For single line output, you often will need to trim the last character, which may be a newline character. Depending on your script, if the script sends a newline, you will need to use something like:
${SHELL(echo 123):0:-1}
Example
In AEL2 script, variable result is valued to 1 if /etc/asterisk/asterisk.conf file exists, or 0 otherwise :
Set(result=${SHELL(test -f /etc/asterisk/asterisk.conf && echo -n 1 || echo -n 0)});
NoOp(result is ${result});
See also
- Asterisk cmd System
- Asterisk cmd ReadFile – Read contents of a file into a dialplan variable
- Asterisk func curl – Retrieve the contens of a URL
- Asterisk cmd Backticks – An external application that implemented similar functionality
- Asterisk variables
- Asterisk functions
- Asterisk – documentation of application commands