B.126. TrySystem()

Tries to execute a shell command.
TrySystem(command)
Like System(), it executes a command on the shell (sh or its equivalents), but always returns 0. In contrast, System() returns -1 on error.
Sets the channel variable SYSTEMSTATUS to SUCCESS, FAILURE or APPERROR (command was run but returned an exit code other than 0).
exten => 123,1,TrySystem(echo 'Hey World' > /tmp/hey.txt)

Note

Internal help for this application in Asterisk 1.4:
  -= Info about application 'TrySystem' =- 

[Synopsis]
Try executing a system command

[Description]
  TrySystem(command): Executes a command  by  using  system().
on any situation.
Result of execution is returned in the SYSTEMSTATUS channel variable:
   FAILURE  Could not execute the specified command
   SUCCESS  Specified command successfully executed
   APPERROR Specified command successfully executed, but returned error code

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.  Otherwise, System will terminate.
diff output to internal help in Asterisk 1.2:
- none -