<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](http://www.kamailio.org/pub/kamailio/latest/src/kamailio-3.1.2_src.tar.gz)

or type wget http://www.kamailio.org/pub/kamailio/latest/src/kamailio-3.1.2_src.tar.gz

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 :

<br></br>
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


DBENGINE=MYSQL```

  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 :

`KAM=/usr/local/sbin/kamailio`

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](http://siremis.asipto.com/pub/downloads/siremis/siremis-3.2.0.tgz "Siremis 3.2.0")

1. cd /usr/local/src  
 2. wget http://siremis.asipto.com/pub/downloads/siremis/siremis-3.2.0.tgz  
 3.tar -zxvf siremis-2.0.0.tgz  
 4.mv siremis-2.0.0 /var/www/html/siremis  
 5.cd /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 :  
 siremis/log  
 siremis/session  
 siremis/files  
 siremis/themes/default/template/cpl  
 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”,  
 “src_user=$fU;src_domain=$fd;dst_user=$rU;dst_domain=$rd;src_ip=$si”)

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 call_cdr.sh  
 mysql -h ‘localhost’ -u root –p’password ’databasename -e “call kamailio_cdrs()”

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

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

Create module parameters :  
 modparam(“rtimer”, “timer”, “name=cdr;interval=300;mode=1;”)  
 modparam(“rtimer”, “exec”, “timer=cdr;route=CDR”)  
 modparam(“sqlops”,”sqlcon”,  
 “cd=>mysql://openser:openserrw@localhost/openser”)

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 “mi_datagram.so” in kamailio.cfg  
 2. pass module parameter to listen to udp port :  
 modparam(“mi_datagram”, “socket_name”, “udp:127.0.0.1:8033”)  
 Save and restart kamailio.  
 You can configure the available commands at :  
 siremis/modules/ser/service/siremisMICommands.xml

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

Edit kamailio.cfg to add this :

loadmodule “rtimer.so”  
 loadmodule “sqlops.so”  
 loadmodule “cfgutils.so”  
 …  
 modparam(“rtimer”, “timer”, “name=tst;interval=300;mode=1;”)  
 modparam(“rtimer”, “exec”, “timer=tst;route=STATS”)  
 modparam(“sqlops”,”sqlcon”,  
 “ca=>mysql://openser:openserrw@localhost/openser”)  
 …  
 route[STATS] {  
 sql_query(“ca”,  
 “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,”  
 “$stat(used_size),$stat(real_used_size),$stat(max_used_size),”  
 “$stat(free_size),$stat(location-users),$stat(location-contacts))”,  
 “ra”);

**Restart kamailio and you are done.**

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

Thank you