Home
Installing GEOIP-Databse
- Details
Installing GEOIP-Databse
wget http://archive.ubuntu.com/ubuntu/pool/main/g/geoip/geoip_1.4.6.dfsg.orig.tar.gz
tar -xzvf geoip_1.4.6.dfsg.orig.tar.gz
Installing FreeRadius on Ubuntu 9.10
- Details
Installing FreeRadius on Ubuntu 9.10
sudo -i
apt-get install freeradius
check installed
freeradius -X
OpenSips on Ubuntu 9.10
- Details
OpenSips 1.6.2 on Ubuntu 9.10
[Prereques]
sudo -i
apt-get install perl libdbi-perl libdbd-mysql-perl libdbd-pg-perl libfrontier-rpc-perl libterm-readline-gnu-perl libberkeleydb-perl
apt-get install dh-make-perl
dh-make-perl --build --cpan DBD-Whatever
cd /
cd usr/src
mkdir opensip
cd opensip
apt-get install gcc bison flex make openssl libmysqlclient-dev libradiusclient-ng2 libradiusclient-ng-dev mysql-server libxmlrpc-c3-dev
wget http://opensips.org/pub/opensips/1.6.2/src/opensips-1.6.2-tls_src.tar.gz
tar -xzvf opensips-1.6.2-tls_src.tar.gz
cd opensips-1.6.2-tls
[recompile with what modules you need - Just MySQL]
make prefix=/ all include_modules="db_mysql"
make prefix=/ install include_modules="db_mysql"
[MySQL radius server example]
make prefix=/ all include_modules="db_mysql aaa_radius"
make prefix=/ install include_modules="db_mysql aaa_radius"
[you shouldn't need to do this if you did the prereques]
apt-get install libdbi-perl libdbd-mysql-perl libfrontier-rpc-perl libterm-readline-gnu-perl
[Boot on startup]
cd /usr/src/opensip/opensips-1.6.2-tls/packaging/debian
cp opensips.default /etc/default/opensips
cp opensips.init /etc/init.d/opensips
update-rc.d opensips defaults 99
[version less 1.6.2 edit No fork]
if running version less then 1.6.2 you will need to edit out fork=no or add a #
nano /etc/opensips/opensips.cfg
#fork=no
[Set permission for daemon]
cd /etc/init.d
chmod 755 opensips
[Set Correct Path]
nano /etc/init.d/opensips
change:
DAEMON=/usr/sbin/opensips
to:
DAEMON=/sbin/opensips
[save]
restart the box verify the open sip starts up
sudo -i
opensips
[should see]
Listening on
udp: 127.0.0.1 [127.0.0.1]:5060
udp: 192.168.1.101 [192.168.1.101]:5060
tcp: 127.0.0.1 [127.0.0.1]:5060
tcp: 192.168.1.101 [192.168.1.101]:5060
Aliases:
tcp: localhost:5060
udp: localhost:5060
[change the password in the config file]
nano /etc/init.d/opensips
Asterisk / Free PBX Install
- Details
Install Ubuntu 8.04 Server w/ LAMP server & SSHd
Get the system all up to date
#aptitude upgrade
After that is finish with no errors reboot your system
I would not recommend installing zaptel or asterisk from apt. It will just cause problems.
Install Required Packages
# sudo aptitude install cvs build-essential automake autoconf bison flex libtool libncurses5-dev libssl-dev php5 php5-cli php5-curl php5-gd php5-mysql mysql-server php-pear php-db curl sox apache2 subversion libssl-dev libmysqlclient15-dev libcurl4-gnutls-dev
Compile & Installing Zaptel Modules
Next we want to prepare to build the zaptel modules to do we will need the following packages:
# uname -a
# sudo aptitude install linux-headers-$(uname -r)
# sudo ln -s /usr/src/linux-headers-$(uname -r) /usr/src/linux-2.6
margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px;"># cd /usr/src/
tom: 10px; margin-left: 0px; padding: 0px;"># sudo wget http://downloads.digium.com/pub/zaptel/zaptel-1.4-current.tar.gz
# sudo tar -zxvf zaptel-1.4-current.tar.gz
# cd zaptel-1.4.12.1
# ./configure
# make clean
# make
# sudo make install
# sudo make config
I am not going to go in depth into Zaptel module configuration since there is a ton of great sites out there.
Edit the following config files to your needs: configure /etc/zaptel.conf and /etc/asterisk/zapata.conf
voip-info zaptel config
# sudo /etc/init.d/zaptel start
# sudo update-rc.d zaptel defaults 20 80
Ways to test your Zaptel
# lspci
should have something like this: 02:0a.0 Ethernet controller: Digium, Inc. Unknown device 8005 (rev 11)
# cat /proc/zaptel/*
output similar to:
Span 1: WCTDM/0 “Wildcard TDM410P Board 1″ (MASTER)
IRQ misses: 1
1 WCTDM/0/0 FXSKS (In use)
2 WCTDM/0/1 FXSKS (In use)
3 WCTDM/0/2 FXSKS (In use)
4 WCTDM/0/3 FXSKS (In use)
Testing once Asterisk IS INSTALLED
Access Asterisk CLI
# sudo asterisk -r
In asterisk command line enter : zap show channels
xxx*CLI> zap show channels
output similar to:
Chan Extension Context Language MOH Interpret
pseudo from-pstn default
1 from-pstn default
2 from-pstn default
3 from-pstn default
4 from-pstn default
In asterisk command line enter : zap show status
xxx*CLI> zap show status
output similar to:
Description Alarms IRQ bpviol CRC4
Wildcard TDM410P Board 1 OK 1 0 0
If you have stuff like this showing up your card should be working
Setting Up & Compile Asterisk with Curl Support
# sudo groupadd asterisk
# sudo useradd -c "asterisk PBX" -d /var/lib/asterisk -g asterisk asterisk
# sudo mkdir /var/run/asterisk
# sudo chown asterisk:asterisk /var/run/asterisk/
# cd /usr/src/
# sudo wget http://downloads.digium.com/pub/asterisk/releases/asterisk-1.4.27.1.tar.gz
# sudo tar -zxvf asterisk-1.4.27.1.tar.gz
# cd asterisk-1.4.27.1
# make clean
# ./configure –with-curl
# make
# sudo make install
# sudo make samples
Download Astrisk Add-ons
# cd ..
# sudo wget http://downloads.digium.com/pub/asterisk/asterisk-addons-1.4.11.tar.gz
# sudo tar -zxvf asterisk-addons-1.4.11.tar.gz
# cd asterisk-addons-1.4.11
# sudo perl -p -i.bak -e "s/CFLAGS.*D_GNU_SOURCE/CFLAGS+=-D_GNU_SOURCE\nCFLAGS+=-DMYSQL_LOGUNIQUEID/" Makefile
# ./configure
# make clean
# make
# sudo make install
Download Astrisk Sounds
# cd ..
# sudo mkdir asterisk-sounds
# cd asterisk-sounds
# sudo wget http://downloads.digium.com/pub/telephony/sounds/asterisk-core-sounds-en-wav-current.tar.gz
# sudo wget http://downloads.digium.com/pub/telephony/sounds/asterisk-extra-sounds-en-wav-current.tar.gz
# sudo wget http://downloads.digium.com/pub/telephony/sounds/asterisk-moh-freeplay-wav.tar.gz
( if not found try these ones below )
# sudo wget http://downloads.digium.com/pub/telephony/sounds/asterisk-moh-opsound-alaw-current.tar.gz
# sudo tar -zxvf asterisk-core-sounds-en-wav-current.tar.gz
# sudo tar -zxvf asterisk-extra-sounds-en-wav-current.tar.gz
# sudo tar -zxvf asterisk-moh-freeplay-wav.tar.gz
# sudo tar -zxvf asterisk-moh-opsound-alaw-current.tar.gz
copy all sounds to the asterisk directory
# sudo cp -rf * /var/lib/asterisk/sounds/
create sim link for MOH (Music on Hold) directory for FreePBX
# sudo ln -s /var/lib/asterisk/moh /var/lib/asterisk/mohmp3
Fix asterisk dir permissions
# chown asterisk:asterisk /etc/asterisk -R
# chown asterisk:asterisk /var/lib/asterisk -R
# chown asterisk:asterisk /var/log/asterisk -R
# chown asterisk:asterisk /var/spool/asterisk/ -R
# nano /etc/asterisk/asterisk.conf
Change astrundir to: /var/run/asterisk
Setting up FreePBX
# cd /usr/src/
# sudo wget http://mirror.freepbx.org/freepbx-2.7.0.tar.gz
# sudo tar -zxvf freepbx-2.7.0.tar.gz
# cd freepbx-2.7.0
# sudo mysql_install_db
# mysqladmin u root password
# mysqladmin create asteriskcu rootdrdb -p
# mysqladmin create asterisk -p
mysql -uroot -pYourPassword
mysql> create database asterisk;
mysql> create database asteriskcdrdb;
mysql> exit;
# mysql –user=root –password=<chosen MySQL Password> asterisk < ./SQL/newinstall.sql
# mysql –user=root –password=<chosen MySQL Password>asteriskcdrdb < ./SQL/cdr_mysql_table.sql
Enter Mysql command prompt
# mysql –user root -p
# GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';
<enter>
# GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';
<enter>
# quit
<enter>
to test if you can access the db as asterisk do this:
mysql -uasteriskuser -pamp109
if you get the mysql> prompt your stuff will connect to the DB.. if you cant.. your lame.
Configure Apache for FreePBX
# sudo nano /etc/apache2/envvars
change : export APACHE_RUN_USER=www-data & export APACHE_RUN_GROUP=www-data
to: export APACHE_RUN_USER=asterisk & export APACHE_RUN_GROUP=asterisk
# sudo nano /etc/apache2/sites-enabled/000-default
change: AllowOveride None to AllowOverid All under both instances of /var/www
Configure PHP for FreePBX
# sudo nano /etc/php5/apache2/php.ini
change: upload_max_filesize to upload_max_filesize = 20M
# sudo nano /etc/php5/cli/php.ini
change: upload_max_filesize to upload_max_filesize = 20M
Set the php lib directory to be owned by asterisk so that it can make changes to the php.ini
# sudo chown asterisk:asterisk /var/lib/php5 -R
Set ownership of the /var/www directory to asterisk so it can write to files
# sudo chown asterisk:asterisk /var/www -R
Restart Apache
# sudo /etc/init.d/apache2 restart
In a web browser test http://<server-ip-addresss>/ if all is well you should get a page and your apache is installed and working properly
FreePBX install
# cd /usr/src/freepbx-2.7.0
bash fix for asterisk start script
# sudo ln -sf /bin/bash /bin/sh
# sudo ./start_asterisk start
# sudo ./install_amp
accept defaults on all questions except on:
Enter the path to use for your AMP web root: /var/www
IP address: <server-ip-addresss>
No point a web browser at http://<server-ip-addresss>/admin/ and click on the orange reload config banner at the top of the page
Astrisk Init Script
# sudo nano /etc/init.d/asterisk
paste the following
set -e PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DESC="Asterisk" NAME=amportal DAEMON=/usr/local/sbin/$NAME PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME test -x $DAEMON || exit 0 d_start() { amportal start } d_stop() { amportal stop } d_reload() { amportal restart } case "$1" in start) echo -n "Starting $DESC: $NAME" d_start echo "." ;; stop) echo -n "Stopping $DESC: $NAME" d_stop echo "." ;; restart|force-reload) echo -n "Restarting $DESC: $NAME" d_stop sleep 10 d_start echo "." ;; *) echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 exit 3 ;; esac exit 0 |
<save file>
# sudo chmod 755 /etc/init.d/asterisk
# sudo update-rc.d asterisk defaults 90 10
Activate FOP (Flash Operator Panel)
# sudo nano /etc/amportal.conf
change: FOPRUN=false to FOPRUN=true
*must restart asterisk to take effect in FreePBX
remove old astrisk configs
# sudo rm /etc/asterisk/*.0
Reboot your system and you should have a working Asterisk/FreePBX system up and running
Installing Other Goodies
TFTP server for phone updates and auto configurations
# sudo aptitude install tftpd-hpa tftp-hpa
# sudo nano /etc/default/tftpd-hpa
change: RUN_DAEMON to RUN_DAEMON=â€yesâ€
I make a link to /tftpboot just to make it a little more accessible
# sudo ln -s /var/lib/tftpboot /tftpboot
# sudo /etc/init.d/tftpd-hpa start
# sudo update-rc.d tftpd-hpa defaults
Now put all your firmware updates, phone configs in the /tfptboot directory. Also if your phones use DHCP don’t forget to set the TFTP server address to this server ip so the phones get it automatically assigned.
Changing Mysql Asterisk Username or Password
If you change any of the mysql login cridentials you must update these two files with the new asterisk username and/or password
/etc/asterisk/cdr_mysql.conf
/etc/amportal.conf
If you get a can't connect to manager issue try this:
iptables -A INPUT -p tcp -m tcp --dport 5038 -j ACCEPT
Also try this
Telnet server-ip 5038
Trying server-ip...
Connected to rdns-of-server-ip
Escape character is '^]'.
Asterisk Call Manager/1.0
Page 36 of 40