Asterisk Manager API Action Command
Created by: flobi,Last modification on Mon 22 of Jan, 2007 [16:41 UTC] by evanpetten
Asterisk Manager API Action: Command
Action: Command
Parameters: Command (Asterisk CLI command, not an application command), ActionID
Example (Show Channels) via Asterisk 1.0.9:
SEND:
RECEIVE:
Example
(I'm not sure about the \r after "1 active call" at the moment, I can't check. - flobi)
Action: Command
Parameters: Command (Asterisk CLI command, not an application command), ActionID
Example (Show Channels) via Asterisk 1.0.9:
SEND:
ACTION: COMMAND
command: Show Channels
command: Show Channels
RECEIVE:
Response: Follows
Channel (Context Extension Pri ) State Appl. Data
0 active channel(s)
--END COMMAND--
Channel (Context Extension Pri ) State Appl. Data
0 active channel(s)
--END COMMAND--
Note
The sequence in the response event doesn't send a carriage return - line feed (\r\n), it only sends a line-feed (\n), if you write a handler who wait for a carriage return - line feed, the result sequence is ignored and send the respond that you mention.Example
Response: Follows\r\n
Channel Location State Application(Data)\n
SIP/x7065551212b-1af (None) Ringing AppDial((Outgoing Line))\n
SIP/x7065551212c-2aa 29@default:2 Ring Dial(SIP/x7065551212b)\n
2 active channels\n
1 active call\r\n
--END COMMAND--\r\n
\r\n
Channel Location State Application(Data)\n
SIP/x7065551212b-1af (None) Ringing AppDial((Outgoing Line))\n
SIP/x7065551212c-2aa 29@default:2 Ring Dial(SIP/x7065551212b)\n
2 active channels\n
1 active call\r\n
--END COMMAND--\r\n
\r\n
(I'm not sure about the \r after "1 active call" at the moment, I can't check. - flobi)
Comments
333
It seems that it's not possible to use ! (bang) with Command, because of the way it's been implemented.
in asterisk.c, consolehandler() and remoteconsolehandler() both do:
/* The real handler for bang */
if (s0 == '!') {
instead of letting ast_cli_command() handle it (like every other command).
In the astman command function, it uses ast_cli_command() only for handling commands. bang_handler() - the registered handler for the ! command - does nothing, which is why when you use ! via astman, it returns with no errors, and no output.
333Is a little detail...
333No system commands available
action: command
command: ! ls
returns:
Response: Follows
--END COMMAND--
No Output.
Any workaround?
Best Regards,
Andreas