Upgrade Mbilling 5 to 6

523 views
Skip to first unread message

wil...@syssvoip.com.br

unread,
Dec 27, 2017, 9:03:30 PM12/27/17
to MagnusBilling English
Hi.

The old forum is disabled and I need the steps to upgrade my current mbilling version 5 to new version 6.

Can you post here the steps to do it ?

Thanks

fk33...@gmail.com

unread,
Dec 28, 2017, 5:33:07 AM12/28/17
to MagnusBilling English
Dear friend

I have installed magnus billing but unable to make anycall however everything is defined in server, but Asterisk CLI not showing any progress please help

Magnus Solution

unread,
Dec 28, 2017, 6:33:26 AM12/28/17
to MagnusBilling English

How UPGRADE your MagnusBilling V5 to V6


ALERT: This process can take many time. Not do it in production.

ALERT: MagnusBilling 6 only work in Centos 7 or Debian 8.

If you use Centos 6. Stop here .....


BEFORE START.....MAKE BACKUP

CODE: SELECT ALL

php /var/www/html/mbilling/cron.php Backup


If you use Centos, execute this command

CODE: SELECT ALL

yum clean all
yum -y install kernel-devel.`uname -m`
yum -y install gcc.`uname -m` gcc-c++.`uname -m` make.`uname -m` wget.`uname -m` bison.`uname -m` openssl-devel.`uname -m` ncurses-devel.`uname -m` doxygen.`uname -m` newt-devel.`uname -m` mlocate.`uname -m` lynx.`uname -m` tar.`uname -m` wget.`uname -m` nmap.`uname -m` bzip2.`uname -m` mod_ssl.`uname -m` speex.`uname -m` speex-devel.`uname -m` unixODBC.`uname -m` unixODBC-devel.`uname -m` libtool-ltdl.`uname -m` sox libtool-ltdl-devel.`uname -m` flex.`uname -m` screen.`uname -m` autoconf automake libxml2.`uname -m` libxml2-devel.`uname -m` sqlite* subversion
yum -y install php.`uname -m` php-cli.`uname -m` php-devel.`uname -m` php-gd.`uname -m` php-mbstring.`uname -m` php-pdo.`uname -m` php-xml.`uname -m` php-xmlrpc.`uname -m` php-process.`uname -m` php-posix libuuid-devel.`uname -m`
yum -y install jansson.`uname -m` jansson-devel.`uname -m` unzip.`uname -m`
yum -y install mysql mariadb-server  mariadb-devel mariadb php-mysql mysql-connector-odbc git
yum -y install epel-release dmidecode gtk2-devel binutils-devel svn libtermcap-devel libtiff-devel audiofile-devel cronie cronie-anacron


If you use Debian execute these 

CODE: SELECT ALL

apt-get -o Acquire::Check-Valid-Until=false update
apt-get install -y curl php5-fpm php5 php5-mcrypt libmyodbc unixodbc-bin apache2 php5-dev php5-common php5-cli php5-gd php-pear php5-cli php-apc php5-curl libapache2-mod-php5 libxml2 libxml2-dev openssl libcurl4-openssl-dev gettext gcc g++ libncurses5-dev sqlite3 libsqlite3-dev subversion mpg123
echo mysql-server mysql-server/root_password password ${password} | debconf-set-selections
echo mysql-server mysql-server/root_password_again password ${password} | debconf-set-selections            
apt-get install -y mysql-server php5-mysql mysql-client
apt-get install -y unixODBC unixODBC-dev unzip git
apt-get install -y libmysqlclient15-dev



Install jansson

CODE: SELECT ALL

cd /usr/src
wget http://www.digip.org/jansson/releases/jansson-2.7.tar.gz
tar -zxvf jansson-2.7.tar.gz
cd jansson-2*
./configure
make clean
make && make install
ldconfig


Backup asteirsk modules

CODE: SELECT ALL

