Search:
Asterisk cmd Backticks
Synopsis:
Execute a shell command and save the result as a variable.Description of application:
Backticks(<VARNAME>|<command>)<VARNAME> - The name of the variable to be set.
<command> - The shell command to execute; be sure to provide the full path to the command. I used sh, but I think any language will do.
Description of function:
Backticks(<command>)<command> - Same as above.
Notes
- *CLI> show application BACKTICKS
- *CLI> show function BACKTICKS
This application is not distributed as part of Asterisk.
S
Return value
Returns the resulting string.Example
- application:
- function:
- command.sh:
x=0
if [ -e "/some/path/$1/caller-$2.ulaw" ]; then x=1; fi /* see man test for info on the if argument */
echo $x
The above takes two args, checks for the existence of the file, if it exists return 1, else return 0; i.e. the resulting value of foo.
install
Download from You can download it from http://www.freeswitch.org/asterisk_stuff/app_backticks.cFollow his install instructions except:
# you may want to save app_backticks.c to /usr/src/asterisk
# for his step 3, cd /usr/src/asterisk first and then execute /usr/src/asterisk/contrib/scripts/astxs -install app_backticks.c
See also
- Asterisk func SHELL - A similar functionality as an Asterisk function
- Asterisk cmd System
- Asterisk func exists
- Asterisk variables
- Asterisk functions
30295 views strong.

Page Changes
