How to install Elastix on a VPS with loop devices (eg XEN,KVM)

Written by admin on January 12, 2015. Posted in Elastix

This procedure is based on a Xen VPS with loop devices enabled but can be followed also on a KVM installation of Centos 5.

What will be installed?

Elastix -2.4.0 with..

Freepbx 2.8

Asterisk 1.8

A2Billing 1.9.4

 

Login via ssh or console.

Create directory tmp

# mkdir tmp
# cd tmp

Download the asterisk cd for your system into tmp folder. I used centos 64 bit

#  wget copy and paste this link
# yum -y update

# rpm -ivh ftp://mirror.cs.princeton.edu/pub/mirrors/fedora-epel/5/i386/epel-release-5-4.noarch.rpm

if this does not work use the following

# rpm -ivh http://ftp.riken.jp/Linux/fedora/epel//5/i386/epel-release-5-4.noarch.rpm

Add some packages
# yum -y install sysstat fail2ban bwm-ng system-config-securitylevel-tui python-setuptools

Mount the CD

# mkdir /mnt/iso
mount -o loop Elastix-2.4.0-Stable-x86_64-bin-04feb2013.iso /mnt/iso
cd /mnt/iso

Create yum repo for the CD
# nano /etc/yum.repos.d/elastix-cd.repo

Copy and paste the following into the file

[elastix-cd]
name=Elastix RPM Repo CD
baseurl=file:///mnt/iso/
gpgcheck=0
enabled=1

Press Ctrl X to save and answer Y to exit

# yum -y install elastix*

Upgrade a2billing otherwise calls will not be passed to a2billing by elastix pbx This will upgrade a2billing to 1.9.4-5
# yum install elastix-a2billing

Once that completes we will want to reboot.

#reboot

After reboot perform first boot configurations by entering required login passwords

# /etc/rc3.d/S66elastix-firstboot start

# reboot

Remove Disk Repo otherwise Webmin will not install
# rm /etc/yum.repos.d/elastix-cd.repo
# wget http://prdownloads.sourceforge.net/webadmin/webmin-1.610-1.noarch.rpm
# rpm -U webmin-1.610-1.noarch.rpm
Access webmin by going to  http://localhost:10000/. Or if accessing it remotely, replace localhost with your system's IP address.
Set up your webmin and make sure Bind is running
You can put back your repo if you want it may help when you want to install further addons. Please do not put this back before you install bind otherwise bind installation will fail.

Create yum repo for the CD
# nano /etc/yum.repos.d/elastix-cd.repo

Copy and paste the following into the file
[elastix-cd]
name=Elastix RPM Repo CD
baseurl=file:///mnt/iso/
gpgcheck=0
enabled=1

Configure your Domain
Link to how to configure domain. Do not update via webmin.

Login to your elastix by visiting https://yourdomain.whatever
Username Admin
Password  is the one you set it via console during installation.
You are done now you can configure your Elastix following Elastix without tears guide.

How to install Elastix on a VPS without loop devices (OpenVZ)

Written by admin on January 12, 2015. Posted in Elastix

This procedure is based on a OPENVZ VPS without  loop devices enabled, or any other vps without loop devices

What will be installed?

Elastix -2.5.0 with..

Freepbx 2.8

Asterisk 1.8

A2Billing 1.9.4

 

Login via ssh or console.

Create directory tmp

# mkdir tmp
# cd tmp

Download the asterisk cd for your system into tmp folder. I used centos 64 bit

Download the tar version from our servers (we only have this version, but you can use the method for any version. The secret is you download the iso and then use winrar or other programs to extract in. Next thing is you compress it to a .tar file using 7-zip utility and upload it to your server)

# wget  http://23.92.220.74/Elastix-2.5.0-STABLE-x86_64-bin-08may2015.zip
# yum -y update

# rpm -ivh ftp://mirror.cs.princeton.edu/pub/mirrors/fedora-epel/5/i386/epel-release-5-4.noarch.rpm

Add some packages
# yum install gcc gcc-c++ wget bison mysql-devel mysql-server php php-mysql php-pear php-pear-DB php-mbstring nano tftp-server httpd make ncurses-devel libtermcap-devel sendmail sendmail-cf caching-nameserver sox newt-devel libxml2-devel libtiff-devel php-gd audiofile-devel gtk2-devel subversion sysstat fail2ban bwm-ng system-config-securitylevel-tui python-setuptools nano unzip zip

Get rid of some unnecessary packages

# yum remove yum-updatesd cups cups-lpd redhat-lsb autofs pcsc-lite smartmontools cpuspeed

Shutdown unnecessary daemon brcm-iscsi which tends to do a lot of logging even when not used

# chkconfig iscsi off
chkconfig iscsid off
service iscsid stop
service iscsi stop

