HOWTO :: VoIP: Whosesale :: Calling Card :: OpenSer :: Radius :: Asterisk :: FreeSwitch :: A2Billing :: IVR :: Colo :: Colocations :: GADGETS

April 23, 2010

Installing Asterisk2Billing A2b 1.7.0 in CentOS 5.4

Filed under: A2Billing — Tags: , , , , , — admin @ 10:02 pm

Below is a step by step procedure how to install Asterisk2Billing or A2b 1.7.0 in CentOS 5.

Installation Prerequisites

It is assumed that you have already installed Asterisk on a suitable machine. This tutorial does not cover that part of the installation. If you are unfamiliar with the
install of Asterisk, it may be better to start with a pre-built distribution, e.g.

PBX in a Flash – www.pbxinaflash.com, or FonicaPABX – www.fonicaprojects.com may provide a secure base on which to build A2Billing.

Asterisk Now, Elastix and Trixbox are other possibilities to provide a base as part of the family of Asterisk / FreePBX / CentOS distributions. However, the author has
no knowledge of the security measures in place with these distributions, and indeed, Trixbox do recommend that their system is secured behind a firewall, so may not be
suitable for connection directly to the Internet without some remedial work.

Alternatively, Support and Managed Installation and Training services are available through http://www.star2billing.com

The distributions mentioned are based on Centos, so these instructions are Centos biased.

These distributions can be installed on a VMWare image for testing if no hardware is available.

If you have hand-rolled your own distribution, and are familiar with 1.3.4, then the we assume that you have the necessary dependencies already installed.

Install Dependencies

yum -y install perl-DBD-Pg subversion

get A2Billing

mkdir /usr/local/src/a2billing
cd /usr/local/src/a2billing
svn co –username guest –password guest http://svn.a2billing.net/svn/asterisk2billing/trunk/ /usr/local/src/a2billing

copy a2billing.conf in /usr/local/src/a2billing/a2billing.conf to /etc/a2billing.conf

Edit a2billing.conf to suit your installation. e.g. change dbtype to mysql.

Install Database

Note that for Piaf and FonicaPABX, the database password is passw0rd and the location is localhost
cd /usr/local/src/a2billing/DataBase/mysql-5.x
./install-db.sh

Answer the questions appropriately with reference to /etc/a2billing.conf

You should now have a database called mya2billing with over 70 tables in it.

Install the AGI and Sound Files

So that we can easily update the system when changes are made during this period of change, we are going to use links back to the location where we installed the SVN
download, so that an update from the SVN will immediately reflect in your A2Billing install.

Note that Database changes will not be included using this methodology, so these will have to be done by hand.

This is not the usual way of doing it, but for testing, it works well. You can also simply move or copy the files into the appropriate location.
ln -s /usr/local/src/a2billing/AGI/a2billing.php /var/lib/asterisk/agi-bin/a2billing.php

set ownership and permissions on AGI

chown asterisk:asterisk /var/lib/asterisk/agi-bin/a2billing.php
chmod +x /var/lib/asterisk/agi-bin/a2billing.php

Set up sounds

cd /usr/local/src/a2billing/addons/sounds
./install_a2b_sounds.sh

set ownership on sounds

chown -R asterisk:asterisk /var/lib/asterisk/

Asterisk Manager

Now edit /etc/asterisk/manager_custom.conf (or manager.conf for those not using a pre-rolled distribution including FreePBX). Add the following lines
[myasterisk]
secret = mycode
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.0
read = system,call,log,verbose,command,agent,user
write = system,call,log,verbose,command,agent,user

Install Web Pages

Assumption is that apache2 root folder is /var/www/html

Common

ln -s /usr/local/src/a2billing/common /var/www/html/a2billing/common

Admin pages

ln -s /usr/local/src/a2billing/admin /var/www/html/a2billing/admin

Agent

ln -s /usr/local/src/a2billing/agent /var/www/html/a2billing/agent

Customer

ln -s /usr/local/src/a2billing/customer /var/www/html/a2billing/customer

Now we need to set permissions for Apache.

