login | register
Wed 20 of Aug, 2008 [11:43 UTC]

voip-info.org

Discuss [3] History

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:
ACTION: COMMAND
command: Show Channels


RECEIVE:
Response: Follows
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


(I'm not sure about the \r after "1 active call" at the moment, I can't check. - flobi)

Back

Asterisk Manager API


Comments

Comments Filter
222

333

by gregmac, Sunday 15 of October, 2006 [22:21:03 UTC]
(as of revision 44379, Oct 15/2006)

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.

222

333Is a little detail...

by El_Pop, Thursday 17 of March, 2005 [07:06:02 UTC]
The sequence in the response event dont send return - line feed (\r\n), only send line-feed (\n), if you write a handler who wait for a return - line feed, the result sequence are ignored and send the respond that you mention.
222

333No system commands available

by Obelisk, Tuesday 08 of February, 2005 [11:04:10 UTC]
In Manager:

action: command
command: ! ls

returns:

Response: Follows
--END COMMAND--

No Output.

Any workaround?

Best Regards,

Andreas