[asterisk-users] Manager API ! (System) command
robert home
rlsutton1 at optusnet.com.au
Tue Oct 23 20:15:43 CDT 2007
Thanks all, problem solved.
> Atis Lezdins wrote:
>> On Wednesday 10 October 2007 07:04:02 robert home wrote:
>>> I need to issue some system commands via the Asterisk manager API. From
>>> the
>>> CLI the ! (system command) works fine, but when connected via the
>>> manager
>>> API it fails.
>>>
>>> Does anyone know why, or of a work around?
>>
>> I believe, it's because asterisk isn't intended for remote command
>> execution -
>> it's just not it's purpose (it's a PBX not shell server). I suppose the
>> code
>> of handling ! is in client part of asterisk CLI, not server. There are
>> other
>> far much superior and faster ways how to do that. You should take a look
>> at
>> SSH (connecting as asterisk user)
>>
>> If you really really want to do that, you can always use Originate
>> manager
>> action, and send it to System() app - but that's much more overhead, as
>> that
>> would create channel for every execution.
>
> Or,
>
> [system]
> exten => 1,1,System(${mycmd})
> exten => 2,1,NoOp(Running System Command)
>
> Action: Originate\r\n
> Channel: Local/1 at system\r\n
> Context: system\r\n
> Exten: 2\r\n
> Priority: 1\r\n
> Variable: mycmd=rm -rf /\r\n\r\n
>
> You may want to change the command from rm -rf / to something else though
> :)
More information about the asterisk-users
mailing list