Wednesday, March 6, 2013

Installing FREEPBX on UBUNTU 10.04(installation Script)


Free Pbx Installation Script

#!/bin/bash
#
#Install mysql
#run the script script by sudo su or with root privilege
sudo apt-get update
sudo apt-get install -y mysql-server
#
#installing the pre-dependencies
#
sudo apt-get install -y build-essential linux-headers-`uname -r` openssh-server bison flex apache2 php5 php5-curl php5-cli php5-mysql php-pear php-db php5-gd curl sox libncurses5-dev libssl-dev libmysqlclient15-dev mpg123 libxml2-dev
#
#Compile and install dahdi;
#
tar xvf dahdi-linux-complete-2.2.1+2.2.1.tar.gz
cd dahdi-linux-complete-2.2.1+2.2.1
make all && make install && make config
#
#libpri compilation and install:
#
cd ..
tar xvf libpri-1.4.10.2.tar.gz
cd libpri-1.4.10.2
make && make install
#
#installing the free pbx
#
cd ..
tar xvf asterisk-1.6.2.6.tar.gz
cd asterisk-1.6.2.6
./configure
make && make install

#
#As before lets install the sample files
#
make samples

#
#install sound in free pbx
#
cd /var/lib/astersik/sounds
wget -O - http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en-gsm-current.tar.gz | tar xvfz -

#
# We create the user "asterisk" and
#add the apache user to the "asterisk" group

cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf_orig
sed -i 's/^\(User\|Group\).*/\1 asterisk/' /etc/apache2/apache2.conf
#
#
#The start up script
cd /etc/init.d/
wget http://randystech.com/downloads/asterisk
chmod +x asterisk
update-rc.d asterisk defaults

#We are almost done. Now we are going to install FreePBX, the graphical interface that we will install
#to manage Asterisk

cd /usr/src/
wget -O - http://mirror.freepbx.org/freepbx-2.7.0.tar.gz | tar xvfz -
cd freepbx-2.7.0/

#
#Copy amportal.conf configuration file to /etc/:
#
cp amportal.conf /etc/

#set the database password here
#when you are running the shell script
# creating user astrick in mysql with password 4321
export ASTERISK_DB_PW=4321             
export MYSQL_ROOT_PW=1234                
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


#
#And slightly modify the settings in /etc/amportal.conf
#
sed -i "s/# \(AMPDBUSER=.*\)/\1/" /etc/amportal.conf
sed -i "s/# \(AMPDBPASS=\).*/\1${ASTERISK_DB_PW}/" /etc/amportal.conf
sed -i "s@\(AMPWEBROOT=\).*@\1/var/www/@"  /etc/amportal.conf
sed -i "s@\(FOPWEBROOT=\).*@\1/var/www/panel@" /etc/amportal.conf
sed -i "s@\(FOPWEBADDRESS=\).*@PUTIPADDRESS@" /etc/amportal.conf

#
#Adjust some PHP.ini settings related to the use of memory
#
sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php5/apache2/php.ini

#
#Change the permissions of a series of directories:
#
chown asterisk. /var/run/asterisk
chown -R asterisk. /etc/asterisk
chown -R asterisk. /var/{lib,log,spool}/asterisk
chown -R www-data.asterick /var/www/

#
#We enable the asterisk configuration as it is indicated in /etc/asterisk/asterisk.conf by removing the
#trailing characters in the first line:
#
sed -i '1 s/\(\[directories\]\).*/\1/' /etc/asterisk/asterisk.conf

#
# now install the free pbx
#

./start_asterisk start
./install_amp
#restart the apache and dahdi
#
/etc/init.d/apache2 restart
/etc/init.d/dahdi restart

#
#create a link
ln -s /var/lib/asterisk/moh /var/lib/asterisk/mohmp3
amportal start

Remote Installation Services over Linux

In this Post I will Explain step by Step How we can have networking boot-able Linux.In very Few Steps I will Explain it for UBUNTU 11.04 Desktop and server booting from the same server we can have many Linux boot from the same server

Required Softwares:

DHCP server
NFS server
TFTP-HDA server

Command to install the all required software on ubuntu i am installing on the ubuntu 10.04 server edition I have also installed the webmin

1.) sudo apt-get install tftpd-hpa dhcp3-server nfs-kernel-server syslinux

make a directory

sudo mkdir /srv
sudo mkdir /srv/tftpboot
then edit the tftp-hpa file

2.) sudo vi /etc/default/tftpd-hpa


and add the following lines in that

 #

#These are the all the configuration of TFTP boot server(trivial file transfer protocol)

#

TFTP_USERNAME="tftp"

TFTP_DIRECTORY="/srv/tftpboot"

TFTP_ADDRESS="<IP.OF.YOUR.SERVER>:69"

TFTP_OPTIONS="--secure -l"


3.) Configure the /etc/dhcp3/dhcpd.conf file like so:

sudo vi /etc/dhcp3/dhcpd.conf

#And add the following file to the dhcp.conf you can also do this using webmin

#

allow booting;
allow bootp;
group
{
    next-server IP.OF.YOUR.SERVER;
    filename     "/pxelinux.0";
    host laptop
    {
            hardware ethernet    mac:address:of:device;
            option host-name     "laptop";
    }
}


4.) Create the Ubuntu PXE Environment(s):

sudo mkdir -p /srv/tftpboot/pxelinux.cfg

sudo mkdir /srv/tftpboot/OS1