If you are using a pre-rolled Distro, then web group and ownership are asterisk and asterisk, if you are not using a distro, then you probably know what to set anyway.
chown -R asterisk:asterisk /var/www/html/a2billing/
chown -R asterisk:asterisk /usr/local/src/a2billing/common
chown -R asterisk:asterisk /usr/local/src/a2billing/admin
chown -R asterisk:asterisk /usr/local/src/a2billing/customer
chown -R asterisk:asterisk /usr/local/src/a2billing/agent

Cronjobs

echo ”
# Automatically added for A2Billing
0 * * * * php /usr/local/src/a2billing/Cronjobs/a2billing_alarm.php
0 12 * * * php /usr/local/src/a2billing/Cronjobs/a2billing_archive_data_cront.php
0 10 21 * * php /usr/local/src/a2billing/Cronjobs/a2billing_autorefill.php
#Batch process at 00:20 each day
20 0 * * * php /usr/local/src/a2billing/Cronjobs/a2billing_batch_process.php
#Bill DID usage at 00:00 each day
0 0 * * * php /usr/local/src/a2billing/Cronjobs/a2billing_bill_diduse.php
#Generate Invoices at 6am everyday
0 6 * * * php /usr/local/src/a2billing/Cronjobs/a2billing_batch_billing.php
#Check if balance below preset value, and email user if so.
1 * * * * php /usr/local/src/a2billing/Cronjobs/a2billing_notify_account.php
#Charge subscriptions at 06:05 on the 1st of each month
0 6 1 * * php /usr/local/src/a2billing/Cronjobs/a2billing_subscription_fee.php
#Update currencies at 01:00 each day
0 1 * * * php /usr/local/src/a2billing/Cronjobs/currencies_update_yahoo.php
” >> /var/spool/cron/asterisk

Add directory for monitoring Script

mkdir -p /var/lib/a2billing/script
mkdir -p /var/run/a2billing

Create Log Files

Log files and Permissions

touch /var/log/asterisk/a2billing-daemon-callback.log
touch /var/log/a2billing-daemon-callback.log
touch /var/log/cront_a2b_alarm.log
touch /var/log/cront_a2b_autorefill.log
touch /var/log/cront_a2b_batch_process.log
touch /var/log/cront_a2b_bill_diduse.log
touch /var/log/cront_a2b_subscription_fee.log
touch /var/log/cront_a2b_currency_update.log
touch /var/log/cront_a2b_invoice.log
touch /var/log/a2billing_paypal.log
touch /var/log/a2billing_epayment.log
touch /var/log/api_ecommerce_request.log
touch /var/log/api_callback_request.log
touch /var/log/a2billing_agi.log

Callback

Here is a little script to install the call-back Daemon. Change the LOAD_LOC variable to reflect where you have downloaded A2Billing.

Callback Daemon installation Script

LOAD_LOC=/usr/local/src/a2billing

yum -y install python-setuptools.noarch
yum -y install MySQL-python
easy_install sqlalchemy

cd $LOAD_LOC/Callback/callback-daemon-py
cp $LOAD_LOC/CallBack/callback-daemon-py/build/lib/callback_daemon/a2b-callback-daemon.rc /etc/init.d/a2b-callback-daemon
chmod +x /etc/init.d/a2b-callback-daemon

cd $LOAD_LOC/CallBack/callback-daemon-py/
python setup.py build
python setup.py bdist_egg
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

Dialplan

The dialplan you put into Asterisk is the same as it was for A2Billing 1.3.4. I’ve not got round to writing the dialplan as yet.

Reboot

Login

http://Your-Switch/a2billing

Log into the admin pages with root and changepassword

General Setup

The general setup is similar to 1.3.4, and the order of events is approximately similar

* Set up trunk * Set up callplan * Setup rate plan * add rate table to callplan * add rates * add customer * test.

Guidelines

Keep an eye on the development of A2Billing here.

http://www.asterisk2billing.org/cgi-bin/trac.cgi/browser/trunk

Make sure that you are running the latest version before reporting a bug by periodically running.