Replace syslog with the improved and backwards compatible rsyslog

# yum -y install rsyslog
chkconfig syslog off
chkconfig rsyslog on
service syslog stop
service rsyslog start

To prevent problems that can occur in an OpenVZ VPS if udev is ever updated do the following:

# nano /etc/rc.local

add the following lines:

/bin/rm -rf /dev/null
/bin/rm -rf /dev/random
/bin/rm -rf /dev/tty*
/bin/rm -rf /dev/pty*
/bin/mknod -m 0666 /dev/null c 1 3
/bin/mknod -m 0644 /dev/random c 1 8
/sbin/MAKEDEV tty
/sbin/MAKEDEV pty

(Ctrl-x> y >Enter)

Turn off selinux

setenforce 0

You can completeley disable it on OPENVZ

Extract CD iso

# mkdir /mnt/iso

unzip  Elastix-2.5.0-STABLE-x86_64-bin-08may2015.zip

rm Elastix-2.5.0-STABLE-x86_64-bin-08may2015.zip

Create yum repo for the CD
# nano /etc/yum.repos.d/elastix-cd.repo

Copy and paste the following into the file

[elastix-cd]
name=Elastix RPM Repo CD
baseurl=file:///mnt/iso/Elastix-2.5.0-STABLE-x86_64-bin-08may2015
gpgcheck=0
enabled=1

Press Ctrl X to save and answer Y to exit

# yum -y update

Install Elastix
#
yum -y install asterisk* elastix-* freeze fxload libmfcr2 lzop perl-HTML-TokeParser-Simple perl-WWW-Mechanize mod_ssl mlocate gcc gcc-c++ system-config-network-tui wget sox

# yum clean all

# sed -i 's/TTY=9/#TTY=9/g' /usr/sbin/safe_asterisk
sed -i 's/chown asterisk \/dev\/tty9/#chown asterisk \/dev\/tty9/g' /etc/init.d/asterisk
sed -i 's/\/sbin\/start_udev/#\/sbin\/start_udev/g' /etc/rc.d/rc.sysinit
sed -i 's/\/usr\/sbin\/fxotune -s/#\/usr\/sbin\/fxotune -s/g' /etc/rc.local
sed -i 's/chown $AMPASTERISKUSER \/dev\/tty9/#chown $AMPASTERISKUSER \/dev\/tty9/g'    /var/lib/asterisk/bin/freepbx_engine

 

# hkconfig haldaemon off
chkconfig asterisk off
chkconfig dahdi off
chkconfig wanrouter off

# rm -rf /etc/init.d/dahdi
rm -rf /etc/init.d/wanrouter
rm -rf /usr/src/Elastix

# echo 'DEVICE=eth0' > /etc/sysconfig/network-scripts/ifcfg-eth0
system-config-network

# service mysqld start

# reboot

 

First boot will not come up automatically since you do not have a mounted CD. So you need to run this command

# /etc/rc3.d/S66elastix-firstboot start

The system will prompt you for two important passwords with confirmation. Make sure your passwords are strong but remember-able. Make sure you reboot again before you can  login to your server but if you will need to use a domain instead of IP address then do the following

Remove Disk Repo otherwise Webmin will not install
# rm /etc/yum.repos.d/elastix-cd.repo
# wget http://prdownloads.sourceforge.net/webadmin/webmin-1.610-1.noarch.rpm
# rpm -U webmin-1.610-1.noarch.rpm
Access webmin by going to  http://localhost:10000/. Or if accessing it remotely, replace localhost with your system’s IP address.
Set up your webmin and make sure Bind is running
You can put back your repo if you want it may help when you want to install further addons. Please do not put this back before you install bind otherwise bind installation will fail.

Create yum repo for the CD
# nano /etc/yum.repos.d/elastix-cd.repo

Copy and paste the following into the file
[elastix-cd]
name=Elastix RPM Repo CD
baseurl=file:///mnt/iso/Elastix-2.5.0-STABLE-x86_64-bin-08may2015
gpgcheck=0
enabled=1

Configure your Domain
Do not update via webmin.

Login to your elastix by visiting https://yourdomain.whatever
Username:  admin
Password  is the one you set it via console during installation.
You are done now you can configure your Elastix following Elastix without tears guide.

Streaming Music on Hold in Elastix /Trixbox

Written by admin on November 22, 2014. Posted in Elastix, Trixbox

Sometimes you may want to stream a live radio channel on your Elastix server. The channel needs to be on shoutcast or icecast for this to work. You will make use of the musiconhold feature on  the Freepbx. Your stream must also be streamed as an MP3. I have not tried this with an AAC stream.

Since your stream is MP3 we will need to install mpg123. This however is not included in the Elastix installation so we will need to install it. In Trixbox find out if it is installed by running the command

