Modules >> VoIP and PBX

Pages: 1 | 2 | 3 | 4 | 5 | >> (show all)
pmoore4321
newbie


Reged: 02/05/06
Posts: 48
Loc: Houston, Texas, U.S.A.
Asterisk / Freepbx CC 5.0 install script
      #116745 - 06/09/09 07:39 PM

1. Install CC 5.0
2. Register system via the CC "Setup Wizard" GUI
3. yum update and reboot the system
4. wget http://www.prestonmoore.com/images/ccfreepbx50.sh
5. nano ccfreepbx50.sh and change "passw0rd" and IP address
6. sh ccfreepbx50.sh
7. Finished

I have included Google Talk and the speex codec in the script, but you need
to uncomment those sections prior to execution.

Here are the details of the script:
Code:

#!/bin/bash
#
# This script to install the Zaptel drivers, Asterisk and FreePBX
# on a new install of ClarkConnet 5.0
#
# Must be run with superuser privileges.
#
# There is no error checking here, but it is known to work on a base
# install as of 01 Jun 2009, with downloaded versions:
# asterisk-1.4.25
# asterisk-addons-1.4.8
# freepbx-2.5.1
# libpri-1.4.10
# zaptel-1.4.12.1
#
# Sections of this script originally written for Ubuntu by Dr. Peter N. Steinmetz
#
# Preston Moore - www.prestonmoore.com

# definitions of items to possibly change
export IP_ADDRESS=192.168.1.1
export FREEPBX_VERSION=2.5.1
export MYSQL_ROOT_PW=passw0rd
export ASTERISK_DB_PW=passw0rd
export ASTERISK_MGR_PW=passw0rd
export ARI_PW=passw0rd

# install mysql server
yum -y install cc-mysql
/etc/init.d/mysqld start
chkconfig mysqld on

# configure mysql root password
mysqladmin -u root password ${MYSQL_ROOT_PW}

# install packages needed beyond base install
yum -y install kernel-devel
yum -y install make bison flex gcc-c++ gcc cc-httpd php
yum -y install php-cli php-mysql php-pear php-gd curl
yum -y install sox ncurses-devel openssl-devel mysql-devel

# install pear DB module
pear install db

# place source packages in standard place
cd /usr/src

## download, make and install XML library for Google Talk
#yum -y install gnutls-devel
#wget http://iksemel.googlecode.com/files/iksemel-1.3.tar.gz
#tar xfz iksemel-1.3.tar.gz
#cd iksemel-1.3
#./configure
#make
#make install
#cd ..

## download, make and install Speex codec
#yum -y install libogg-devel
#wget http://downloads.xiph.org/releases/speex/speex-1.2rc1.tar.gz
#tar xfz speex-1.2rc1.tar.gz
#cd speex-1.2rc1
#./configure
#make
#make install
#cd ..

# download, make, install, and configure zaptel drivers
wget http://downloads.digium.com/pub/zaptel/zaptel-1.4-current.tar.gz
tar xfz zaptel-1.4-current.tar.gz
cd `find . -name "zaptel-1.4.*" -print`
./configure
make
make install
make config
cd ..

# download, make and install libpri
wget http://downloads.digium.com/pub/libpri/libpri-1.4-current.tar.gz
tar xfvz libpri-1.4-current.tar.gz
cd `find . -name "libpri-1.4.*" -print`
make
make install
cd ..

# download, make and install asterisk and configuration files
wget http://downloads.digium.com/pub/asterisk/asterisk-1.4-current.tar.gz
tar xfvz asterisk-1.4-current.tar.gz
cd `find . -name "asterisk-1.4.*" -print`
./configure
make
make install
make samples
cd ..

# download, make and install asterisk-addons
wget http://downloads.digium.com/pub/asterisk/asterisk-addons-1.4-current.tar.gz
tar xfvz asterisk-addons-1.4-current.tar.gz
cd `find . -name "asterisk-addons-1.4.*" -print`
./configure
make
make install
cd ..

# download and install extra asterisk sounds
mkdir asterisk-sounds
cd asterisk-sounds
wget http://downloads.digium.com/pub/telephony/sounds/asterisk-extra-sounds-en-gsm-current.tar.gz
tar -zxf asterisk-extra-sounds-en-gsm-current.tar.gz
cp -rf * /var/lib/asterisk/sounds
cd ..

