AurosBlog

Technical Blog

asterisk on Ec2 ubuntu

Install Pre-Requisites:

For compiling and installing:
apt-get install build-essential autoconf automake libtool flex bison libssl-devlibnewt-dev libncurses5-dev linux-headers-`uname -r` gcc

SOUNDS:

apt-get install sox curl subversion subversion-tools

MySQL
apt-get install mysql-client mysql-server libmysqlclient15-dev

LIBPRI:
wget ftp.digium.com/pub/libpri/releases/libpri-1.4.4.tar.gzmakemake install

Speex:
(Speex is an Open Source/Free Software patent-free audio compression format designed for speech.
The Speex Project aims to lower the barrier of entry for voice applications by providing a free alternative to expensive proprietary speech codecs.
Moreover, Speex is well-adapted to Internet applications and provides useful features that are not present in most other codecs.)

wget http://downloads.us.xiph.org/releases/speex/speex-1.2beta2.tar.gz./configure –prefix=/usr make make install

Asterisk:
wget ftp.digium.com/pub/asterisk/releases/asterisk-1.4.21.1.tar.gz

cd asterisk-1.4.13Edit the Makefile
(change the ASTVARRUNDIR= to /var/run/asterisk)

./configuremake
menuselct(selct gsm sounds frm extras and core sounds in gsm)
make installmake samples

Asterisk Addons:
wget ftp.digium.com/pub/asterisk/releases/asterisk-addons-1.4.7.tar.gz
cd asterisk-addons-1.4.4
./configure
make menuselect
make install

LINKS(to install it apt-get install links)go to
http://asterikast.com -> downloads -> download the g729 codecs from thereUNZIP it…
(apt-get install UNZIP)copy that codecs into /usr/lib/asterisk/module/

DELETE all the codecs and asterisk-addons folder frm /usr/src

groupadd asteriskuseradd -s /bin/false -g asterisk asterisk
wget http://asterikast.com/_downloads/_scripts/ownastcat
ownastchmod +x ownastcp ownast /usr/bin/ownast

safe_asterisk -U asterisk -G asterisk
(if you get “Bad fd number” try ln -sf /bin/bash /bin/sh)asterisk -rps

edit the sip.conf
[general]
context=default
allowguest=yes
disallow=all
allow=ulaw
nat=yes
dtmfmode=rfc2833
canreinvite=no

[100]
type=friend
context=default
disallow=all
allow=ulaw
allow=g729
host=dynamic
username=100
secret=100
canreinvite=no

Asterisk Installation Step By Step on Ubuntu

Install Pre-Requisites:
apt-get install build-essential autoconf automake libtool flex bison libssl-dev libnewt-dev libncurses5-dev linux-headers-`uname -r`
apt-get install sox curl subversion subversion-tools
apt-get install mysql-client mysql-server libmysqlclient15-dev
apt-get install php5 php5-cli php5-curl php5-gd php5-json(php5-common) php5-mcrypt php5-mhash php5-mysql php5-suhosin php5-xmlrpc php5-xsl php-pear
apt-get install apache2 apache2-mpm-prefork

Setup Accounts:
adduser –system –home /var/lib/asterisk –group asterisk
mkdir /var/run/asterisk
chown -R asterisk:asterisk /var/run/asterisk

Download Asterisk:

wget ftp.digium.com/pub/asterisk/releases/asterisk-1.4.21.1.tar.gz

wget ftp.digium.com/pub/asterisk/releases/asterisk-addons-1.4.7.tar.gz

wget ftp.digium.com/pub/libpri/releases/libpri-1.4.4.tar.gz


Uncompress Asterisk Sources:

tar xzvf asterisk-1.4.21.1.tar.gz

tar xzvf asterisk-addons-1.4.7.tar.gz

tar xzvf libpri-1.4.4.tar.gz

Compile Asterisk Sources:
cd asterisk-1.4.13 && ./configure && make install && make samples && cd -
cd asterisk-addons-1.4.4 && ./configure && make install && cd -
cd libpri-1.4.2 && make && make install && cd -


Setup MySQL:

mysql -u root –p (Enter your password to check if mysql is running properly or not)

mysqladmin -u root password ”
mysqladmin -p create asterisk create asteriskcdrdb
echo “GRANT ALL PRIVILEGES ON asterisk.* TO asterisk@localhost IDENTIFIED BY ”;” | mysql -u root –p
echo “GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asterisk@localhost IDENTIFIED BY ”;” | mysql -u root -p

Configure Asterisk Files:
(/etc/apache2/apache2.conf):
User asterisk
Group asterisk

(/etc/asterisk/asterisk.conf):
astrundir => /var/run/asterisk

(/etc/php5/apache2/php.ini):
post_max_size = 20M
upload_max_filesize = 20M

Install PEAR for PHP:
pear install db

Setup Asterisk:

edit /etc/init.d/skeleton

DAEMON=/usr/src/asterisk/asterisk

NAME=Asterisk

DESC=”Asterisk PBX”

save file as asterisk in /etc/init.d/

>
chmod +x /etc/init.d/asterisk
/etc/init.d/asterisk start
nano /etc/inittab
chown -R asterisk:asterisk /var/spool/asterisk/
chown -R asterisk:asterisk /var/log/asterisk/

Setup FreePBX:
svn co https://amportal.svn.sourceforge.net/svnroot/amportal/freepbx/branches/2.3/ /usr/src/freepbx
mysql -p asterisk < /usr/src/freepbx/SQL/newinstall.sql mysql -p asteriskcdrdb < /usr/src/freepbx/SQL/cdr_mysql_table.sql cd /usr/src/freepbx

>

./install_amp

Username to connect to the asterisk database

[asteriskuser]asterisk

Password to connect to the asterisk database

[amp109]

Hostname of Asterisk Database [localhost]

Username to connect to the Asterisk Manager Interface[admin]

Password to connect to the Asterisk Manager interface[amp111]

Path to use for your AMP web root[/var/www/html]

Ip address or hostname used to access the AMP web-admin [xx.xx.xx.xx]

Password to perform call transfer with the flash operator panel[passw0rd]

Use simple Extensions [extensions] admin or separate Devices and Users [devicesandusers]

Directory to store AMP executable scripts [/var/lib/asterisk/bin]

Directory to store super user scripts [/usr/local/sbin]

If it fails running or problem connecting to the database try

./install_amp –username=root –password=[password]

&& cd -

Update Ubuntu Startup Files:
update-rc.d zaptel defaults
update-rc.d asterisk defaults

Setup Zaptel if Required:
(/etc/zaptel.conf)
span=1,0,0,esf,b8zs
bchan=1-23
dchan=24

Load Zaptel Modules:
modprobe zaptel
modprobe wct1xxp
ztcfg -vv

Visit the Web Interface:
http://<localhost>/html/

|