I know that from the CLI I can user the “!” commando to run any external shell command but when I try to do it from the Manager API using “Command” I cannot get it to work. Cannot erase or modify files I need to go through Asterisk to execute rm or mv.
! is handled by the asterisk -r process, not by the main asterisk process (and runs in the security environment of asterisk -r). Even if you use asterisk -c, there is a thread that dose the asterisk -r job.
I think the only way of executing a command through AMI is to run dialplan which uses the System application. This is probably as it should be, as the dialplan can validate the arguments. A direct approach through AMI would be a signficant security risk.