Asterisk func shell

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




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




Created by: tzafrir, Last modification: Wed 16 of Feb, 2011 (06:32 UTC) by ili4
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+