
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Key Issues: Asterisk Reference
|
433
Asterisk Manager Socket API
Like the AGI, the Asterisk Manager socket API provides a way for external software
to communicate with Asterisk. Unlike AGI, the purpose of the Manager API isn’t
building telephony applications. Instead, the Manager API is used for controlling
administrative and process control functions of Asterisk from external software. Here
are some things you could do with the API:
• Build a program that lets you monitor call activity. (The astman program uses
the API for this purpose.)
• Add and remove extensions and channels from a Perl, VBScript, or AppleScript
program. Of course, as long as you can create a socket, you can use any lan-
guage you like.
• Do basic call control, like hanging up channels and transferring calls. This way,
you could create a web-based or fat-client attendant console application.
All API sessions, which are TCP connections to the Asterisk server on port 5038, are
text-based exchanges. They must begin with a login exchange to authenticate the
connecting party. The security permissions for each Manager API user are stored in
/etc/asterisk/manager.conf, as discussed in “Monitoring Asterisk” in Chapter 3.
Sending a TCP packet with the following payload would log a user named Jake into
the Asterisk server. Follow ...