Asterisk Manager API


#1

Where can I find thorough documentation on the Asterisk Manager API?


#2

voip-info.org/tiki-index.php … anager+API

or look at the source code in /usr/scr/asterisk/manager.c

Gerhard


#3

Thanks, I have already been using the wiki site and I find the documentation pretty useless. It lists the commands with a few examples but I am looking for something more thorough. I checked the Asterisk website and I couldn’t find anything. Does better dcumentation exist?


#4

The manager interface has changed quite a bit in the last few months. What specifically are you looking to do with it?

The best documentation I’ve found for the manager API is the asterisk source code.


#5

Should I be looking at the Asterisk Beta 3 source code? I don’t want to install Asterisk Beta 3, since it will wipe out my hard drive and install Linux. Where is a safe place to download the source code?


#6

Asterisk beta 3? there is no such thing, are you referring to Asterisk@home?

downloading the asterisk source code is easy and non-descructive, just go to astrisk.org and download one of the releases(on the right side of the main page) right to your workstation harddrive and decompress it into a folder. Then you can go into the folders and look at all of the source code with any text editor you like.


#7

Should I be looking at beta version 1.2.0? How much has the manager API changed?

What command can I use to list every extension connected to Asterisk?

Also, I downloaded the tar file but I was unable to unzip it with WinZip because there was an error reading the header.

Any advice? Thanks!
Lilli


#8

Asterisk 1.2 beta 1 would be a good place to start. It has a lot of manager API changes over the 1.0 tree.

in the manager you would send:

Action: Command
Command: Show Channels concise

To get the colon-delimited listing of all channels and their connecting exten or channel.

I always use WinRAR on windows to unzip .tar.gz files, but if there are header problems you may need to download again because it may not have finished downloading completely.


#9

Downloading the file again did not fix the problem. Also, the command Action: Command
Command: Show Channels concise
returned
Response: Error
Message: Invalid/unknown command
from both versions of Asterisk.

It seems that
Action: Command
Command:
returns the same error unless I only type
Action: Command
then I get
Response: Follows
Privilege: Command
–END COMMAND–

This is just not my day.


#10

Do you have permissions in the manager.conf file to be sending commands?

Here is exactly what we send to our Asterisk 1.2b1 servers to get channel listings:

“Action: Command\nCommand: show channels concise\n\n”

the \n are returns

It has worked for us for quite a while, but using concise will only work in the Asterisk 1.2 tree. For the 1.0 tree just remove the word “concise”


#11

All commands sent to Asterisk Manager have “\r\n\r\n” appended to them. Does Asterisk treat this differently than “\n\n”?

Looking in the manager.conf file, how/where do I set the permissions for a manager to send commands?

I used WinRAR and was able to open the beta code. Which files would be best to look into to get a better idea of the commands I can interface with?

Thanks so much for your help!


#12

I think that asterisk API treats them the same \r\n and \n

For manager permissions take a look at the manager.conf.sample file. I think you need at least command in the read and write fields for your login

/asterisk/manager.c is the first file that you should look at. it has a lot of the manager functions in it, but there are a few scattered throughout a lot of the other code, I know of at least one more in res_features.c