mv /usr/lib/asterisk/modules /usr/lib/asterisk/modules_11


Install Asterisk 13

CODE: SELECT ALL

cd /usr/src
rm -rf asterisk*
clear
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gz
cd /usr/src
tar xzvf asterisk-13-current.tar.gz
rm -rf asterisk-13-current.tar.gz
cd asterisk-*
useradd -c 'Asterisk PBX' -d /var/lib/asterisk asterisk
mkdir /var/run/asterisk
mkdir /var/log/asterisk
chown -R asterisk:asterisk /var/run/asterisk
chown -R asterisk:asterisk /var/log/asterisk
make clean
./configure --with-ssl
make menuselect.makeopts
menuselect/menuselect --enable res_config_mysql  menuselect.makeopts
menuselect/menuselect --enable format_mp3  menuselect.makeopts
menuselect/menuselect --enable codec_opus  menuselect.makeopts
menuselect/menuselect --enable codec_silk  menuselect.makeopts
menuselect/menuselect --enable codec_siren7  menuselect.makeopts
menuselect/menuselect --enable codec_siren14  menuselect.makeopts
contrib/scripts/get_mp3_source.sh
make
make install
ldconfig




Installing MagnusBilling

CODE: SELECT ALL

mv /var/www/html/mbilling /usr/local/src/mbilling_5
cd /var/www/html
git clone https://github.com/magnussolution/magnusbilling6.git mbilling
cd /var/www/html/mbilling/
rm -rf /var/www/html/mbilling/tmp && mkdir /var/www/html/mbilling/tmp
mkdir /var/www/html/mbilling/assets
chown -R asterisk:asterisk /var/www/html/mbilling
mkdir /var/run/magnus
touch /etc/asterisk/extensions_magnus.conf
touch /etc/asterisk/sip_magnus_register.conf
touch /etc/asterisk/sip_magnus.conf
touch /etc/asterisk/sip_magnus_user.conf
touch /etc/asterisk/iax_magnus_register.conf
touch /etc/asterisk/iax_magnus.conf
touch /etc/asterisk/iax_magnus_user.conf


Add this new service on crontab

CODE: SELECT ALL

8 8 * * * php /var/www/html/mbilling/cron.php servicescheck


and edit the script MasiveCall to MassiveCall on Crontab

CODE: SELECT ALL

change 
* * * * * php /var/www/html/mbilling/cron.php MasiveCall
to
* * * * * php /var/www/html/mbilling/cron.php MassiveCall


Configure IAX file to add IAX support

CODE: SELECT ALL

echo "
[general]
bandwidth=low
disallow=lpc10
jitterbuffer=no
autokill=yes

#include iax_magnus_register.conf
#include iax_magnus_user.conf
#include iax_magnus.conf
" > /etc/asterisk/iax.conf


Set permissions

CODE: SELECT ALL

chown -R asterisk:asterisk /var/lib/php/session/
chown -R asterisk:asterisk /var/spool/asterisk/outgoing/
chown -R asterisk:asterisk /etc/asterisk
chown -R asterisk:asterisk /var/www/html/mbilling
chmod -R 777 /tmp
chmod -R 555 /var/www/html/mbilling/
chmod -R 750 /var/www/html/mbilling/resources/reports 
chmod -R 774 /var/www/html/mbilling/protected/runtime/
chmod +x /var/www/html/mbilling/agi.php

mkdir -p /usr/local/src/magnus/monitor
mkdir -p /usr/local/src/magnus/sounds
mkdir -p /usr/local/src/magnus/backup
mv /usr/local/src/backup* /usr/local/src/magnus/backup
chown -R asterisk:asterisk /usr/local/src/magnus/
chmod -R 755 /usr/local/src/magnus/

chmod 774 /var/www/html/mbilling/resources/ip.blacklist
chmod -R 655 /var/www/html/mbilling/tmp
chmod -R 750 /var/www/html/mbilling/resources/sounds
chmod -R 770 /var/www/html/mbilling/resources/images
chmod -R 755 /var/www/html/mbilling/assets/