# create asterisk user and group for apache server
useradd -c "Asterisk PBX" -d /var/lib/asterisk asterisk

# fix up apache configuration to run as asterisk user
chown asterisk /var/lib/php/session/
cp -v /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.original
sed -i "s/User apache/User asterisk/" /etc/httpd/conf/httpd.conf
sed -i "s/Group apache/Group asterisk/" /etc/httpd/conf/httpd.conf

# add dummy timing device for asterisk
modprobe ztdummy

# download and unpack freepbx
wget http://superb-east.dl.sourceforge.net/sourceforge/amportal/freepbx-${FREEPBX_VERSION}.tar.gz
tar xfvz freepbx-${FREEPBX_VERSION}.tar.gz

# configure freepbx
cd freepbx-${FREEPBX_VERSION}

# setup databases for freepbx use
mysqladmin -u root -p${MYSQL_ROOT_PW} create asterisk
mysqladmin -u root -p${MYSQL_ROOT_PW} create asteriskcdrdb
mysql -u root -p${MYSQL_ROOT_PW} asterisk < SQL/newinstall.sql
mysql -u root -p${MYSQL_ROOT_PW} asteriskcdrdb < SQL/cdr_mysql_table.sql
mysql -u root -p${MYSQL_ROOT_PW} <<-END_PRIVS
GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY "${ASTERISK_DB_PW}";
GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY "${ASTERISK_DB_PW}";
flush privileges;
END_PRIVS

# reconfigure php for freepbx
cp -v /etc/php.ini /etc/php.ini-orig
sed -i "s/\(upload_max_filesize *= *\)\(.*\)/\120M/" /etc/php.ini
sed -i "s/\(memory_limit *= *\)\(.*\)/\1100M/" /etc/php.ini

# fix up directory use and permissions for asterisk
mkdir /var/run/asterisk
chown asterisk:asterisk -Rv /var/run/asterisk
chown asterisk:asterisk -Rv /etc/asterisk
chown asterisk:asterisk -Rv /var/lib/asterisk
chown asterisk:asterisk -Rv /dev/zap
chown asterisk:asterisk -Rv /var/log/asterisk
chown asterisk:asterisk -Rv /var/spool/asterisk
chown asterisk:asterisk -Rv /var/www/html
sed -i "s|astrundir *=> */var/run|astrundir => /var/run/asterisk|" /etc/asterisk/asterisk.conf

# configure amportal
cp -v amportal.conf /etc/amportal.conf
sed -i "s/# \(AMPDBUSER=asteriskuser\) */\1/" /etc/amportal.conf
sed -i "s/# \(AMPDBPASS=\).*/\1${ASTERISK_DB_PW}/" /etc/amportal.conf
sed -i "/#AMPWEBADDRESS=192.168.1.101/d" /etc/amportal.conf
sed -i "s/AMPWEBADDRESS=/AMPWEBADDRESS=${IP_ADDRESS}/" /etc/amportal.conf
sed -i "s/\(AMPMGRPASS=*\)\(.*\)/\1${ASTERISK_MGR_PW}/" /etc/amportal.conf
sed -i "s/\(secret *= *\)\(.*\)/\1${ASTERISK_MGR_PW}/" /etc/asterisk/manager.conf

# start asterisk
./start_asterisk start

# install freepbx
./install_amp

# start apache web server
/etc/init.d/httpd start
chkconfig httpd on

#
# Modify CC webconfig menu
echo "<?php" >> /var/webconfig/htdocs/admin/fop.php
echo "header( 'Location: http://${IP_ADDRESS}/panel' ) ;" >> /var/webconfig/htdocs/admin/fop.php
echo "?>" >> /var/webconfig/htdocs/admin/fop.php
echo "<?php" >> /var/webconfig/htdocs/admin/ari.php
echo "header( 'Location: http://${IP_ADDRESS}/recordings' ) ;" >> /var/webconfig/htdocs/admin/ari.php
echo "?>" >> /var/webconfig/htdocs/admin/ari.php
echo "<?php" >> /var/webconfig/htdocs/admin/freepbx.php
echo "header( 'Location: http://${IP_ADDRESS}/admin' ) ;" >> /var/webconfig/htdocs/admin/freepbx.php
echo "?>" >> /var/webconfig/htdocs/admin/freepbx.php

