The GUI - Asterisk Manager Interface (AMI)

[Ref: OpenBSD 5.1, Asterisk 1.8.11 (from ports), Asterisk Manager Interface

Table of Contents
  1. Asterisk Management Interface
  2. GUI

Asterisk Management Interface

The default install of Asterisk does not enable key components required for Asterisk GUI. To configure, enable the gui we need to configure the Asterisk Manager Interface, which involves configuring at least 2 configuration files:

We can confirm the status of the http module by using the console-commands manager show settings and http show status

myhost*CLI> manager show settings

Global Settings

Manager (AMI): No Web Manager (AMI/HTTP): No …

myhost*CLI> http show status

HTTP Server Status:
Prefix:
Server Disabled

Enabled URI’s: /httpstatus => Asterisk HTTP General Status /phoneprov/… => Asterisk HTTP Phone Provisioning Tool /static/… => Asterisk HTTP Static Delivery

Enabled Redirects: None.

Note, the Server Disabled information.

Use $!manpage(‘locate’,1)!$ to find the sample copies from the Asterisk Package and copy that as the initial configuration.

Edit with the following changes:

File extract: /etc/asterisk/manager.conf

webenabled=true

File extract: /etc/asterisk/http.conf

enabled=true

Enabling

Enable the configuration by reloading Asterisk, which can be done through restarting asterisk (always a good practise) but in a live environment, you can reload Asterisk using core reload

myhost*CLI> core reload

Enabled and Operational

With the above configuration safely in place, you should get at least the minimal below display.

myhost*CLI> http show status

HTTP Server Status:
Prefix:
Server Enabled and Bound to 127.0.0.1:8080

Enabled URI’s: /httpstatus => Asterisk HTTP General Status /phoneprov/… => Asterisk HTTP Phone Provisioning Tool /static/… => Asterisk HTTP Static Delivery

Enabled Redirects: None.

$ lynx http://localhost:8080/httpstatus

                    Asterisk™ HTTP Status

                         Prefix
                   Bind Address 127.0.0.1
                       Bind Port 8080
                            ---
                            ---

Asterisk and Digium are registered trademarks of Digium, Inc

Asterisk GUI

[Ref: Interesting Applications

Grab the install files from the subversion repository

$ svn co http://svn.digium.com/svn/asterisk-gui/branches/2.0 asterisk-gui $ cd asterisk-gui $ cd ./configure –prefix=/usr/local –sysconfdir=/etc –localstatedir=/usr/local/share

Edit the generated Makefile to make the following changes.

$ diff -u Makefile.org Makefile — Makefile.org Thu Apr 4 13:08:08 2013 +++ Makefile Thu Apr 4 13:09:36 2013 @@ -64,7 +64,7 @@ ifeq ($(OSARCH),FreeBSD) ASTVARLIBDIR:=$(DESTDIR)$(prefix)/share/asterisk else - ASTVARLIBDIR:=$(DESTDIR)$(localstatedir)/lib/asterisk + ASTVARLIBDIR:=$(DESTDIR)$(localstatedir)/asterisk endif endif endif

I’m making the above changes, because the OpenBSD package install configures astlibdir (inside /etc/asterisk/asterisk.conf) to /usr/local/share/asterisk but this is not being picked up by the build process.

$ gmake

+——- Asterisk-GUI Build Complete ——-+
 + Asterisk-GUI has successfully been built, +
 + and can be installed by running:          +
 +                                           +
 +               gmake install                +
 +——————————————-+

$ sudo gmake install

+—- Asterisk GUI Installation Complete —+ + + + YOU MUST READ THE SECURITY DOCUMENT + + + + Asterisk-GUI has successfully been + + installed. + + + +——————————————-+ + + + BEFORE THE GUI WILL WORK + + + + Before the GUI will run, you must perform + + some modifications to the Asterisk + + configuration files in accordance with + + the README file. When done, you can + + check your changes by doing: + + + + gmake checkconfig + + + +——————————————-+

The install process copies files to their appropriate directories.

$ sudo gmake checkconfig

 — Checking Asterisk configuration to see if it will support the GUI —
* Checking for http.conf: OK
* Checking for manager.conf: OK
* Checking if HTTP is enabled: OK
* Checking if HTTP static support is enabled: OK
* Checking if manager is enabled: OK
* Checking if manager over HTTP is enabled: OK
 — Everything looks good —
 * GUI should be available at http://aswsydpbx001.aswigsolutions.com:8088/asterisk/static/config/index.html

  • Note: If you have bindaddr=127.0.0.1 in /etc//asterisk/http.conf you will only be able to visit it from the local machine.

Example: http://localhost:8088/asterisk/static/config/index.html

  • The login and password should be an entry from /etc//asterisk/manager.conf which has ‘config’ permission in read and write. For example:

    [admin] secret = mysecret9602 read = system,call,log,verbose,command,agent,config write = system,call,log,verbose,command,agent,config

— Good luck! —

Unfortunately, the sample user account [admin] shown above does not work for me, but using the sample specified in the README file does.

File Excerpt: README

Configuration
=============
...
3) Create an appropriate entry in manager.conf for the administrative user
(PLEASE READ THE security.txt FILE!)

    [admin]
    secret = thiswouldbeaninsecurepassword
    read = system,call,log,verbose,command,agent,config,read,write,originate
    write = system,call,log,verbose,command,agent,config,read,write,originate

Troubleshooting
===============
1) Check your config permissions:
        $ chown asterisk:asterisk /etc/asterisk/*.conf
        $ chmod 644 /etc/asterisk/*.conf

Missing Configuration Files

Some configuration settings are expected, but missing from our OpenBSD package install:

File extract: /etc/asterisk/dahdi_genconf

File extract: /etc/asterisk/dahdi_guiread.conf

[general]

File extract: /etc/asterisk/guipreferences.conf

[general]
config_upgraded = yes

Remember the file permissions from the README file.

Paths in Scripts

Location: /usr/local/share/asterisk/scripts, /usr/local/share/asterisk/static-http/config/js

In the above locations, modify all references to /var/lib/asterisk to the standard OpenBSD Package install path: /usr/local/share/asterisk

Location: /usr/local/share/asterisk/static-http

Ensure to give the _asterisk user read/write permissions to the “config” path and subdirectories

Location: /var/lib/asterisk

Since there are so many references, to the ‘wrong’ location, simplest solution is to create a symlink between the ‘broken’ path and the ‘correct’ path:

ln -s /usr/local/share/asterisk /var/lib/asterisk