Now reboot your server

CODE: SELECT ALL

reboot


Update database

CODE: SELECT ALL

php /var/www/html/mbilling/cron.php updatemysql

wil...@syssvoip.com.br

unread,
Dec 28, 2017, 8:17:26 AM12/28/17
to MagnusBilling English
Hi.

The upgrade was completed.

Just a note. The Mbilling 6 uses sip_magnus_users.conf file to store the sip accounts, but the realtime remains active in extconfig.conf file. 

Can I disable it?

Thanks

Magnus Solution

unread,
Dec 28, 2017, 8:22:03 AM12/28/17
to MagnusBilling English
edit /etc/asterisk/extconfig.conf comment lines

sipusers => mysql,general,pkg_sip
sippeers => mysql,general,pkg_sip


wil...@syssvoip.com.br

unread,
Dec 28, 2017, 8:38:46 AM12/28/17
to MagnusBilling English
Ok.

I tried to call and the Mbilling says the prefix is not found. I think the problem is that Mbilling searching for the entire number dialed as I show above:

<SIP/559101002-00000003>AGI Rx << VERBOSE "                WHERE pkg_plan.id=36 AND pkg_rate.status = 1 AND   (prefix LIKE '&_%' ESCAPE '&' AND '11113995555996412757'" 25

<SIP/559101002-00000003>AGI Tx >> 200 result=1

<SIP/559101002-00000003>AGI Rx << VERBOSE "                        REGEXP REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(CONCAT('^', prefix, '$')," 25

<SIP/559101002-00000003>AGI Tx >> 200 result=1

<SIP/559101002-00000003>AGI Rx << VERBOSE "                        'X', '[0-9]'), 'Z', '[1-9]'), 'N', '[2-9]'), '.', '.+'), '_', ''))" 25

<SIP/559101002-00000003>AGI Tx >> 200 result=1

<SIP/559101002-00000003>AGI Rx << VERBOSE "                ORDER BY LENGTH( prefix ) DESC " 25


I dialed 55 996412757, and the portability is off, so its searching for the prefix 1111399 ...

The rate exist Imagem inline 1

Any test you need, let me know.

Thanks

wil...@syssvoip.com.br

