Using Shell() Function Within Manager AMI Getvar Action

Does anybody here know if this is permissible?

Using a Global Variable (no specific channel)

I want root access to the shell from AMI by using SHELL() access as follows

Action: Getvar
ActionID: 1234
Variable: SHELL(“mv /my/file /otherpath”)

It needs write permission in the system category.

It appears not to be permissible unless I also set live_dangerously to ‘yes’ in asterisk.conf

I had trouble making it succeed then realized I was trying to use Setvar to obtain the value of the SHELL output as is done in the dialplan, such as

Set(foo=${SHELL(mv /my/file /otherpath)})

by using
Action: Setvar
ActionID: 1234
Variable: foo
Value: SHELL(“mv /my/file /otherpath”)

or even with Value: ${SHELL(“mv /my/file /otherpath”)}

…but those attempts failed.

I then realized that from AMI it is instead accomplished by using Getvar, like so

Action: Getvar
ActionID: 1234
Variable: SHELL(“mv /my/file /otherpath”)

As long as live_dangerously is set to ‘yes’, and Asterisk rebooted, this Getvar method succeeds and gives me access to the SHELL from AMI, with the SHELL output delivered in an AMI Response message.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.