# mpg123 –v

Then we perform installation (If its installed in Trixbox there is no need to install )

# cd /usr/src
# wget ftp://ftp.sunet.se/pub/os/Linux/RPMForge/dag/redhat/el3/en/i386/RPMS.dag/mpg123-1.6.2-1.el3.rf.i386.rpm

Next we install dependencies 

# yum install audiofile
# yum install glibc
# yum install libtool-ltdl
# yum install esound

Then run the installation of the rpm file

# rpm -ivh mpg123-1.6.2-1.el3.rf.i386.rpm

Configuration

You will need to get your stream url ready. The stream url is in the form http://176.9.164.202:8023 (this is my stream onhttp://www.netradiobroadcaster.net  You can get an account here if you want to own one. Use autodj to put your mp3 files which will be streamed.

Now that you have your URL 

1. Go to the unembedded FreePBX and click music on hold tab

2. Click Add stream category n

 

3. Create a category and in the Application field, enter the following, then paste the stream URL at the end of the application string (replacing [streamURL] )

/usr/bin/mpg123 -q -s –mono -r 8000 -f 8192 -b 0 [streamURL]

 

You now need an inbound route i.e a DID to access the stream

You can get cheap DIDs from www.didinternational.net

Go to inbound route in freePBX settings

1. Create an inbound route with your DID number.

2. On the music on hold field replace Default with your new category you created above.

3. For destination use Terminate and in the next field put "Put caller on hold forever"

 

Thats it. Reload your asterisk and your stream should play well

How to setup fax in Elastix

Written by admin on November 22, 2014. Posted in Elastix

Elastix is using Hylafax. As such all tools and applications that interface to Hylafax can be used.
Here is the Virtual Fax Extension configuration Step By Step:

Configuring Elastix Fax Module

  1. Click on the FAX tab on the Elastix Admin configuration screen
  2. Click on the New Virtual Fax selection and fill in the information
    Virtual Fax Name: HK Office (or whatever you wish)
    Destination Email: Using yours or a group email address
    Caller ID Name: This should be your organization name
    Caller ID Number: Your Fax number
    Fax Destination (IAX): This should be your extension we will setup for receiving fax
    Secret(IAX): This is the password of your extension.
  3. Click on Save
  4. That’s a virtual FAX machine setup and ready to go as soon as we create an extension.

Create a Fax extension
This extension that we will be setting up is an IAX extension, which differs slightly from the SIP
extensions that you are used to.

  1. Select “Generic IAX device” at the “Create new extension” screen
  2. Fill in the Extension information
    User Extension: XXXX (Same user extension when you setup your virtual fax)
    Display Name: HK Fax (or whatever you want to call it)
    Secret: 1234 (make sure this is the same secret you use when you setup your virtual fax)
    Fax Extension: Disabled
    Incoming/outgoing recording: Disabled
    Press submit when done.
  3. We have now created a complete working virtual fax machine.

Directing Fax to the correct extension (Dedicated Line)

If you have dedicated line for the Virtual Fax, under freePBX, all you do is set the incoming route of your Fax DID to go directly to extension XXXX.

Change in Zapata.conf

  1. Login Elastix console by root
  2. vi /etc/asterisk/zapata.conf
  3. Remove the comment on the line faxdetect=incoming
    If the line is not there then add faxdetect=incoming” to your zapata.conf file
  4. Reboot your Elastix Server

How to install G.729 and G.723 open source codecs on Elastix

Written by admin on November 22, 2014. Posted in Asterisk, Elastix

Please note that this tutorial is for education purposes only. If you want to use the codecs you should consider paying royalties to the creators of the codecs.

Precompiled codec modules can be found here: http://asterisk.hosting.lv  choose the one that is for your system architecture.

To find the details of your server architecture do the following

# uname -a

# cat /proc/cpuinfo

Use the information to select the codec suitable for your server.

Navigate to the modules folder

#  cd /usr/lib/asterisk/modules

or  if using 64 bit centos

# cd /usr/lib64/asterisk/modules

Download the codecs e.g

# wget http://asterisk.hosting.lv/bin/codec_g723-ast18-gcc4-glibc-pentium4.so

# wget http://asterisk.hosting.lv/bin/codec_g729-ast18-gcc4-glibc-pentium4.so

# /etc/init.d/asterisk restart

# asterisk -r

#CLI> core show translation

You should now see the codecs populated.

How to install a2billing callback daemon on Elastix

Written by admin on November 22, 2014. Posted in A2billing, Elastix

