Installing The Asterisk PBX And The Asterisk Web-Based Provisioning GUI On Linux

Want to support HowtoForge? Become a subscriber!
 
Submitted by npereira (Contact Author) (Forums) on Mon, 2007-09-24 12:22. :: Linux

Installing The Asterisk PBX And The Asterisk Web-Based Provisioning GUI On Linux

I have read about Asterisk and wanted to test it out as I will be managing/troubleshooting it at work anytime soon, so I thought of getting my hands dirty and getting some basic experience on it. First, I set up a box with Linux RedHat ES4 but I think any Linux distro would do. Kubuntu/Ubuntu, Fedora or Mandriva would work fine.

Here we go:

1) Get linux installed and mark down the IP address of the box.

2) su to root, then download the current tar files from http://downloads.digium.com/pub to /usr/src:

  • Asterisk to /asterisk
  • Zaptel to /zaptel
  • Libpri to /libpri
  • asterisk-addons to /asterisk-addons

3) Follow the commands bellow to untar each package in /usr/src (in this example I'm using versions that were up-to-date, change the version numbers to what ever versions you downloaded):

tar -zxvf asterisk-1.4.4.tar.gz
ln -s asterisk-1.4.4 asterisk
tar -zxvf zaptel-1.4.2.1.tar.gz
ln -s zaptel-1.4.2.1 zaptel
tar -zxvf libpri-1.4.0.tar.gz
mv libpri-1.4.0 libpri
tar -zxvf asterisk-addons-1.4.1.tar.gz
mv asterisk-addons-1.4.1 asterisk-addons

4) Start installing the different packages by following theses commands, again, as root:

Should be run before building Asterisk (NOTE: You may need to reboot if you see errors about missing kernel sources.):

cd /usr/src/zaptel
./configure
make menuselect (make sure your terminal window is set for at least 80x21 or the menu select command will give you an error)
make install
make config

Optional (I still did it either way): If you have Zaptel digital cards:

cd ../libpri
make clean
make install

Must be installed after zaptel and (if you need it) libpri (I did this also):

cd ../asterisk
./configure  
make menuselect # for extra configuration
make
make install
make samples
make config

Optional. Should be run after installing Asterisk:

cd ../asterisk-addons
./configure
make
make install

5) Now's a good time to go ahead and backup some files. Backup both sip.conf and extensions.conf which are located in the /etc/asterisk folder by doing theses commands:

cd /etc/asterisk
cp sip.conf sip.backup
cp extensions.conf extensions.backup

6) Now that everything is installed (unless you got errors, if so, go to linuxforums.org and post messages there with your issues [BEST LINUX FORUM EVER !]), now's the time to start Asterisk for the first time by entenring this command:

cd /usr/sbin
asterisk -vvvvgc (this will start in debug mode which is good to find out about errors)

7) There are several extensions already preconfigured in the basic install, and here they are:

  • extension : 1000 (first one to try !) 
  • extension : 1234 (is a extension. call vmail and enter this as the extention and password 4242)
  • extension : 1235 (dial this and leave a message to yourself)
  • extension : 1236 (another extension)
  • Main Vmail : 8500
  • External test for SIP call : 500
  • echo test : 600

So make calls to these using an SIP phone like X-Lite or an SIP enabled desk phone like the Mitel 5212/5224. To make a call, you type the extension # followed by the @ sign and the IP address of the box running the Asterisk software. Make sure the firewall is disabled or set up to allow port 5060 inbound/outbound.

CONGRATULATIONS!   You did it!

 

Asterisk Manager

There also exists an Asterisk manager. To enable this, you need to edit the /etc/asterisk/manager.conf and uncomment the four lines below by removing the ; on:

;[mark] (this is the username to use in the astman)
;secret = mysecret (this is the password to use in astman)
;read = system,call,log,verbose,command,agent,user,config
;write = system,call.log,verbose,command,agent,user,config

so it would look like :

[mark] (this is the username to use in the astman)
secret = mysecret (this is the password to use in astman)
read = system,call,log,verbose,command,agent,user,config
write = system,call.log,verbose,command,agent,user,config 

Save the file.

You will also need to restart Asterisk. To do this, from the CLI prompt, type

restart

now.

