Tuesday, August 1, 2017

Installation process for Kamailio 5.2 and Siremis 4.4 on Centos 7

How to install Kamailio 5.2 and Siremis 4.4 on Centos 7
(last tested Successfully on February 2019)  


AS OF FEB 2020 some of the files on the repo aren't available. The system has moved to GIT to download, so some of this information may not apply anymore. 

Tested on a standard deployment of CENTOS 7 minimal build 1810 (in HyperV environment)

Deployment below is based on a fully updated OS available (as of January 2019)

Copy/Paste the commands in BOLD.  Submit them one at a time, waiting for each action to complete.  

INSTALL CENTOS 7 (MINIMAL INSTALL)



  
Choose the installation language
Set your TIME ZONE



Select your installation destination.

In most cases you just have to select DONE.


The important part.  Select Network and Hostname.



On the right side, select your network interface to “ON

Assuming you are using DHCP your system should get an IP address now (might take a minute).  Note the IP as you’ll need to use that to SSH to the box after.
If you are hard-coding an IP, click on CONFIGURE in the corner and assign the values that are appropriate to your network.

Set your HOSTNAME in the lower left corner


Select APPLY then click on DONE

Select “BEGIN INSTALLATION




 While its installing set your ROOT password.

You don’t need to set a USER CREATION.




Install can take 5-10 minutes, really depends on the speed of your machine.  Once its ready the 'reboot' button will be available for you to complete the base os install.


SSH to the server

I recommend using SSH to configure this box vs typing long commands into the console manually.  You can use whatever SSH client you like.  PUTTY is very popular on Windows machines.

If you aren't sure of the IP of your machine, from the console, login as "root" and use the password you assigned above.

once you are logged in type in
ip addr



You'll see some cryptic info for most show up, but check out to see if you see an IP schema you recognize.  in this example, on ETH0 (pretty standard interface name) the ip is 10.1.80.177
Commands that you need to use in the console are marked in BOLD


UPDATE BOX
yum -y update
INSTALL MARIADB (aka MySQL)
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
yum -y install epel-release
yum -y install mariadb-server mariadb
systemctl start mariadb.service
systemctl enable mariadb.service
mysql_secure_installation

        "enter for none"
SET ROOT PASSWORD = Y
Remove anonymous users= Y
Disallow root login remotely = Y
Remove test database and access to it? = Y
Reload privilege tables now = Y
INSTALL APACHE
yum -y install httpd
systemctl start httpd.service
systemctl enable httpd.service
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum -y install yum-utils
INSTALL PHP
yum -y install php
systemctl restart httpd.service
yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel php-imap php-mysqlnd php-pdo
systemctl restart httpd.service
Install PHPmyadmin (handy if editing SQL data in vtiger)
yum -y install phpMyAdmin
Edit the file
/etc/httpd/conf.d/phpMyAdmin.conf
FIND THIS 
 
MAKE IT LOOK LIKE THIS


Edit the file below and Change "Cookie" to "HTTP"
/etc/phpMyAdmin/config.inc.php  
$cfg['Servers'][$i]['auth_type']     = 'cookie';    // Authentication method (config, http or cookie based)?

systemctl restart  httpd.service
Add entries into firewall
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
 sed -i -r 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
 REBOOT
shutdown -r now
Install KAMAILIO
yum install wget 
cd /etc/yum.repos.d/
wget http://download.opensuse.org/repositories/home:/kamailio:/v5.2.x-rpms/CentOS_7/home:kamailio:v5.2.x-rpms.repo
yum install -y kamailio kamailio-ldap kamailio-mysql kamailio-debuginfo kamailio-xmpp kamailio-unixodbc kamailio-utils kamailio-tls kamailio-outbound kamailio-gzcompress kamailio-presence
Enable MYSQL as the Kamailio DBengine

sed -i -r 's/# DBENGINE=MYSQL/DBENGINE=MYSQL/' /etc/kamailio/kamctlrc
Create users and tables need by Kamailio in MySQL
kamdbctl create
MySQL password for root is the password you set when you ran  mysql secure_installation. 
Answer “Y” yes to the next 3 questions.  Output example below:


Edit the file 
/etc/kamailio/kamailio.cfg
Add the following lines just below #!KAMAILIO

#!define WITH_MYSQL
#!define WITH_TLS
#!define WITH_AUTH
#!define WITH_USRLOCDB
#!define WITH_NAT
#!define WITH_PRESENCE
#!define WITH_ACCDB

Save your changes

Start Kamailio

service kamailio start

Test Kamailio if its running:

kamctl
Should respond with some stuff to show you its running

SIREMIS GUI Install

cd /tmp
wget http://siremis.asipto.com/pub/downloads/siremis/siremis-4.4.0.tgz
tar zxvf siremis*
cp -a siremis*/. /var/www/html
cd /var/www/html
make prepare24


Cleanup of files

rm -rf /var/www/html/Makefile
rm -rf /var/www/html/Changelog
rm -rf /var/www/html/README
chown -R apache. /var/www/html
 Create the file