If you follow the installation procedures given on   http://forum.asterisk2billing.org forums you will notice that after installation either your callback daemon shows it has started but if you try to get status using command "service a2b-callback-daemon status" It shows that its not running. or it fails to even start at all. This is not because the installation procedures are wrong. This happens because of the SQLalchemy version that is default with python 2.4. Callback daemon does not run on any SQLalchemy version less than 0.6. The next procedure shows how to correctly install the callback daemon on Elastix without problems.

The first thing you need to know is that the directory of a2billing is different on Elastix from the ones you find on many forums. The correct folder is /usr/share/a2billing.

So now lets install the Daemon.

Login via ssh

# cd /usr/share/a2billing
# yum -y install python-setuptools.noarch
yum -y install MySQL-python
easy_install sqlalchemy

You will notice that the Sqlalchemy version installed is 0.3.x-py2.4.egg

You need to remove this and install a newer version

*If you had not installed SQLAlchemy for the below instructions just follow the ones in blue

# rm -rf /usr/lib/python2.4/site-packages/SQLAlchemy-0.3.11-py2.4.egg

#cd  /usr/lib/python2.4/site-packages/

# rm -rf sqlalchemy

# rm  -rf  SQLAlchemy-0.3.11-py2.4.egg-info

#wget https://pypi.python.org/packages/source/S/SQLAlchemy/SQLAlchemy-0.7.10.tar.gz

# tar zxvf SQLAlchemy-0.7.10.tar.gz

# cd SQLAlchemy-0.7.10

# python setup.py install

*If you had not installed SQLAlchemy for the above insttructions just follow the ones in blue

Change to callback directory

# cd /usr/share/a2billing/CallBack/callback-daemon-py
# cp callback_daemon/a2b-callback-daemon.rc /etc/init.d/a2b-callback-daemon
# chmod +x /etc/init.d/a2b-callback-daemon
# cp dist/callback_daemon-1.0.prod-r1528.tar.gz /tmp
# cd /tmp
# tar xvfz callback_daemon-1.0.prod-r1528.tar.gz
# cd callback_daemon-1.0.prod-r1528
# python setup.py build
# python setup.py bdist_egg

Now install Daemon

#easy_install dist/callback_daemon-1.0.prod_r1528-py2.4.egg

chkconfig --add a2b-callback-daemon
service a2b-callback-daemon start
chkconfig a2b-callback-daemon on

How to reset passwords for Freepbx, A2billing, Elastix and PIAF

Written by admin on November 16, 2014. Posted in A2billing, Asterisk, Elastix, Freepbx, PIAF, Server Security

Many times i get asked how to reset passwords in different systems. This article will explain how to do this in some VOIP systems.

 

1. FreePBX® 

To reset the admin password in FreePBX® you do the following:

Login to your ssh client and type the following

amportal admin auth_none

You will get the following response

Please wait...

trying to run as user asterisk:

[AUTHTYPE] changed from previous value: [database] to new value: [none]

Now login to yourFreePBX®  using username admin and no password and edit/add/create  admin details

After that go into your ssh and enter

amportal admin auth_database

You will get this response

Please wait...

trying to run as user asterisk:

[AUTHTYPE] changed from previous value: [none] to new value: [database]

You are done. You can now logout of FreePBX®  and login with new credentials

Please note that FreePBX® is a Registered Trademark of Schmooze Com, Inc and our mention of it in this or any other tutorial does not mean we are in any way associated or affiliated with them.

 

2. A2billing

To reset A2billing password you need to login to your ssh

1. Determine the database name, user and password for your A2Billing database

# head -n 15 /etc/a2billing.conf

The settings are normally at the top of the file so we just need the first 15 lines. They are usually

user = a2billinguser
password = a2billing
dbname = mya2billing

2. Log in to MySQL using the details we just got for the A2Billing database -

# mysql -u a2billing-user -p mya2billing
Enter password: a2billing

3. Change the password for root to ‘changepassword’ by using the following string

#mysql> update cc_ui_authen set pwd_encoded = '410fc6268dd3332226de95e42d9efa4046c5463769d7493b85e65cfa5c26362dc2455cc23c0bc5831deb008def4ab11a9eaa9b76ba3f377da134f39ec60dd758' where login='root';

4. You should now be able to login to A2Billing using the username/password of root/changepassword.

The A2billing password reset part is courtesy of  Matt Newcombe  http://sysadminman.net/blog/2009/reset-a2billing-1-4-root-password-950

 

3. Elastix

For Elastix just login to your ssh and enter the following line

# sqlite3 /var/www/db/acl.db "UPDATE acl_user SET md5_password = '`echo -n password|md5sum|cut -d ' ' -f 1`' WHERE name = 'admin'"

Replace the red coloured password with your desired password.

 

4. PBX in a flash (PIAF)

In PIAF login to ssh and enter the following

# passwd-master

This will change all your access passwords to the new one that you will be prompted to provide.

Thats it for now