Once restarted, on the CLI prompt of Asterisk, you can type manager show users which will tell you what manager users are configured, hence ours is mark with password mysecret.

Now bring up a new terminal window, su to root, then type:

/usr/sbin/astman localhost

username = mark
password = mysercet

Make a call to 1000 and you will see your call there.

You can also use the web version called AJAM:

 

Aynchronous Javascript Asterisk Manager (AJAM)

AJAM is a new technology available in Asterisk 1.4 which allows web browsers or other HTTP enabled applications and web pages to directly access the Asterisk Manager Interface (AMI) via HTTP. Setting up your server to process AJAM involves a few steps:

Set up the Asterisk HTTP server:

1) Uncomment the line enabled=yes in /etc/asterisk/http.conf to enable Asterisk's built-in micro HTTP server.

2) If you want Asterisk to actually deliver simple HTML pages, CSS, JavaScript, etc. you should uncomment enablestatic=yes

3) Adjust your bindaddr and bindport settings as appropriate for your desired accessibility or leave them as default.

4) Adjust your prefix if appropriate, which must be the beginning of any URI on the server to match. The default is asterisk and the rest of these instructions assume that value.

Allow Manager Access via HTTP

1) Make sure you have both enabled = yes and webenabled = yes set up in /etc/asterisk/manager.conf.

2) You may also use httptimeout to set a default timeout for HTTP connections.

3) Make sure you have a manager username/secret.

Once these configuration changes are complete you can reload or restart Asterisk and you should be able to point your web browser to specific URI's which will allow you to access various web functions. A complete list can be found by typing show http at the Asterisk CLI.

Examples:

http://localhost:8088/asterisk/manager?action=login&username=mark&secret=mysecret

This logs you into the manager interface's "HTML" view. Once you're logged in, Asterisk stores a cookie on your browser (valid for the length of httptimeout) which is used to connect to the same session.

http://localhost:8088/asterisk/rawman?action=status

Assuming you've already logged into manager, this URI will give you a "raw" manager output for the "status" command.

http://localhost:8088/asterisk/mxml?action=status

This will give you the same status view but represented as AJAX data, theoretically compatible with RICO (http://www.openrico.org).

http://localhost:8088/asterisk/static/ajamdemo.html

If you have enabled static content support and have done a make install, Asterisk will serve up a demo page which presents a live, but very basic, "astman" like interface. You can login with your username/secret for manager and have a basic view of channels as well as transfer and hangup calls. It's only tested in Firefox, but could probably be made to run in other browsers as well.

A sample library (astman.js) is included to help ease the creation of manager HTML interfaces.

Note that for the demo, there is no need for *any* external web server.


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Thomas Simon (registered user) on Fri, 2011-04-01 07:45.
Let me suggest for Asterisk users a new software invention which maches perfectly to Asterisk.
The name of the software: Ozeki Webphone. I have experienced they compose an excellent IT system; they compose a perfect VoIP technology system. You can check the solution
here: http://www.ozekiphone.com/index.php?owpn=110
Share your opinion!
Submitted by x81kilo (not registered) on Tue, 2010-12-14 21:40.

n00b here:

 what other hardware is needed? can you recommend some place on the net to get it cheap?

 how to dial out to talk to my mom in florida from california? i have old sip equipment when i had vonage, and other voip providers, can i use that hardware?

 

many thanks!
//x81kilo

 

Submitted by bmrodrigues (registered user) on Wed, 2009-07-08 16:01.

Hi,

 When I run the ./configure on /usr/src/asterisk it finishes with "configure: error: *** termcap support not found" and then I get stuck.... meaning when I try to run "make menuselect" says to run ./configure before running make. I get that but I don't get how to overpass the ./confgure error.

Any help welcome.

 BR

Submitted by korovamilk (registered user) on Thu, 2007-09-27 15:17.

" 4) Start installing the different packages by following theses commands, again, as root:

Should be run before building Asterisk (NOTE: You may need to reboot if you see errors about missing kernel sources. "

 Maybe this can help someone:

yum install kernel-devel

will do the dirty job of installing kernel sources on red-hat-like systems (CentOS,Fedora..)

 

Submitted by Anonymous (not registered) on Fri, 2009-12-18 16:55.

hi all

i am new to  Asterisk  can anyone help to find good and compatable anolog phone cards for  Asterisk

-nrao