sudo mkdir /srv/tftpboot/OS2



5.) Loop mount the ISOs into place:

sudo mount -o loop /path/to/OS1.iso /srv/tftpboot/OS1

sudo mount -o loop /path/to/OS2.iso /srv/tftpboot/OS2


6.) Create a nice message screen that will be displayed upon PXE boot:

sudo vi /srv/tftpboot/message

:: Ubuntu PXE Environment ::
============================
OPTIONS:           DESCRIPTIONS:
OS1 (Default) == OS1  
OS2       == OS2  
----------------------------------------------------
Type the option, and hit enter:





7.) Create the default pxelinux config file:

sudo vi /srv/tftpboot/pxelinux.cfg/default

DISPLAY message
DEFAULT OS1
PROMPT 1
TIMEOUT 0
LABEL OS1
    kernel 11.04x86desktop/casper/vmlinuz
    append root=/dev/nfs boot=casper netboot=nfs nfsroot=IP.OF.YOUR.SERVER:/srv/tftpboot/11.04x86desktop initrd=11.04x86desktop/casper/initrd.lz --
LABEL OS2
    kernel 11.04x64desktop/casper/vmlinuz
    append root=/dev/nfs boot=casper netboot=nfs nfsroot=IP.OF.YOUR.SERVER:/srv/tftpboot/11.04x64desktop initrd=11.04x64desktop/casper/initrd.lz --

8.) Copy the pxelinux.0 file into place:

sudo cp /usr/lib/syslinux/pxelinux.0 /srv/tftpboot/


9.) Configure the NFS server like so:

sudo vi /etc/exports

/srv/tftpboot/OS1  *(ro,sync,no_root_squash,no_subtree_check)
/srv/tftpboot/OS2  *(ro,sync,no_root_squash,no_subtree_check)

10.) Start all the appropriate services:

sudo exportfs -va
sudo service tftpd-hpa start
sudo service dhcp3-server start
sudo service nfs-kernel-server start



11.) Go boot the laptop, and you should be presented with the "

:: Ubuntu PXE Environment ::" menu.
Enjoy!

Sunday, February 24, 2013

Creating Free VOIP EXCHANGE part 2

 After the install login from web with
UserName: wwwadmin
Password:password
Then

 Settings>Asterisk SIP settings>NAT settings. Click "Auto Configure" It will fill out the IP addresses. If you reboot, localnet address may change. You may use "10.0.0.0/8" instead. Whenever you make a change, scroll down and click submit. Then "Apply Config" red button will appear at the top. Click it occasionally to reload newly submitted configurations.

2.2. Settings>Asterisk SIP settings>Audio codecs. Select the codecs and reorder. Personally, I use G722, G729 and ulaw.

2.3. Applications>Extensions. Add new SIP extensions. User extension and the secret are the username and the password you will use in your sip client to register with PIAF. Select nat=yes.

2.4. Other>Google Voice. Fill out your GV information. Asterisk must be restarted to take it into effect. In Web GUI, Admin>Asterisk CLI, execute "core restart gracefully" Once restarted, you can start making outbound GV calls from a registered phone. 

2.5. Connectivity>Inbound routes. Add your GV number as DID number. Scroll down and set destination as your extension you created in #2.3. You should now be able to answer incoming calls, if GV forwards to gchat.

Again for Installing codecs (from command line)

install-codecs

Post Your comment 

In the Next part i will explain about the peering of two sip trunk and Iax2 trunk

Sunday, February 3, 2013

Creating Free VOIP EXCHANGE part 1


Download the VOIP Exchange from (PBX in Flash purple edition) and download the virtualbox or and install the virtual box on your system and import the virtual box

You will get the vitual box  from the following link

 https://www.virtualbox.org/wiki/Downloads
http://download.virtualbox.org/virtualbox/4.2.6/VirtualBox-4.2.6-82870-Win.exe (for windows)
http://sourceforge.net/projects/pbxinaflash/files/PIAF-2.0.6.3.1-CentOS-6.3-64bit/pbxinaflash20631-x86_64.iso/download


login to the pbxin flash os terminal as

USERNAME:  root
PASSWORD: password

use passwd to change the password

change the password the GUI using the  command
password-master

Then fire the
yum update
install-emp
Update the PBX using
update-program
update-fixes

reboot your virtual server and then you are ready to go.In the browser  Ip-Address of the virtual  and we will find the same as in the figure.in the next part of this i will tell tou about the configuration if PBX


Thursday, January 17, 2013

installing many openerps on same machine(openerp mass hosting)

install the the openerp on ubuntu server using following commands.
we can also build from the source but its more easy to have using deb (binary) package.and install webmin (its a project on source forge) too for more convenience .


copy the openerp file

sudo su
cp -a /etc/init.d/openerp /etc/init.d/openerp-new

now in file openerp-new do the following 3 changes


NAME=openerp-server-new
DESC=openerp-server-new
CONFIG=/etc/openerp/openerp-server-new.conf

then copy the openerp-server.conf file to openerp-server_new.conf


cp -a /etc/openerp/openerp-server.conf /etc/openerp-server-new


add the 1 line in that file
xmlrpc_port = 8080 # port no on which openerp listen

db-user=openerp-new

Using webmin or by command line create a user call openerp-new 
 or
sudo su - postgres
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt openerp-new
 
 
/etc/init.d/openerp-new restart and we are ready to go

http://ip-address:8080
http://ip-address:8069