/etc/httpd/conf.d/siremis.conf
Put in the following in that file

<Directory "/var/www/html/siremis">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        Allow from all
        <FilesMatch "\.xml$">
            Order deny,allow
            Deny from all
        </FilesMatch>
        <FilesMatch "\.inc$">
            Order deny,allow
            Deny from all
        </FilesMatch>
  </Directory>
<Directory "/var/www/html/openbiz">
    AllowOverride All
    Order deny,allow
    Deny from all
  </Directory>
<Directory "/var/www/html/misc">
    AllowOverride All
    Order deny,allow
    Deny from all
  </Directory>



Restart web browser service
systemctl restart httpd
I’ve had weird problems in the past copy/pasting this next command, 
sometimes I have to type it:
mysql –p
(enter sql root password that you set up earlier in this installation)


ENTER IN the following and press enter:
GRANT ALL PRIVILEGES ON siremis.* TO siremis@localhost IDENTIFIED BY 'siremisrw';
Type in EXIT to quit


Edit the file (vi or nano)
/etc/php.ini
Around line 878 you’ll find the following: (in 'vi" press ESC 878 SHIFT+G)

[Date]

; Defines the default timezone used by the date functions
; http://php.net/date.timezone
;date.timezone =

Remove the semicolon in front of date.timezone =
and then enter in your time zone


Save your changes and exit

Restart the services
systemctl restart httpd
service firewalld stop        
sudo systemctl start httpd.service
sudo systemctl enable httpd.service
Visit the following URL
http://IPorFQDN/siremis
IE http://192.168.201.10/siremis


If all went well you should see this show up in your browser!

Click on SETUP NOW


Click on NEXT




SELECT all 4 boxes in RED then click on NEXT


Should be all ready.  Select NEXT


Note the default user/password
Click on LAUNCH SIREMIS (it will automatically take you to the screen after 30 secs)




MAIN SCREEN



ISSUES:

During testing, navigating to SIP USER MENU- SUBSCRIBER DATA resulted in error with 2 missing columns in the "subscriber" table.

Research showed these two tables were part of the design and the column types were provided.  Below creates the two columns should this error be encountered.

mysql -puse kamailio;
ALTER TABLE `subscriber` ADD `rpid` VARCHAR(64) NULL DEFAULT NULL ;ALTER TABLE `subscriber` ADD `email_address` VARCHAR(64) NOT NULL ;exit;


20 comments:

  1. i am trying to install kamailio from your guide, but i am getting the following error:
    [root@KamGui yum.repos.d]# yum install -y kamailio
    Loaded plugins: fastestmirror, langpacks
    Loading mirror speeds from cached hostfile
    No package kamailio available.
    Error: Nothing to do

    ReplyDelete
    Replies
    1. the installation took place from a minimal install iso

      Delete
  2. I just did the entire install on HyperV and it worked.
    There was ONE minor change, in the section where you "UPDATE SYSTEM FILES", I originally had " yum -y update" but that seemed to not do anything, and i had to change it to "yum update -y" and that updated the system

    I doubt this was the issue for you, what seems more likely is the section where you need to add Kamailio to your repo.
    "Add CentOS 7’s Kamailio repos"
    Verify that you completed that portion of the instructions.

    Hope this helps!

    ReplyDelete
  3. fixed, but now i bumped into another issue. Once i login to siremis and go through the wizard, then it returns an error to the siremis webpage at the end of the setup process through the wizard. Once i finish with the wizard it redirects me to the URL 192.168.0.5/siremis/system/general_default and the webpage shows an error that it cannot access the /system/general_default.
    Any ideas please?

    ReplyDelete
    Replies
    1. Me too facing same issue. Has anyone found a solution yet?

      Delete
  4. So i was going through the doc and i noticed something that I missed before. In normal "VIEW" some of the commands are mis-formatted in the webpage, but when I'm in EDIT mode, it looks just fine, which is where I was copying/pasting from. It didn't seem to affect the install, but there were some steps that didn't happen properly.

    Now there is one thing about the GUI that I didn't get into in this doc originally, but I've added. When you launch the GUI for the first time, there are FOUR boxes that you need to have check marked. The very last image in this document you'll see a red box that indicates they need to be check marked.

    I just did the entire install a few minutes ago, followed the instructions on this verbatim and i was able to login (make sure pop ups are disabled in your browser for that site).

    ReplyDelete
  5. good.

    i can not englist .

    your explain very very easy and good.

    thank you for your explain.

    ReplyDelete
  6. Hi,
    Great Explanation :).
    Do you have any tutorial on how to integrate Kamailio with Asterisk and the Kamailio be used as registrar and load balancing?

    Thanks

    ReplyDelete
  7. At this time I don't. I worked with asterisk and Kamailio for awhile, but didn't really peruse it very far. But I think I'll revisit it and do some more work with it. Check back in coming weeks for some updates.

    ReplyDelete
  8. Hi,

    I'm having trouble on adding subscribers from GUI:
    [2018-01-15 09:54:34 (GMT)] An exception occurred while executing this script:
    Error message: #0, Error in query:: SELECT T0.id, T0.username, T0.domain, T0.contact, T0.received, T0.path, T0.expires, T0.q, T0.callid, T0.cseq, T0.last_modified, T0.flags, T0.cflags, T0.user_agent, T0.socket, T0.methods, T0.ruid, T0.instance, T0.reg_id, T0.server_id, T0.connection_id, T0.keepalive, T0.partition FROM `location` T0 LIMIT 10. SQLSTATE[42S22]: Column not found: 1054 Unknown column 'T0.server_id' in 'field list'
    Script name and line number of error: /var/www/html/openbiz/bin/data/BizDataObj_Lite.php:447

    function: _run_search ( Array(2) ) @ /var/www/html/openbiz/bin/data/BizDataObj_Lite.php 243
    function: fetch ( ) @ /var/www/html/openbiz/bin/easy/EasyForm.php 690
    function: fetchDataSet ( ) @ /var/www/html/openbiz/bin/easy/FormRenderer.php 69
    function: renderSmarty ( Object(EasyForm), "/var/www/html/siremis/modules/ser/template/grid.tpl" ) @ /var/www/html/openbiz/bin/easy/FormRenderer.php 45
    function: render ( Object(EasyForm) ) @ /var/www/html/openbiz/bin/easy/EasyForm.php 1648
    function: renderHTML ( ) @ /var/www/html/openbiz/bin/easy/EasyForm.php 1538
    function: render ( ) @ /var/www/html/openbiz/bin/easy/ViewRenderer.php 83
    function: renderSmarty ( Object(EasyView), "/var/www/html/siremis/modules/ser/template/view_tabs.tpl" ) @ /var/www/html/openbiz/bin/easy/ViewRenderer.php 40
    function: render ( Object(EasyView) ) @ /var/www/html/openbiz/bin/easy/EasyView.php 274
    function: _render ( ) @ /var/www/html/openbiz/bin/easy/EasyView.php 237
    function: render ( ) @ /var/www/html/openbiz/bin/BizController.php 221
    function: renderView ( "ser.view.SubscriberListView", "", "", Null, "" ) @ /var/www/html/openbiz/bin/BizController.php 107
    function: dispatchRequest ( ) @ /var/www/html/openbiz/bin/BizController.php 32
    function: include_once ( "/var/www/html/openbiz/bin/BizController.php" ) @ /var/www/html/siremis/bin/controller.php 6
    function: include ( "/var/www/html/siremis/bin/controller.php" ) @ /var/www/html/siremis/bin/_forward.php 102
    function: include ( "/var/www/html/siremis/bin/_forward.php" ) @ /var/www/html/siremis/index.php 3

    and via kamcli commands
    [root@localhost html]# kamctl add test1@192.168.1.204 test
    which: no gdb in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/)
    MySQL password for user 'kamailio@localhost':
    ERROR 1045 (28000): Access denied for user 'kamailio'@'localhost' (using password: YES)
    ERROR: introducing the new user 'test1@192.168.1.204' to the database failed

    The password Is correct I can add Domain but not an subscriber...

    Do you have any idea on how can I overcome this situation?

    Thanks

    ReplyDelete
  9. Off hand, no. But I'm going to do an integration document in the coming weeks so I can revisit these sorts of situations. So unfortunately I have no answer right now, but its on my to-do docs now.

    ReplyDelete
    Replies

    1. Is there any solution to this problem? : /. Very good tutorial

      Delete
  10. Concerning your first error "the column not found", tried kamailio 5.2, column exist.

    ReplyDelete
  11. I've since updated this site to refer to Kamailio 5.2 A lot of bugs seem to be gone (to be replaced by new ones i'm sure)

    ReplyDelete
  12. Unable to write in the session save path [/var/www/html/siremis/session]Unable to write in the session save path [/var/www/html/siremis/session]

    ReplyDelete
  13. Hello:
    I am having the same issue (22 August 2019) and I was wondering if this is a bug or just a permission issue.
    I also checked the (MariaDB) database system and I see that the Kamailio system is fully populated with the right tables but the Siremis database in total empty. Is there a way to reinstall the Siremis database?
    Thanks.
    Kevin

    ReplyDelete
  14. Very good guide
    did everything you wrote and work like a charm!
    but now what?
    I'm trying to add user(sip client)
    Main- SystemSIP- Admin- MenuSubscriber -ServicesSubscriber -List
    user name :102
    password : 102
    domain :10.0.0.0/24

    but it doesn't connect
    the cpmputer is 10.0.0.99/24 (using zoiper and even Express talk)
    the kamailio is 10.0.0.71/24
    what is the problem?

    ReplyDelete
    Replies
    1. Kamailio Server stop his service after starting the Centos 7. also it didn't run on backend for which we can't connect the server to the ZOIPER or any other softphone.any solution for that?

      Delete

  15. thanks, it was the best tutorial seen on the web. Now I will search for pyfreebilling.

    Cheers
    chile

    ReplyDelete