Kamailio: Konfigurasi Awal di OpenWRT: Difference between revisions

From OnnoCenterWiki
Jump to navigationJump to search
Onnowpurbo (talk | contribs)
New page: 7. Create MySQL database To create the MySQL database, you have to use the database setup script. First edit kamctlrc file to set the database server type: nano -w /usr/local/etc/kamail...
 
Onnowpurbo (talk | contribs)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
7. Create MySQL database
==Buat Database MySQL==


To create the MySQL database, you have to use the database setup script. First edit kamctlrc file to set the database server type:
Edit


  nano -w /usr/local/etc/kamailio/kamctlrc
cd /etc/kamailio/
  nano -w /etc/kamailio/kamctlrc


Locate DBENGINE variable and set it to MYSQL:
Ubah


  DBENGINE=MYSQL
  DBENGINE=SQLITE
DB_PATH="/etc/kamailio/sqlite"


You can change other values in kamctlrc file, at least it is recommended to change the default passwords for the users to be created to connect to database.
Setelah kamctlrc di ubah, jalankan


Once you are done updating kamctlrc file, run the script to create the database used by Kamailio:
  kamdbctl create kamailio.db
 
  /usr/local/sbin/kamdbctl create


You can call this script without any parameter to get some help for the usage. You will be asked for the domain name Kamailio is going to serve (e.g., mysipserver.com) and the password of the 'root' MySQL user. The script will create a database named 'kamailio' containing the tables required by Kamailio. You can change the default settings in the kamctlrc file mentioned above.
You can call this script without any parameter to get some help for the usage. You will be asked for the domain name Kamailio is going to serve (e.g., mysipserver.com) and the password of the 'root' MySQL user. The script will create a database named 'kamailio' containing the tables required by Kamailio. You can change the default settings in the kamctlrc file mentioned above.


The script will add two users in MySQL:
Script ini akan membuat dua user di MySQL:


* kamailio - (with default password 'kamailiorw') - user which has full access rights to 'kamailio' database
* kamailio - (dengan default password 'kamailiorw') - user which has full access rights to 'kamailio' database
* kamailioro - (with default password 'kamailioro') - user which has read-only access rights to 'kamailio' database
* kamailioro - (dengan default password 'kamailioro') - user which has read-only access rights to 'kamailio' database


Do change the passwords for these two users to something different that the default values that come with sources.
Do change the passwords for these two users to something different that the default values that come with sources.


8. Edit configuration file
==Edit file konfigurasi==
 


To fit your requirements for the VoIP platform, you have to edit the configuration file.
To fit your requirements for the VoIP platform, you have to edit the configuration file.


  /usr/local/etc/kamailio/kamailio.cfg
  vi /etc/kamailio/kamailio.cfg


Follow the instruction in the comments to enable usage of MySQL. Basically you have to add several lines at the top of config file, like:
Aktifkan penggunaan MySQL. Paling tidak kita perlu menambahkan dibagian atas config file, seperti:
 
# use sqlite database                                                       
loadmodule "db_sqlite.so" 
 
#!ifndef DBURL                                                             
#!define DBURL "sqlite:///etc/kamailio/kamailio.db"                           
#!endif 


#!define WITH_MYSQL
#!define WITH_AUTH
#!define WITH_USRLOCDB


If you changed the password for the 'kamailio' user of MySQL, you have to update the value for 'db_url' parameters.
If you changed the password for the 'kamailio' user of MySQL, you have to update the value for 'db_url' parameters.
Line 40: Line 45:
You can browse kamailio.cfg online on GIT repository.
You can browse kamailio.cfg online on GIT repository.


9. The init.d script
The init.d script can be used to start/stop the Kamailio server in a nicer way. A sample of init.d script for Kamailio is provided at:
/usr/local/src/kamailio-4.2/kamailio/pkg/kamailio/deb/debian/kamailio.init


Just copy the init file into the /etc/init.d/kamailio. Then change the permisions:
==Edit /etc/default==


  cp /usr/local/src/kamailio-4.2/kamailio/pkg/kamailio/deb/debian/kamailio.init /etc/init.d/kamailio
  vi vi /etc/default/kamailio  
  chmod 755 /etc/init.d/kamailio  


