Bend Source is the Best place in Oregon for weekly updates. : OpenBSDAsteriskFreePBX

HomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register

Purpose

The purpose of this page is to give you instructions on how to setup a PBX system using OpenBSD v4.6, Asterisk v1.4, and FreePBX v2.6.

Goal

To build a server that has SIP trunking back to the telco and allows the use of IP phones internally to your office/home.

Hardware

CPU: Intel Core2 Duo CPU E8400 @ 3.00GHz
RAM: 2GB DDR2 SDRAM ECC PC2-6400CL5
Raid card: Areca, ARC-1210 (4-port SATA II) F/W 1.47
Hard drives: A RAID 1 setup with a set of 1TB Seagate SATA II HD's with a signal hot spare

Software

OpenBSD operating system. I will be using 4.6 Stable
Asterisk PBX software. I will be using the package version available to OpenBSD 4.6 which is v1.4.25.1p0.
FreePBX GUI configuration tool for Asterisk PBX software. This I will be v2.6.0final

Step 1 - Assemble Hardware

Done!

Step 2 - Install OS

Check out this page for detailed instructions on how to install the OS

The following is the partition layout that I chose.
# disklabel -h sd0
#                size           offset  fstype [fsize bsize  cpg]
  a:             2.0G              480  4.2BSD   2048 16384    1 # /
  b:             6.0G          4210560    swap
  c:           931.3G                0  unused
  d:             6.0G         16809600  4.2BSD   2048 16384    1 # /tmp/
  e:             8.0G         29408640  4.2BSD   2048 16384    1 # /var
  f:             2.0G         46218240  4.2BSD   2048 16384    1 # /var/log
  g:            16.0G         50428800  4.2BSD   2048 16384    1 # /usr
  h:             8.0G         84015360  4.2BSD   2048 16384    1 # /home
  i:           800.0G        100824960  4.2BSD   2048 16384    1 # /asterisk


Edit your profile file found here: /root/.profile Add the following lines to the end of it.
# vi /root/.profile

# Set package path for package installation purposes
PKG_PATH=ftp://mirror.planetunix.net/pub/OpenBSD/4.6/packages/i386
export PKG_PATH

# OpenBSD emacs type editor
alias mg="mg -n"


Step 3 - Install additional packages

* I like to see what the package manager is doing when it installs packages. If you do not want to see the details take the -v off the following commands.
I like to use the utility wget so I install the package for wget
# pkg_add -vi wget
I like to have screen also
# pkg_add -vi screen-4.0.3p1

For all of the following packages you will need to be sure to complete the instructions for each related package that you install.

Install Asterisk
# pkg_add -vi asterisk-1.4.25.1p0
# pkg_add -vi asterisk-native-sounds
# pkg_add -vi asterisk-sounds
# pkg_add -vi asterisk-openbsd-moh

Install MySQL Server
# pkg_add -vi mysql-server

Install PHP extension w/PEAR
# pkg_add -vi php5-core
# pkg_add -vi php5-mysql
# pkg_add -vi pear
# pkg_add -vi pear-DB

You can do them all at once here
# pkg_add -iv asterisk-1.4.25.1p0 asterisk-native-sounds asterisk-sounds asterisk-openbsd-moh mysql-server php5-core php5-mysql pear pear-DB wget screen-4.0.3p1

After all this, you should end up with a package list something like the following
# pkg_info
asterisk-1.4.25.1p0 open source multi-protocol PBX and telephony toolkit
asterisk-native-sounds-1.2p0 'native' (better) sound files for Asterisk open source PBX
asterisk-sounds-1.2.1p3 extra sound files for Asterisk open source PBX
gettext-0.17p0      GNU gettext
gsm-1.0.13          u-law to gsm encoding audio converter and library
libiconv-1.13       character set conversion library
libxml-2.6.32p2     XML parsing library
mysql-client-5.0.83 multithreaded SQL database (client)
mysql-server-5.0.83 multithreaded SQL database (server)
p5-DBD-mysql-4.010  MySQL drivers for the Perl DBI
p5-DBI-1.607        unified perl interface for database access
p5-Net-Daemon-0.43  extension for portable daemons
p5-PlRPC-0.2018p0   module for writing rpc servers and clients
pear-1.7.2          base classes for common PHP tasks
pear-DB-1.7.6p0     database abstraction layer for PHP
pear-utils-1.7.2    utilities for managing pear extensions
php5-core-5.2.10    server-side HTML-embedded scripting language
php5-mysql-5.2.10   mysql database access extensions for php5
popt-1.7p0          getopt(3)-like library with a number of enhancements
screen-4.0.3p1      multi-screen window manager
wget-1.11.4         retrieve files from the web via HTTP, HTTPS and FTP


You will notice a few things in the list that were installed because they were dependencies

Their are now a few things that must be done to start the process of making this thing work right.
  1. You need to change the user and group that Apache runs as. The default user is www and www. You need to change this to _asterisk and _asterisk.
  2. In PHP you need to turn on the 'allow_url_fopen' setting in the php.ini file. (allow_url_fopen = On)
When changes are completed, restart Apache.

Step 3: Get the source file for freepbx


Install FreePBX
cd /usr/src/
wget http://mirror.freepbx.org/freepbx-2.6.0.tar.gz
tar zxpf freepbx-2.6.0.tar.gz
wget ftp://ftp.cmsws.com/patches/freepbx/freepbx-2.6.0-0.0.1.sh
ksh ./freepbx-2.6.0-0.0.1.sh
cd freepbx-2.6.0/
mysqladmin create asteriskcdrdb -p
mysql -u root -p asteriskcdrdb < SQL/cdr_mysql_table.sql
mysqladmin create asterisk -p
mysql -u root -p asterisk < SQL/newinstall.sql
mysql -u root -p
 GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';
 GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';
 FLUSH PRIVILEGES;
quit
./install_amp


POST INSTALL

After the install is complete. All you need to do is browse to the IP address of the machine that you used in the ./install_amp script.
Something like http://192.168.1.100/amp/ And then you should be able to get to it the main interface from there.

Uninstall freepbx

rm /etc/amportal.conf
rm -r /var/lib/asterisk
rm -r /var/www/htdocs/amp/
rm /root/.asterisk_history
rm -r /var/www/htdocs/recordings/
mysqladmin drop asteriskcdrdb -p
mysqladmin drop asterisk -p


Bits a pieces that will play a role later on in this Tutorial


default in-bound context settings

type=peer
host=<SIP_HOST_IP>
username=5411234567
secret=<secret>
fromuser=5411234567
fromdomain=<my-external-ip-address>
canreinvite=no
insecure=very
quality=yes
nat=yes
context=ext-did


A little ascii art for you: (replace the tabs with 4 spaces)

	                           ____  ____ __    __
	                          |  _ \|  _ \\ \  / /
	      _____ ___  ___  ___ | |_) | |_) |\ \/ /
	     / ___// _ \/ _ \/ _ \|  __/|  _ <  >  <
	    / /__ / / \/  __/  __/| |   | |_) |/ /\ \
	   / ___//_/   \___/\___/ |_|   |____//_/  \_\
	  / / 
	 /_/

There are 69 comments on this page. [Display comments]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.2
Page was generated in 0.1720 seconds