Author Archive

Creating an OpenVZ template in Proxmox

Written by admin on March 15, 2015. Posted in Virtualisation

We use Proxmox in our hosted servers (of which 90 % are voip servers) at http://vps4hire.com . At one time i needed to create a template in proxmox of a CT for use in automatic deployments on the server. Most of the templates i had been migrated from SolusVM. I googled around and found this article  https://raymii.org/s/tutorials/OpenVZ_Proxmox_Container_to_Template.html. However every time i tried to use the method i got a message saying

tar: Cowardly refusing to create an empty archive
Try 'tar --help' or 'tar --usage' for more information.

The solution i found was to create it the following way.

Lets say container is number is 132

in command prompt you must stop the container before creating the image:

vzctl stop 132
Stopping container ...
Container was stopped
Container is unmounted

Go to the private folder:

cd /var/lib/vz/private/

Then start image creation:

cd 132/ && tar -zcvf ../centos-v-1.tar.gz . && cd .. 

Then copy your created file to templates folder:

cp centos-v-1.tar.gz /var/lib/vz/private/template/cache

Thats it you can now start using the template. Remember to specify you OS in the name of your template.


How to Install Google TTS in Freepbx

Written by admin on March 13, 2015. Posted in Applications and addons, Asterisk

Many times you need a free voice in Freepbx since voice offered by Flite engine is horrible. The other offered by Swift is good but not cheap. Google TTS offers a free but averagely good conversion on text to speech. Problem is you get bits and pieces of information to such an extenst that a novice would not be able to fit these bits together to come up with a solution.

This article seeks to show step by step how to  install Google TTS on a freepbx machine. (PLEASE NOTE the Freepbx installation referred here is on Centos 6   64bit

After you have installed your freepbx you need to login as root on ssh and do the following

1. Install google tts

yum -y install perl perl-libwww-perl sox cpan
rpm -Uhv http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
yum -y install mpg123
PERL_MM_USE_DEFAULT=1 perl -MCPAN -e "install Bundle::LWP"
PERL_MM_USE_DEFAULT=1 perl -MCPAN -e "install CGI::Util"
wget https://github.com/zaf/asterisk-googletts/blob/master/googletts.agi
mv googletts.agi /var/lib/asterisk/agi-bin/
chmod 755 /var/lib/asterisk/agi-bin/googletts.agi

cd /tmp
git clone git://github.com/zaf/asterisk-googletts
cd asterisk-goo*
cd cli
mv googletts-cli.pl /usr/local/sbin/googletts-cli.pl


2. Configure propolys-tts.agi

nano /var/lib/asterisk/agi-bin/propolys-tts.agi

 

Find

case 'swift':
exec($enginebin." -p audio/channels=1,audio/sampling-rate=8000 -o $wavefile -f $textfile");
break;

and below add

case 'googleTTS':
exec($enginebin." -l de -f $textfile -r 8000 -o $wavefile");
break;

when done the file should  be able to look like this at the portion you edited

 

case 'swift':
exec($enginebin." -p audio/channels=1,audio/sampling-rate=8000 -o $wavefile -f $textfile");
break;
case 'googleTTS':
exec($enginebin." -l de -f $textfile -r 8000 -o $wavefile");
break;
default:
}

You are done configuring google TTS but before you start using it, Go to freepbx GUI and look under Settings for Text to speech Engines

add engine and name it whatever you want. If you dont have this module make sure you install it using module admin.

 

For the engine path use

/usr/local/sbin/googletts-cli.pl

Now you can select text to speech under applications in Freepbx you will now be able to see google tts on the dropdown along with flite.

 

I hope this tutorial helps


How to install data4voip

Written by admin on January 25, 2015. Posted in Asterisk, data4voip

Installation instructions for data4voip are so lean that to someone who is new to linux it will be a mountain to climb. This is probably why most people would prefer a2billing for wholesale than data4voip switch. Below is a simplified step by step how to install it. we also have an automated script for it. Visit our store to purchase it. The installation must be done on Centos 6. Please also note that the installed product is not the same exactly the same with the demo. Probably some features are available if you make them install for you. This defeats though the purpose why it is opensource.

1. Install Epel repos and update yum

# yum -y update
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
sudo rpm -Uvh epel-release-6*.rpm

2. Install php

# yum -y install httpd nano php
yum --enablerepo=centosplus install mod_php

3. Correct time zone

Edit the file "/etc/php.ini", find the line ";date.timezone =", uncomment it and add your timezone

# nano +946 /etc/php.ini

4. Install other dependencies

# yum -y install mysql-server
yum -y install php-mysql php-gd php-domxml-php4-php5 unixODBC mysql- connector-odbc asterisk-odbc mod_ssl

5. Start mysql and set mysql password you can keep it as root now and change later

# service mysqld restart
mysqladmin -u root password 'root'

6. Install data4voip web interface

# cd /usr/src
wget http://www.data4voip.com/billing/data4voip_billing.tar.gz
tar -xzf data4voip_billing.tar.gz -C /var/www/html/

chown -R apache:apache /var/www/html/

