AsteriskTesting

Revision 5 as of 2007-01-29 05:24:47

Clear message

THIS IS DRAFT DOCUMENT

As such most of the information IS INCOMPLETE AND MAY LEAD TO A NON-WORKING SYSTEM. It is being written as I try the installation procedure and information I find elsewhere. -- FabiánRodríguez DateTime(2007-01-29T14:42:58Z)

Introduction

This is intended to provide a quick reference to How-Tos, documentation and other information relating to installing Asterisk on Ubuntu Dapper (LTS, 6.06.1). It focuses on this version even though Edgy is out, for stability and support reasons.

From the Ubuntu Dapper [http://packages.ubuntu.com/dapper/comm/asterisk asterisk package] page: Asterisk is an Open Source PBX and telephony toolkit. It is, in a sense, middleware between Internet and telephony channels on the bottom, and Internet and telephony applications at the top.

Asterisk can be used with Voice over IP (SIP, H.323, IAX) standards, or the Public Switched Telephone Network (PSTN) through Supported Hardware.

Asterisk + FreePBX on Ubuntu 6.06.1 LTS

These instructions are for installing Asterisk along with FreepBX, a web administration interface for Asterisk. IMPORTANT: using FreePBX may introduce security risks as it changes important settings in Apache's web server configuration, and requires file permissions that may make possible unauthorized execution of commands on your server. See this [[http://lists.alioth.debian.org/pipermail/pkg-voip-maintainers/2006-March/004228.html Discussion] on the pkg-voip maintainers mailing list.

Initial server install

  1. Using the Alternate install CD, install a "server" version of Ubuntu
  2. Login to the server
  3. Enable the Universe repository (using [https://help.ubuntu.com/community/Repositories/CommandLine command line] or the [https://help.ubuntu.com/community/Repositories/Ubuntu#head-5bbef89639d9a7d93fe38f6356dc17847d373096 graphical interface]).

  4. Update the packages list and upgrade your system: {{{$ sudo apt-get update

[...] $ sudo apt-get upgrade [...]}}}

Preparation for Asterisk install

Making sure you have remote access

You may want to install an SSH server to easily access the server from other computers on you local network. OpenSSH fits this task well and can be installed simply using apt-get install ssh. This will install OpenSSH server and generate the appropriate keys for remote access.

Setting up a static or dynamic DHCP address

Most configuration of hardware or software that will be interacting with your server will require its IP address information. It's highly unlikely you would want this IP address to change often. You should either setup a static IP address within your LAN for the server or configure your networking equipment (like a router) to assign the same IP address based on MAC address of the server's network interface.

Basic Asterisk install

  1. Install the Asterisk package: {{{$ sudo apt-get install asterisk

}}}

  1. Start asterisk by issuing this command: {{{ $ sudo /etc/init.d/asterisk start

}}}

  1. Change the /etc/default/asterisk file so the RUNASTERISK option is set to yes. This will make the Asterisk services start automatically upon starting your server.

FreePBX installation

Apache 2 installation

FreePBX requires Apache 2, as it is a web configuration interface for Asterisk.

  • Install the Apache 2 package: {{{$ sudo apt-get install apache2

}}}

Unfortunately, issues in Asterisk 1.2 require us to run the web server process as the same user as asterisk. In this situation, it's easier for us to run httpd as 'asterisk', rather than asterisk as 'httpd', as there's far less configuration that needs to be done. {{{ $ chown asterisk /var/lib/php4 }}}

Using nano (or your favourite editor, but nano is fine), you need to change User apache and Group apache to User asterisk and Group asterisk.{{{ [root@server ~]# nano +101 /etc/apache2/apache2.conf (Push Control-X to save when you've finished) }}}

You also want to change AllowOverride None to AllowOverride All {{{ [root@server ~]# nano +132 /etc/apache2/apache2.conf (Push Control-X to save when you've finished) }}}

And then restart apache2 to re-load its configuration.{{{ root@server:~# /etc/init.d/apache2 restart }}}

Set up MySQL for use by FreePBX

Before you can do anything to MySQL, you need to make sure it's running: {{{root@server:~# /etc/init.d/mysql start Starting MySQL database server: mysqld. root@server:~#}}}

Now, to configure the databases for FreePBX: {{{ root@server:/usr/src/freepbx# mysqladmin create asterisk root@server:/usr/src/freepbx# mysqladmin create asteriskcdrdb root@server:/usr/src/freepbx# mysql asterisk < SQL/newinstall.sql root@server:/usr/src/freepbx# mysql asteriskcdrdb < SQL/cdr_mysql_table.sql }}}

They also need to be secured, so that not just anyone can access them. freePBX will prompt you for a database password when you do the install. You need to pick that now. We'll assume that you've picked 'asteriskuser' and 'amp109' - you probably shouldn't use these, as they are well known passwords for Asterisk@Home builds. If anyone's trying to attack your machine, they will try this. {{{root@server:/usr/src/freepbx# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 12 to server version: 5.0.22-Debian_0ubuntu6.06.2-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY 'amp109'; (This is the first username and password asked for below) Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY 'amp109'; Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)

mysql> \q Bye root@server:/usr/src/freepbx# }}}

Now, after all of this, you need to pick a root 'mysql' password. For this, we'll pretend it's 's33kret'. If you need to do anything else with mysql, you'll need to provide this password. root@server:/usr/src/freepbx# mysqladmin -u root password 's33kret'

FreePBX source code download

As of october 2006, FreePBX has not been packaged yet for inclusion in Debian / Ubuntu via the standard repositories. See this [http://lists.alioth.debian.org/pipermail/pkg-voip-maintainers/2006-March/004228.html discussion] for more information. As such, FreePBX needs to be downloaded and compiled directly from FreePBX's site.

To download FreePBX's source code, you will need to have a Subversion client install. Subversion is a version control system which allows many individuals (who may be distributed geographically) to collaborate on a set of files (typically source code). In Ubuntu the subversion package includes the Subversion client (svn), tools for creating a Subversion repository and tools to make a repository available over the network using a program like ssh.

  • Install the svn package: {{{$ sudo apt-get install svn

}}}

Now, you must go to the /usr/src directory and get the source to freepbx using svn: {{{root@server:/home/user:# cd /usr/src/ root@server:/usr/src# svn co https://svn.sourceforge.net/svnroot/amportal/freepbx/branches/2.1 freepbx A freepbx/amp_conf A freepbx/amp_conf/astetc [... freePBX now downloads ...] Checked out revision 2574. root@server:/usr/src# cd freepbx/ }}}

References