Install kamailio from source Centos

<strong>Dependencies :</strong><br></br>
Yum install bison pcre-devel libpcap-devel```

**Installation :**  
 1. Go to /usr/local/src/  
 2. Download The latest version of kamailio 3.1.2 from source :

[Download Latest Kamailio Source Here](

or type wget

tar -zxvf kamailio-3.1.2_src.tar.gz

cd kamailio-3.1.2

make FLAVOUR=kamailio cfg```

or if you want to include extra modules which are not installed by default you can type :

make FLAVOUR=kamailio include_modules="db_mysql dialplan" cfg```

` make all<br></br>`` make install`

Now you have kamailio installed at :  
 /usr/local/etc/kamailio and you have executables at /usr/local/sbin

8. Edit kamctlrc and set the database engine type

vi /usr/local/etc/kamailio/kamctlrc


  1. Create the initial database for kamailio :

kamdbctl create

  1. copy the init scripts :
cp /usr/local/src/kamailio-3.1.2/pkg/kamailio/rpm/kamailio.init /etc/init.d/kamailio<br></br>
chmod 755 /etc/init.d/kamailio<br></br>
cp /usr/local/src/kamailio-3.1.2/pkg/kamailio/rpm/kamailio.default /etc/default/kamailio```

`vi /etc/default/kamailio `

`RUN_KAMAILIO=yes``vi /etc/init.d/kamailio `

and update :


9./usr/local/etc/kamailio/kamailio.cfg edit this file to fit your requirements.

**If you want to install a web interface for it ( SIREMIS ) follow the tutorial below : **

[Download Latest Siremis Here]( "Siremis 3.2.0")

1. cd /usr/local/src  
 2. wget  
 3.tar -zxvf siremis-2.0.0.tgz siremis-2.0.0 /var/www/html/siremis /var/www/html/siremis  
 6. make apache-conf :: this will print the snippet to be added to your apache configuration file.  
 7. vi /etc/httpd/conf/httpd.conf and append the output of above command to the bottom.  
 8. make prepare  
 9. Assign write permissions to the following directories :  
 10. Restart apache  
 11. Browse to http://yourserverip/siremis and follow the wizard for installation.  
**Important: **make sure you check update sip database.  
**Note :** default login are admin /admin and you have to have php-gd installed for captcha.

GRANT ALL PRIVILEGES ON siremis.* TO siremis@localhost IDENTIFIED BY ‘siremisrw’; ( use to create user for the web)

After successfull installation remove the install directory and install.lock file.

**Install Accounting : **  
 Add additional parameter to the module acc in kamailio.cfg as shown below :  
 modparam(“acc”, “db_extra”,  

If you selected to update db while installing siremis, you will have a stored procedure named kamailio_cdrs. You can call this procedure at intervals using cron or timer in kamailio.cfg .

**Hint :** If you want to use cron, you can just create a shell script which will do the sql query  
 eg. vi  
 mysql -h ‘localhost’ -u root –p’password ’databasename -e “call kamailio_cdrs()”

now put an entry into cron  
 crontab -e  
 5 * * * * /path/to/ 2>&1 >> /  
 This will call the stored procedure every five minute.

**Advanced option to call stored procedure kamailio_cdrs()**  
 #vi /usr/local/etc/kamailio.cfg  
 loadmodule “”  
 loadmodule “” ( load these two modules)

Create module parameters :  
 modparam(“rtimer”, “timer”, “name=cdr;interval=300;mode=1;”)  
 modparam(“rtimer”, “exec”, “timer=cdr;route=CDR”)  

and create a route block named CDR  
 route[CDR] {  
 sql_query(“cd”,“call kamailio_cdrs()”,”ra”);  

Now the timer will call the route[CDR] every 5 minute and will execute the stored procedure.

**Install Commands Panel : **  
 1. Load module : loadmodule “” in kamailio.cfg  
 2. pass module parameter to listen to udp port :  
 modparam(“mi_datagram”, “socket_name”, “udp:”)  
 Save and restart kamailio.  
 You can configure the available commands at :  

**Install Charts Panel : **  
 If you want charts you can follow the tutorial to configure that.

Edit kamailio.cfg to add this :

loadmodule “”  
 loadmodule “”  
 loadmodule “”  
 modparam(“rtimer”, “timer”, “name=tst;interval=300;mode=1;”)  
 modparam(“rtimer”, “exec”, “timer=tst;route=STATS”)  
 route[STATS] {  
 “insert into statistics (time_stamp,shm_used_size,shm_real_used_size,”  
 “shm_max_used_size,shm_free_used_size,ul_users,ul_contacts) values ($Ts,”  

**Restart kamailio and you are done.**

The chart is configured in an xml file at siremis/modules/ser/service/siremisCharts.xml

Thank you