Architecture of the Asterisk GUI

Before we get too far into exploring the Asterisk GUI (or developing your own), it’s important to understand the flow of information between the client (the web browser) and Asterisk. Since these interfaces are Ajax applications, there are a lot of pieces that aren’t immediately obvious. The flow of control goes something like this:

While it may sound a little complicated at first glance, don’t be intimidated. It’s a very flexible and powerful architecture that can be used for a myriad of applications, not just an Asterisk GUI. For now, however, we’ll concentrate on enhancing the Asterisk GUI. Let’s begin by configuring the underlying pieces, and then move on to installing and modifying the Asterisk GUI.

Components of the Asterisk GUI

Let’s take a closer look at some of the key components of the Asterisk GUI. We’ll use these components later in the chapter to modify the Asterisk GUI.

Asterisk Manager Interface

As explained in Chapter 10, Asterisk Manager Interface (AMI) and Adhearsion, the Asterisk Manager Interface allows external programs to control Asterisk. The Manager interface is the heart of the Asterisk GUI, as it does all of the heavy lifting.

Manager over HTTP and the Asterisk web server

The web server built into Asterisk allows manager commands to be sent to Asterisk via HTTP, instead of creating a socket connection directly to the Manager interface. This makes it much simpler for a web application to issue AMI commands to Asterisk using the Asynchronous JavaScript Asterisk Manager (AJAM), which we will cover shortly. The web server can also be configured to serve static content, such as HTML files and images.[130]

AJAM and JavaScript

The AJAM framework uses JavaScript and XML to asynchronously send commands to Asterisk, and to update the information displayed in the web browser.



[130] You may be asking yourself, “Why embed a web server inside of Asterisk? Why not just use an external web server?” While you can use an external web server to serve up the Asterisk GUI, it’s beyond the scope of this chapter, as the security model behind Ajax permits Ajax requests only to the same domain, port, and protocol that sent the HTML page. This is often referred to as the same-origin policy.