unread,
Dec 28, 2017, 8:59:34 AM12/28/17
to MagnusBilling English
Dialing to LandLine the problem persist:

       > "/var/www/html/mbilling/agi.php": 

       > "/var/www/html/mbilling/agi.php": Start MBilling AGI

       > "/var/www/html/mbilling/agi.php": Check If Is Did 35372030

       > "/var/www/html/mbilling/agi.php": CALL TO PSTN

       > "/var/www/html/mbilling/agi.php": AuthenticateUser 559101001

       > "/var/www/html/mbilling/agi.php": Try accountcode authentication 559101001

       > "/var/www/html/mbilling/agi.php": AUTHENTICATION BY ACCOUNTCODE:559101001

       > "/var/www/html/mbilling/agi.php": use_dnid:1 && len_dnid:(8 || len_exten:8 ) && (try_num:0)

       > "/var/www/html/mbilling/agi.php": USE_DNID DESTINATION -> 35372030

       > "/var/www/html/mbilling/agi.php": REMOVE INTERNACIONAL PREFIX -> 35372030

       > "/var/www/html/mbilling/agi.php": Grab :0 Replacement: 55 Phone Before: 35372030

       > "/var/www/html/mbilling/agi.php": Grab :* Replacement: 5555 Phone Before: 35372030

       > "/var/www/html/mbilling/agi.php": Grab :* Replacement: 5555 Phone Before: 555535372030

       > "/var/www/html/mbilling/agi.php": Phone After translation: 555535372030

       > "/var/www/html/mbilling/agi.php": USERNAME=559101001 DESTINATION=555535372030 PLAN=36 CREDIT=8923.1436

       > "/var/www/html/mbilling/agi.php": SELECT lcrtype, pkg_plan.id AS id_plan, pkg_prefix.prefix AS dialprefix,

       > "/var/www/html/mbilling/agi.php":                 pkg_plan.name, pkg_rate.id_prefix, pkg_rate.id AS id_rate, buyrate,  buyrateinitblock buyrateinitblock,

       > "/var/www/html/mbilling/agi.php":                 buyrateincrement, rateinitial, initblock, billingblock, connectcharge, disconnectcharge disconnectcharge,

       > "/var/www/html/mbilling/agi.php":                 pkg_rate.id_trunk AS id_trunk, pkg_trunk.trunkprefix AS rc_trunkprefix, pkg_trunk.directmedia AS rc_directmedia,

       > "/var/www/html/mbilling/agi.php":                 pkg_trunk.providertech AS rc_providertech ,pkg_trunk.providerip AS rc_providerip,

       > "/var/www/html/mbilling/agi.php":                 pkg_trunk.removeprefix AS rc_removeprefix, pkg_trunk.failover_trunk AS rt_failover_trunk,

       > "/var/www/html/mbilling/agi.php":                 pkg_trunk.addparameter AS rt_addparameter_trunk, pkg_trunk.status, pkg_trunk.inuse, pkg_trunk.maxuse,

       > "/var/www/html/mbilling/agi.php":                 pkg_trunk.allow_error,pkg_trunk.if_max_use, pkg_rate.additional_grace AS additional_grace, minimal_time_charge,

       > "/var/www/html/mbilling/agi.php":                 minimal_time_buy, pkg_trunk.link_sms, pkg_trunk.user user, pkg_trunk.secret, package_offer ,

       > "/var/www/html/mbilling/agi.php":                 pkg_trunk.id_provider, pkg_provider.credit_control, pkg_provider.credit

       > "/var/www/html/mbilling/agi.php":                 FROM pkg_plan

       > "/var/www/html/mbilling/agi.php":                 LEFT JOIN pkg_rate ON pkg_plan.id = pkg_rate.id_plan

       > "/var/www/html/mbilling/agi.php":                 LEFT JOIN pkg_trunk AS pkg_trunk ON pkg_trunk.id = pkg_rate.id_trunk

       > "/var/www/html/mbilling/agi.php":                 LEFT JOIN pkg_prefix ON pkg_rate.id_prefix = pkg_prefix.id

       > "/var/www/html/mbilling/agi.php":                 LEFT JOIN pkg_provider ON pkg_trunk.id_provider = pkg_provider.id

       > "/var/www/html/mbilling/agi.php":                 WHERE pkg_plan.id=36 AND pkg_rate.status = 1 AND   (prefix LIKE '&_%' ESCAPE '&' AND '555535372030'

       > "/var/www/html/mbilling/agi.php":                         REGEXP REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(CONCAT('^', prefix, '$'),

       > "/var/www/html/mbilling/agi.php":                         'X', '[0-9]'), 'Z', '[1-9]'), 'N', '[2-9]'), '.', '.+'), '_', ''))

       > "/var/www/html/mbilling/agi.php":                 ORDER BY LENGTH( prefix ) DESC 

    -- "/var/www/html/mbilling/agi.php": The number 555535372030, no exist in the plan 36

    -- "/var/www/html/mbilling/agi.php": Send Congestion prepaid-dest-unreachable

Magnus Solution

unread,
Dec 28, 2017, 3:42:14 PM12/28/17
to MagnusBilling English
Try edit any existent prefix or add 1 new prefix. 

fk33...@gmail.com

unread,
Dec 28, 2017, 3:42:50 PM12/28/17
to MagnusBilling English
almost same problem i have been facing while dialing usa numbers however UK numbers working fine


Reply all
Reply to author
Forward
0 new messages