1 Asynchronous Javascript Asterisk Manger (AJAM)
2 ==============================================
4 AJAM is a new technology which allows web browsers or other HTTP enabled
5 applications and web pages to directly access the Asterisk Manger
6 Interface (AMI) via HTTP. Setting up your server to process AJAM
9 Setup the Asterisk HTTP server
10 ------------------------------
12 1) Uncomment the line "enabled=yes" in /etc/asterisk/http.conf to enable
13 Asterisk's builtin micro HTTP server.
15 2) If you want Asterisk to actually deliver simple HTML pages, CSS,
16 javascript, etc. you should uncomment "enablestatic=yes"
18 3) Adjust your "bindaddr" and "bindport" settings as appropriate for
19 your desired accessibility
21 4) Adjust your "prefix" if appropriate, which must be the beginning of
22 any URI on the server to match. The default is "asterisk" and the
23 rest of these instructions assume that value.
25 Allow Manager Access via HTTP
26 -----------------------------
28 1) Make sure you have both "enabled = yes" and "webenabled = yes" setup
29 in /etc/asterisk/manager.conf
31 2) You may also use "httptimeout" to set a default timeout for HTTP
34 3) Make sure you have a manager username/secret
36 Once those configurations are complete you can reload or restart
37 Asterisk and you should be able to point your web browser to specific
38 URI's which will allow you to access various web functions. A complete
39 list can be found by typing "show http" at the Asterisk CLI.
43 http://localhost:8088/asterisk/manager?action=login&username=foo&secret=bar
45 This logs you into the manager interface's "HTML" view. Once you're
46 logged in, Asterisk stores a cookie on your browser (valid for the
47 length of httptimeout) which is used to connect to the same session.
49 http://localhost:8088/asterisk/rawman?action=status
51 Assuming you've already logged into manager, this URI will give you a
52 "raw" manager output for the "status" command.
54 http://localhost:8088/asterisk/mxml?action=status
56 This will give you the same status view but represented as AJAX data,
57 theoretically compatible with RICO (http://www.openrico.org).
59 http://localhost:8088/asterisk/static/ajamdemo.html
61 If you have enabled static content support and have done a make install,
62 Asterisk will serve up a demo page which presents a live, but very
63 basic, "astman" like interface. You can login with your username/secret
64 for manager and have a basic view of channels as well as transfer and
65 hangup calls. It's only tested in Firefox, but could probably be made
66 to run in other browsers as well.
68 A sample library (astman.js) is included to help ease the creation of
69 manager HTML interfaces.
71 Note that for the demo, there is no need for *any* external web server.
73 Integration with other web servers
74 ----------------------------------
76 Asterisk's micro HTTP server is *not* designed to replace a general
77 purpose web server and it is intentionally created to provide only the
78 minimal interfaces required. Even without the addition of an external
79 web server, one can use Asterisk's interfaces to implement screen pops
80 and similar tools pulling data from other web servers using iframes,
81 div's etc. If you want to integrate CGI's, databases, PHP, etc. you
82 will likely need to use a more traditional web server like Apache and
83 link in your Asterisk micro HTTP server with something like this:
85 ProxyPass /asterisk http://localhost:8088/asterisk
87 This is a fairly new technology so I'd love to hear if it's useful for