Asterisk manager Example: Command

Asterisk Manager Example: Command

Execute an Asterisk CLI command in an Asterisk manager session

The Asterisk CLI is accessible through the manager API. All of the CLI commands can be passed through using the "Command subset" feature. For example,
to dump the current dialplan, send the following:

ACTION: Command
command: show dialplan

Response: Follows
[ Context 'MeetMe' created by 'pbx_config' ]
's' => 1. Answer() [pbx_config]
2. Wait(1) [pbx_config]
3. MeetMe(|DM) [pbx_config]

[ Context 'default' created by 'pbx_config' ]
'h' => 1. Goto(Hungup|${extension}|1) [pbx_config]
'_.' => 1. SetVar(extension=${EXTEN}) [pbx_config]
2. Macro(dial_agi_ver.1.0.0|${EXTEN}|${channel}) [pbx_config]
'_mysqluid-.' => 1. Macro(dial_out_ver.1.0.0|${EXTEN}) [pbx_config]

[ Context 'parkedcalls' created by 'res_features' ]
'*8' => 1. Park() [res_features]


Note: This response here has been severely truncated from the actual response I received, but I decided not to give out my customers' phone numbers if you don't mind. (:smile:) This is just to give you an idea of what it does. This is not intended to be a good example of a dialplan, please consult the dialplan examples for that.



Be careful to use just one Return (\r\n) after "Action" and doublereturn (\r\n\r\n) after "Command".
Example (in PHP):
fputs($socket, "Action: Command\r\n");
fputs($socket, "Command: show dialplan\r\n\r\n");

Created by: flobi, Last modification: Fri 21 of Apr, 2006 (07:56) by chandave
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+