find /var/www/html/ -type d -exec chmod 755 {} \;

find /var/www/html/ -type f -exec chmod 644 {} \;

find /var/www/html/agi/ -type f -exec chmod 744 {} \;

find /var/www/html/cron/ -type f -exec chmod 744 {} \;
7. Create database

# mysql -u root -p
<mysql> CREATE DATABASE v_billing;

exit

8. Populate the database

# wget http://www.data4voip.com/billing/billing_database.sql
mysql -u root -p v_billing < billing_database.sql

cd /etc/
wget http://www.data4voip.com/billing/database.inc
chown -Rf apache:apache /etc/database.inc
chmod 400 /etc/database.inc

9. Install asterisk

# sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config
setenforce 0

yum install -y make wget openssl-devel ncurses-devel newt-devel libxml2-devel kernel-devel gcc gcc-c++ sqlite-devel libuuid-devel
cd /usr/src/

wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-1.4-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-11-current.tar.gz

tar zxvf dahdi-linux-complete*
tar zxvf libpri*
tar zxvf asterisk*
cd /usr/src/dahdi-linux-complete*
make && make install && make config

cd /usr/src/asterisk*
./configure --libdir=/usr/lib64 && make menuselect && make && make install
make clean && make distclean
make samples
make config
service dahdi start
service asterisk start

10. Replace config files or change the parameters in these files to suit your details if you used different mysql password

#  cd /etc/
wget http://www.data4voip.com/billing/odbcinst.ini
wget http://www.data4voip.com/billing/odbc.ini
cd /etc/asterisk/
wget http://www.data4voip.com/billing/res_odbc.conf
wget http://www.data4voip.com/billing/manager.conf
wget http://www.data4voip.com/billing/extensions.conf
wget http://www.data4voip.com/billing/sip.conf
wget http://www.data4voip.com/billing/extconfig.conf

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.

Enabling iptables on openvz containers

Written by admin on December 24, 2014. Posted in Server Security

This post is directed to those who run their data centres or small virtualised systems. Many times customers want to install firewall on their vps servers and after installation of your openvz system you might find that software firewalls such as csf may not run because the container's iptables are not activated. To correct this you need to do the following:

in ssh enter the following command

nano /etc/vz/vz.conf

Then locate the line which begins with IPTABLES=

uncomment this line if it is commented and edit it. Make sure the following is just one line. The line must now look like

#IPTABLES=”ipt_REJECT ipt_recent ipt_owner ipt_REDIRECT ipt_tos ipt_TOS ipt_LOG ip_conntrackipt_limit ipt_multiport iptable_filter iptable_mangle ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_length ipt_state iptable_nat ip_nat_ftp”

Thats it then just restart openvz by this command

# /etc/init.d/vz restart

Then you can now install CSF on your containers.

How to limit concurrent calls for asterisk extensions

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

Sometime you need to limit the number of simultaneous calls that an extension can be allowed to make. freepbx has a trunk simultaneous calls limitation but does not have the SIP account limitation facility. the workaround  is to do the following.

Login to your server via ssh and do the following

# nano sip_custom_post.conf

suppose the extension you want to limit is 3500  and you want to limit the call limit to 3 simultaneous calls. hen you must copy and paste the following.

[3500](+)
call-limit=3

Save the file by clicking  CTRL + X   and then confirm with a Y

Restart asterisk

# amportal restart

Downgrading vzctl for Solusvm

Written by admin on November 22, 2014. Posted in Basic Linux

In some servers installing SolusVM often installs vzctl 4 series. However i have noticed with dedicated servers from other providers such as Server4you, your OpenVZ virtualisation wont work. The solution to this is to downgrade vzctl to the 3 series, and then disable quotas. Here is a brief instructions on how this can be done.

Open your SSH client such as Xshell, Putty or SSH secure.

Login as root and do the following

Backup the vz.conf file

# cp /etc/vz/vz.conf /etc/vz/vz.conf.moved

Remove vzctl

# yum remove vzctl vzctl-lib

#yum remove vzctl-core-4.2-1.x86_64

Install the lower version
# cd /tmp
# wget http://download.openvz.org/utils/vzctl/3.0.29.3/vzctl-3.0.29.3-1.x86_64.rpm
# wget http://download.openvz.org/utils/vzctl/3.0.29.3/vzctl-lib-3.0.29.3-1.x86_64.rpm
# rpm -ihv vzctl-3.0.29.3-1.x86_64.rpm vzctl-lib-3.0.29.3-1.x86_64.rpm
# cp /etc/vz/vz.conf.moved /etc/vz/vz.conf

Use nano disable quotas in /etc/vz/vz.conf by changing Quotas =yes  to Quotas=no

and in /etc/fstab by uncommenting the quota line

# service vz restart

How to transfer calls between extensions

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

Many clients keep asking  how to transfer calls between extensions. Here is how you do it. Please note that i we will be launching a forum where such specific questions can be answered.

When you receive a call on an extension and you wish to transfer it to another extension here is what you do:

Press## in quick succession

You will here a music on hold sound.

Enter the extension you wish to transfer the call to. Your call will start ringing on the other extension.

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