SourceForge.net Logo

1 Introduction

The Asterisk Manager (AM) is a system which enables you to easily configure your Asterisk PBX and to help you manage your Asterisk PBX remotely. This system creates the configuration (.conf) files necessary to add extensions to your Asterisk PBX and control its call flow (also known as a dial plan). You may also use this system to do administrative things like starting and stopping your Asterisk PBX from another location, remotely modify the configuration files, create and edit mailboxes and view your call detail records.



1.1 Overview

The Asterisk Manager is written in standard PERL and uses a standard HTML interface for interfacing with the user. You install the tar or zip files in a cgi-able directory and point your browser to the am-main.pl script. This will present you with the AM main menu. The main menu has two links. The first (Configuration) will take you to the configuration section of the Asterisk Management System. The second option (Administration) will take you to the administration section of the Asterisk Management System. The Administrative section of the system requires you to have root access to the server that Asterisk is running on. You actually have to have sudo set properly to be able to use the Administrative functions.

The configuration functions do not require any special privileges except you need a directory where you have read/write privileges in order to create and store your profiles. The system is structured so that even if you do not have read/write privileges for the deafult web server directory, you can still set the directory information (which the system passes between scripts) and use the system. For example, on my default server, I can read/write anywhere since I am root so in this case I use /usr/tmp as my default working directory, however, when I run this system on my Yahoo server (I use Yahoo web hosting for some of my pages) I do not have read/write privileges to anywhere except my default home directory (which I must specify as '/') so this is what I set my working directory to.

The system runs on any server (not just the server you are running Asterisk on), however, remember, if you are running the system on a different server than where you are running your Asterisk PBX then the administrative functions will not work. This allows you to run the system on a local server where your 'extensions.conf' and 'sip.conf' files are created/stored, and then at a later date you can choose to transfer these files to the Asterisk PBX using any method desired.



1.2 Theory of Operation

The system implements an Asterisk dial plan (extensions and sip .conf files) which is based on the following assumptions ...

(A) Calls from devices not known by the system (IE there is not a definition of the device in sip.conf) are considered outside originated.
(B) Calls from devices known by the system are considered internally originated.
(C) When an extension is created, it is declared as either a public or private extension.
(D) Outside originated calls can only see public extensions.
(E) Internally originated calls can see both public and private extensions




1.3 Modes of Operation

From a high level the system can be thought of as two separate entities; one which allows you to configure your Asterisk PBX, and one which allows you to control (or administer) the PBX. Technically, though, the two entities are very different.

The configuration functions do not require access to the actual PBX or associated directories. In fact you can run the configuration portion of the system on a Windows hosted web server (Asterisk by the way, does not currently run under Windows) if you prefer, or any operating system for that matter which supports PERL.

The administrative functions, however, require access to the machine the PBX actually runs on. In other words, the AM administrative PERL scripts must be hosted on the same computer as the Asterisk PBX. In addition, the machine must allow the AM scripts to have read, write and execute privileges for several LINUX/UNIX files and commands.

You can run just the configuration portion of the Asterisk Manager from any web server, however, you will still need at least one place where you can store (read/write) files to, as described below.



1.3.1 Using Just the Configuration Functions

In order to be able to use the configuration functions of the Asterisk Manager you will first need to set the working directory to somewhere the AM PERL scripts can create configuration files. By default, the system assumes you have read/write privileges to the subdirectory /usr/tmp. If you are running the Asterisk Manager PERL scripts on a LINUX based system then you probably already have access to this directory and nothing further needs to be done in order to use the configuration functions.

The configuration functions do not require any special privileges except you need a directory where you have read/write privileges in order to create and store your profiles. The system is structured so that even if you do not have read/write privileges for the deafult web server directory, you can still set the directory information (which the system passes between scripts) and use the system. For example, on my default server, I can read/write anywhere since I am root so in this case I use /usr/tmp as my default working directory, however, when I run this system on my Yahoo server (I use Yahoo web hosting for some of my pages) I do not have read/write privileges to anywhere except my default home directory (which I must specify as '/') so this is what I set my working directory to. You will have to set your working directory before you can use any configuration functions, if as stated earlier, your server does not allow access by default to the /usr/tmp directory.



1.3.2 Setting Up to Use the Administration Functions

If you do not plan on using the Asterisk Manager to administer your PBX (stop, start, etc.) then you can skip ahead to section two as the remainder of this section discusses how to set up your sudoers file for use by the Asterisk Manager.

You will need to set up a sudo file entry in order to use the Asterisk Manager administrative functions. Here is what is actually getting executed by these scripts ...

system("sudo ps -x | grep asterisk > $fn");

where $fn is a temp file used to hold the results of the grep operation. This means you will need to be able to execute the 'ps' command as well as grep in order for this to work.

system("asterisk_install_dir/asterisk");

where 'asterisk_install_dir' is the directory where Asterisk was installed. This implies you have proper privileges for the Asterisk executable (on my system, the user and group are Apache so I needed to add an entry for Apache in the sudoers file).

system("sudo $dir_ast"."/asterisk -rx \"stop now\"");

again, this requires proper privileges to run the Asterisk executable.

If you are running Asterisk on a test server, placing the following two lines into the sudoers file (use the visudo command to edit it) will enable all administrative functions available ...

apache ALL=(ALL) NOPASSWD: ALL www ALL=(ALL) NOPASSWD: ALL

Be sure to remove these lines once you deploy your PBX live as they create a very real security risk if you leave them in !!!



Home   |   <--- Previous Section   |   Next Section --->