Bugs can be dicussed in the bugs section here – http://forum.asterisk2billing.org/viewforum.php?f=22 before reporting them on the bug tracker.

Bugs tracking and reporting can be done here:- http://www.asterisk2billing.org/cgi-bin/trac.cgi/report

April 21, 2010

CentOS 5.4 or 5.5 + Asterisk 1.4 + G729 + G723

Filed under: Asterisk PBX — Tags: , , — admin @ 1:12 pm

This tutorial will teach you how to install Asterisk 1.4 on a fresh install of CentOS 5.4 / 5.5 with g729 and g723 supported codec.

yum update

yum upgrade

yum groupinstall ‘Development Tools’

yum groupinstall ‘Development Libraries’

yum install -y kernel kernel-devel

cd /usr/src

wget http://downloads.digium.com/pub/asterisk/asterisk-1.4-current.tar.gz
wget http://downloads.digium.com/pub/zaptel/zaptel-1.4-current.tar.gz
wget http://downloads.digium.com/pub/libpri/libpri-1.4-current.tar.gz
wget http://downloads.digium.com/pub/asterisk/asterisk-addons-1.4-current.tar.gz

tar xvzf asterisk-1.4-current.tar.gz && tar xvzf zaptel-1.4-current.tar.gz && tar xvzf libpri-1.4-current.tar.gz && tar xvzf asterisk-addons-1.4-current.tar.gz

a) Installing Zaptel

cd /usr/src/zaptel-1.4*
./install_prereq test
./install_prereq install
./configure
make
make install
make config
modprobe ztdummy

b) Installing Libpri

cd /usr/src/libpri-1.4*
make && make install

c) Installing Asterisk

c) Installing Asterisk

cd /usr/src/asterisk-1.4*

./configure

Comment: The next step is not mandatory. To install core and extra sounds in different languages:

make menuselect

Comment: Select the core-sounds you would like to play and extra sounds. Exit with �x� to save.

make
make install
make samples
make config
asterisk -vvvc
stop now
echo �ztdummy� >> /etc/modules

d) Installing Asterisk Addons

cd /usr/src/asterisk-addons*
./configure && make && make install
make samples

March 26, 2010

Installing Nagios 3.2.1 in CentOS 5

Filed under: Nagios — Tags: , , , , — admin @ 12:26 am

Here’s a quick step-by-step procedure on how to install Nagios Monitoring in CentOS 5. The installation is straightforward. You just have to copy and paste it to your SSH Terminal.

yum update
yum install httpd php
yum install gcc glibc glibc-common
yum install gd gd-devel
/usr/sbin/useradd -m nagios
passwd nagios
set nagios as password (I used nagios)
/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -a -G nagcmd nagios
/usr/sbin/usermod -a -G nagcmd apache
mkdir ~/downloads
cd ~/downloads
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.1.tar.gz
wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.11.tar.gz
tar xvzf nagios-3.2.1.tar.gz
cd nagios-3.2.1
./configure –with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
set password for nagiosadmin = this is the webui
service httpd restart
cd ~/downloads
tar xvzf nagios-plugins-1.4.11.tar.gz
cd nagios-plugins-1.4.11
./configure –with-nagios-user=nagios –with-nagios-group=nagios
make
make install
chkconfig –add nagios
chkconfig nagios on
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
chmod 777 /usr/local/nagios/var/rw/nagios.cmd
service nagios start

February 12, 2009

Installing FFmpeg & Dependencies For FLV Conversion

This guide should teach you how to install all the needed dependencies for ClipShare or other flash video conversion scripts. It’s primarily focused on RHEL or CentOS installs for the dependencies of these packages. The links in this guide are fresh as of 08/04/2008. Here is what this guide will help you install:

It assumes you already have Apache and PHP5 installed as those are required dependencies as well. There will also be a guide up for installing PHP5.2.6 from source on CentOS/RHEL soon.

First install subversion and ruby via yum or up2date:

yum -y install subversion ruby

Now we need to install MPlayer & FFmpeg sources from SVN:

cd ~
svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer

