Hello,
I’m using Asterisk-Java and would like to execute a shell command from my manager connection.
On the CLI my command works perfectly, but when I use it through the manager connection in my application it doesn’t.
Any other CLI command I use with the manager connection functions, except for the “!”.
Anyone has an idea? Is it maybe due to security purposes? Or is my syntax wrong somewhere?
Is there an alternative way to do this within my application?
This is a snippet of my code:
CommandAction commandAction = new CommandAction("!echo 'hello'");
CommandResponse response;
//try
response = (CommandResponse) mc.sendAction(commandAction); //mc is the instance of my manager connection
//catch left out
for (String line : response.getResult())
{
System.out.println(line);
}
and the response I get:
No such command '!echo 'hello'' (type 'core show help !echo 'hello'' for other possible commands)
echo 'hello'
I also tried asteriskServer.executeCliCommand("!echo 'hello'");
but I still get no positive result.
Thanks.