then edit the file updating the $DAEMON and $CFGFILE values:
Ubah


  DAEMON=/usr/local/sbin/kamailio
  RUN_KAMAILIO=yes
CFGFILE=/usr/local/etc/kamailio/kamailio.cfg


You need also setup a configuration file in the /etc/default/ directory. This file can be found at:
==Menjalankan Kamailio==
 
/usr/local/src/kamailio-4.2/kamailio/pkg/kamailio/deb/debian/kamailio.default
 
You need to rename the file to 'kamailio' after you've copied it. Then edit this file and set RUN_KAMAILIO=yes. Edit the other options at your convenience.
 
Create the directory for pid file:
 
mkdir -p /var/run/kamailio
 
Default setting is to run Kamailio as user “kamailio” and group “kamailio”. For that you need to create the user:
 
adduser --quiet --system --group --disabled-password \
        --shell /bin/false --gecos "Kamailio" \
        --home /var/run/kamailio kamailio
# set ownership to /var/run/kamailio
chown kamailio:kamailio /var/run/kamailio
 
Then you can start/stop Kamailio using the following commands:


   /etc/init.d/kamailio start
   /etc/init.d/kamailio start
   /etc/init.d/kamailio stop
   /etc/init.d/kamailio stop


10. Ready to rock


Now everything is in place. You can start the VoIP service, creating new accounts and setting the phones.
==Menambahkan user==


A new account can be added using 'kamctl' tool via 'kamctl add <username> <password> <email>'. (or try without the email)
kamctl add <username> <password> <email>
 
seperti


  kamctl add test testpasswd test@mysipserver.com
  kamctl add test testpasswd test@mysipserver.com


If you are asked for SIP_DOMAIN environment variable do one of the following option.
Atau tanpa e-mail
 
  1.
  export SIP_DOMAIN=mysipserver.com
 
  2.
  edit '/root/.kamctlrc' and add:
  SIP_DOMAIN=mysipserver.com
 
 
 


==Referensi==
==Referensi==


* http://www.kamailio.org/wiki/install/4.2.x/git
* http://www.kamailio.org/wiki/install/4.2.x/git

Latest revision as of 23:07, 29 December 2014

Buat Database MySQL

Edit

cd /etc/kamailio/
nano -w /etc/kamailio/kamctlrc

Ubah

DBENGINE=SQLITE
DB_PATH="/etc/kamailio/sqlite"

Setelah kamctlrc di ubah, jalankan

kamdbctl create kamailio.db

You can call this script without any parameter to get some help for the usage. You will be asked for the domain name Kamailio is going to serve (e.g., mysipserver.com) and the password of the 'root' MySQL user. The script will create a database named 'kamailio' containing the tables required by Kamailio. You can change the default settings in the kamctlrc file mentioned above.

Script ini akan membuat dua user di MySQL:

  • kamailio - (dengan default password 'kamailiorw') - user which has full access rights to 'kamailio' database
  • kamailioro - (dengan default password 'kamailioro') - user which has read-only access rights to 'kamailio' database

Do change the passwords for these two users to something different that the default values that come with sources.

Edit file konfigurasi

To fit your requirements for the VoIP platform, you have to edit the configuration file.

vi /etc/kamailio/kamailio.cfg

Aktifkan penggunaan MySQL. Paling tidak kita perlu menambahkan dibagian atas config file, seperti:

# use sqlite database                                                        
loadmodule "db_sqlite.so"  
#!ifndef DBURL                                                               
#!define DBURL "sqlite:///etc/kamailio/kamailio.db"                            
#!endif  


If you changed the password for the 'kamailio' user of MySQL, you have to update the value for 'db_url' parameters.

You can browse kamailio.cfg online on GIT repository.


Edit /etc/default

vi  vi /etc/default/kamailio 

Ubah

RUN_KAMAILIO=yes

Menjalankan Kamailio

 /etc/init.d/kamailio start
 /etc/init.d/kamailio stop


Menambahkan user

kamctl add <username> <password> <email>

seperti

kamctl add test testpasswd test@mysipserver.com

Atau tanpa e-mail

Referensi