Now we need some codecs:

wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/essential-20071007.tar.bz2
tar xvjpf essential-20071007.tar.bz2
cd essential-20071007
mkdir /usr/local/lib/codecs
mv * /usr/local/lib/codecs/
chmod -R 755 /usr/local/lib/codecs/
cd ~

Next we will install LAME MP3 encoder:

wget http://internap.dl.sourceforge.net/sourceforge/lame/lame-398.tar.gz
tar xvzpf lame-398.tar.gz
cd lame-398
./configure –prefix=/usr
make
make install
cd ~

Now we install Libogg:

wget http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz
tar xvzpf libogg-1.1.3.tar.gz
cd libogg-1.1.3
./configure –prefix=/usr
make
make install
cd ~

We need to make sure the correct lib directories are setup in ldconfig. Edit the /etc/ld.so.conf file and add the following lines:

/usr/lib
/usr/local/lib

Now save and run the following command:

ldconfig

To install libvorbis we will run:

wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.0.tar.gz
tar xvzpf libvorbis-1.2.0.tar.gz
cd libvorbis-1.2.0
./configure –prefix=/usr
make
make install
cd ~

Now we will install FLVTool2:

wget http://rubyforge.org/frs/download.php/17497/flvtool2-1.0.6.tgz
tar xvzpf flvtool2-1.0.6.tgz
cd flvtool2-1.0.6
ruby setup.rb config
ruby setup.rb setup
ruby setup.rb install
cd ~

Next we should build MPlayer & MEncoder and it will take a while unless you have a nice dual or quad core machine. Note that I’ve seen the SVN version of these packages break before, so you can always download the source code from their site (a stable copy) if it fails on make:

cd mplayer
./configure –prefix=/usr
make
make install
cd ~

We will now build FFmpeg:

mkdir /usr/local/src/tmp
chmod 777 /usr/local/src/tmp
export TMPDIR=/usr/local/src/tmp
cd ffmpeg
./configure –prefix=/usr –enable-libmp3lame –enable-libvorbis –disable-mmx –enable-shared
make
make install
cd ~

Symlink some libraries if needed (ignore file exists errors):

ln -s /usr/local/lib/libavformat.so.50 /usr/lib/libavformat.so.50
ln -s /usr/local/lib/libavcodec.so.51 /usr/lib/libavcodec.so.51
ln -s /usr/local/lib/libavutil.so.49 /usr/lib/libavutil.so.49
ln -s /usr/local/lib/libmp3lame.so.0 /usr/lib/libmp3lame.so.0
ln -s /usr/local/lib/libavformat.so.51 /usr/lib/libavformat.so.51

Now build FFmpeg-PHP:

wget http://voxel.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.5.3.1.tbz2
tar xvjpf ffmpeg-php-0.5.3.1.tbz2
cd ffmpeg-php-0.5.3.1
phpize
./configure –prefix=/usr
make
make install
cd ~

Now you need to copy the ffmpeg.so file that was created from it’s location (from the build) to /usr/local/lib/php/extensions/, it should look something like:

cp /usr/local/lib/php/extensions/no-debug-non-zts-????????????/ffmpeg.so /usr/local/lib/php/extensions/

Modify your php.ini. Try /etc/php.ini or /usr/lib/php.ini or /usr/local/Zend/etc/php.ini as they are common locations, you can do php -i | grep -i ini to find the proper location. Change the extension_dir value as seen below and add the extension as seen below:

extension_dir = “/usr/local/lib/php/extensions/”
extension=ffmpeg.so

Now save and restart apache and test php for ffmpeg on both apache via phpinfo() and from shell:

service httpd stop
killall -9 httpd
service httpd start
php -i | grep -i ffmpeg

Let me know via comments if you find some bugs or better ways to do things!

Powered by WordPress

HOWTO :: VoIP: Whosesale :: Calling Card :: OpenSer :: Radius :: Asterisk :: FreeSwitch :: A2Billing :: IVR :: Colo :: Colocations :: GADGETS is Digg proof thanks to caching by WP Super Cache!