echo "Software|PBX System|Administration|freepbx.php" > /var/webconfig/htdocs/menus/10-extra-freepbx.en_US
echo "Software|PBX System|Operator Panel|fop.php" > /var/webconfig/htdocs/menus/10-extra-fop.en_US
echo "Software|PBX System|Recordings|ari.php" > /var/webconfig/htdocs/menus/10-extra-ari.en_US
chown -v webconfig:webconfig /var/webconfig/htdocs/menus/10-extra-freepbx.en_US
chown -v webconfig:webconfig /var/webconfig/htdocs/menus/10-extra-fop.en_US
chown -v webconfig:webconfig /var/webconfig/htdocs/menus/10-extra-ari.en_US

# set ARI admin password
sed -i "s/ari_password/${ARI_PW}/" /var/www/html/recordings/includes/main.conf.php

# moh fix
ln -s /var/lib/asterisk/moh /var/lib/asterisk/mohmp3
chown asterisk:asterisk /var/lib/asterisk/mohmp3

# asterisk logrotate
cat > /etc/logrotate.d/asterisk <<-END_ROTATE
/var/log/asterisk/*log {
missingok
rotate 5
weekly
create 0640 asterisk asterisk
postrotate
/usr/sbin/asterisk -rx 'logger reload' > /dev/null 2> /dev/null
endscript
}
/var/log/asterisk/full {
missingok
rotate 5
daily
create 0640 asterisk asterisk
postrotate
/usr/sbin/asterisk -rx 'logger reload' > /dev/null 2> /dev/null
endscript
}
/var/log/asterisk/cdr-csv/*csv {
missingok
rotate 5
monthly
create 0640 asterisk asterisk
}
END_ROTATE

# start amportal at boot
echo "/usr/sbin/amportal start" >> /etc/rc.local

# logo swap
cd /var/www/html/admin/images/
wget http://www.clarkconnect.com/images/logos/poweredbycc.png
sed -i "s|AMPADMINLOGO=logo.png|AMPADMINLOGO=poweredbycc.png|" /etc/amportal.conf

# start freepbx
/usr/sbin/amportal start



Enjoy!


Post Extras: Print Post   Remind Me!   Notify Moderator  
peterAdministrator
Carpal Tunnel
*****

Reged: 09/03/00
Posts: 3343
Loc: Toronto
Re: Asterisk / Freepbx CC 5.0 install script [Re: pmoore4321]
      #116802 - 06/11/09 03:48 PM

Very nice!

About a year ago, we put our Asterisk build aside (still sitting in our source code system / SVN). We have been spoiled with the iPlex solution here in the office, but maybe it is time to revive the Asterisk project for the community out there that wants it. Basically, the following have been packaged in RPM:

- asterisk
- asterisk-addons
- libpri
- zaptel

FreePBX was never packaged up. At the very least, we'll be able to make your script about 1/10 the size and you'll be able to avoid installing the developer tools. If you ore anyone else is willing to test the RPMs that we build, I'll revive Asterisk!

--------------------
Peter
ClarkConnect Project Leader


Post Extras: Print Post   Remind Me!   Notify Moderator  
Druber
Pooh-Bah
****

Reged: 02/10/06
Posts: 2050
Re: Asterisk / Freepbx CC 5.0 install script [Re: peter]
      #116803 - 06/11/09 03:50 PM

A further complication: in asterisk 1.6, they have replaced zap with dahdi, which is supposed to be backward compatible.

Post Extras: Print Post   Remind Me!   Notify Moderator  
pmoore4321
newbie


Reged: 02/05/06
Posts: 48
Loc: Houston, Texas, U.S.A.
Re: Asterisk / Freepbx CC 5.0 install script [Re: Druber]
      #116804 - 06/11/09 04:14 PM

I ran the script several times on a couple of computers and it worked fine. I would appreciate it if someone would try it and let me know if it works.

Also, any additions would be great.

I ripped most of the info from here:

https://wiki.ubuntu.com/AsteriskScriptOn...kFreePBX_1.2.sh

Is Asterisk 1.6 worth the upgrade from 1.4? I don't use any hardware cards, so I don't know much about the zaptel and dahdi.


Post Extras: Print Post   Remind Me!   Notify Moderator  
pmoore4321
newbie


Reged: 02/05/06
Posts: 48
Loc: Houston, Texas, U.S.A.
Re: Asterisk / Freepbx CC 5.0 install script [Re: pmoore4321]
      #116806 - 06/11/09 04:22 PM

One other thing. I am not good at "sed" and the following line is not exactly right:

sed -i "s/\(AMPMGRPASS=*\)\(.*\)/\1${ASTERISK_MGR_PW}/" /etc/amportal.conf

the result in amportal.conf is:

# AMPMGRPASSpassw0rd
AMPMGRPASS=passw0rd

You can see the extra "passw0rd" behind the comment. Does not really matter, but maybe someone could fix it.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Druber
Pooh-Bah
****

Reged: 02/10/06
Posts: 2050
Re: Asterisk / Freepbx CC 5.0 install script [Re: pmoore4321]
      #116807 - 06/11/09 04:23 PM

1.6 has some bells and whistles, but if 1.4 is working okay for you, it's not a big deal to stay on 1.4.

Post Extras: Print Post   Remind Me!   Notify Moderator  
Rajiv
journeyman


Reged: 01/15/07
Posts: 65
Re: Asterisk / Freepbx CC 5.0 install script [Re: Druber]
      #117117 - 06/24/09 06:27 AM

PLEASE PLEASE DO THE ASTERISK RPMS I PROMISE TO TEST THIS WEEK.

My wife is away with the kids so I have the time and inclination to test this. If my wife was here our system would be too vital to play with. I've been waiting for her to go on holiday with the kids for me to have the time to take down and re-do our box!

I have a TDM400 card with one FXS port ie analog trunk line. I run SIP to my phone extensions and then run IAX2 to 3 further trunks at my VOIP provider (2 inbound numbers + 1 outbound trunk).

I'll be running CC on a Intel Core2Duo box with G31/ICH7 chipset, and using the dreaded Realtek NIC + sundance 4 port NIC. I also use VLANs.

I hope to try and have another go at CC as Wireless Access Point using the relevant MadWiFi drivers.

I have a reasonable level of competence and have installed asterisk twice before on CC boxes with the help of people on the forum. I also managed to work through the network drivers issues myself as well.

I probably am in favour of going the DADHDI route rather than ZAP, although its a trifle hairy, but I'll at least identify the issues.

Again I am in favour of 1.4 based over 1.6 based.

Cheers

Rajiv


Post Extras: Print Post   Remind Me!   Notify Moderator  
peterAdministrator
Carpal Tunnel
*****

Reged: 09/03/00
Posts: 3343
Loc: Toronto
Re: Asterisk / Freepbx CC 5.0 install script [Re: Rajiv]
      #117133 - 06/24/09 01:42 PM

If they build cleanly, I'll let you know. If they don't build cleanly, it will have to wait until 5.0 is released.

--------------------
Peter
ClarkConnect Project Leader


Post Extras: Print Post   Remind Me!   Notify Moderator  
Rajiv
journeyman


Reged: 01/15/07
Posts: 65
Re: Asterisk / Freepbx CC 5.0 install script [Re: peter]
      #117138 - 06/24/09 02:42 PM

sounds fair to me.

one step I did do in building manually was ./configure the system. Do we need to agree the module list? I think I just took the defaults, but it would be good to know what you include. I think this particularly affects the channel modules, but druber and preston moore seem to be the experts

Cheers

Rajiv


Post Extras: Print Post   Remind Me!   Notify Moderator  
wrotruck
stranger


Reged: 07/15/04
Posts: 23
Re: Asterisk / Freepbx CC 5.0 install script [Re: Rajiv]
      #117352 - 07/02/09 07:51 AM

How did the testing go with the precompiled binaries?

W-


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1 | 2 | 3 | 4 | 5 | >> (show all)



Extra information
0 registered and 2 anonymous users are browsing this forum.

Moderator:  vercomtech, pointclark, VerComSupport, iplexippbx 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Topic views: 11335

Rate this topic

Jump to

Contact Us ClearFoundation

Powered by UBB.threads™ 6.5.5