Quantcast
Channel: VOIP-info.org Wiki Changes
Viewing all articles
Browse latest Browse all 5767

Asterisk cmd System

$
0
0

This document is out of date!

Please visit the Asterisk wiki for up to date information — App_System Documentation

For historical reference, the original information is below.

System()

For Asterisk >=1.2

Synopsis

Execute a system (Linux shell) command

Description

System(command) - System command alone
System(command arg1 arg2 etc) - Pass in some arguments
System(command|args) - Use the standard asterisk syntax to pass in arguments

Technical Info

Executes a command by using system().
System() passes the string unaltered to system(3). Running "man 3 system" will show exactly what system(3) does:

system() executes a command specified in string by calling
/bin/sh -c string, and returns after the command has been completed.

Therefore System(command arg1 arg2 etc) can be used to pass along arguments.

Return codes

System(command): Executes a command by using system(). If the command fails, the console should report a fallthrough.
If you need to return a specific value (string) to the dialplan then use either AGI or SHELL as introduced in Asterisk 1.6.0.

Result of execution is returned in the SYSTEMSTATUS channel variable:

FAILURE Could not execute the specified command
SUCCESS Specified command successfully executed
APPERROR Triggered for example when you try to delete a file but the file was not there.
NOTE - not documented, but can also return APPERROR
NOTE - I don't seem to be able to create a situation when FAILURE will be returned.

As far as I can understand it will return APPERROR when the command exits with a non-zero return-value.

Old behaviour:
If the command itself executes but is in error, and if there exists a priority n + 101, where 'n' is the priority of the current instance, then the channel will be setup to continue at that priority level. Note that this jump functionality has been deprecated and will only occur if the global priority jumping option is enabled in extensions.conf (priorityjumping=yes).


app_backticks (3rd party addition)

Execute a shell command and save the result as a variable; available as both application and function from here. A patch to use this application with the new module system in Asterisk 1.4+ can be found

Viewing all articles
Browse latest Browse all 5767

Trending Articles