1. 程式人生 > >Build and config Kamailio 5.0.3 integrate MySQL database

Build and config Kamailio 5.0.3 integrate MySQL database

I usually work with VoIP system and integrate it with SDK support communication platform.  Kamailio is very powerful asynchronous TCP, UDP and SCTP secure communication via TLS, support some advance features load balancing, routing fail-over, accouting, authentication and authorization. Kamailio is one of the best performance flatform VoIP, so i choose Kamailio to build VoIP system and integrate with our AZStack SDK.

Some main features is supported by Kamailio

  • Registrar server
  • Location server
  • Proxy server
  • SIP application server
  • Redirect server

Do not support by Kamailio

  • Sip phone.
  • Media server

I will have some chapters about Kamailio as build, config,  run and demo with SIP client (softphone). In the post, i focus guide step by step to build Kamailio from source and deploy over network. Ok let begin

Step 1 : You have to install mysql on server, you can reference how to install MySQl the latest version at post 

Step 2 : Install prerequisite tool

apt-get install flex gcc bison libmysqlclient-dev make libssl-dev libcurl4-openssl-dev libxml2-dev libpcre3-dev

Step 3 : Download and extract Kamailio the latest version

wget https://www.kamailio.org/pub/kamailio/latest/src/kamailio-5.0.3_src.tar.gz tar -xvf kamailio-5.0.3_src.tar.gz

Step 4 : Build  source

mkdir /data/kamailio make prefix=/data/kamailio/ include_modules="db_mysql dialplan" cfg make all make install

Step 5 : Setup database connection to MySQL

vi /data/kamailio/etc/kamctlrc

Edit some of configurations as follows

## your SIP domain SIP_DOMAIN=docker.azstack.com

## database type: MYSQL, PGSQL, ORACLE, DB_BERKELEY, DBTEXT, or SQLITE DBENGINE=MYSQL

## database host DBHOST=localhost

## database host DBPORT=3306

## database name (for ORACLE this is TNS name) DBNAME=kamailio

# database path used by dbtext, db_berkeley or sqlite # DB_PATH="/usr/local/etc/kamailio/dbtext"

## database read/write user DBRWUSER="kamailio"

## password for database read/write user DBRWPW="kamailiorw"

## database read only user DBROUSER="kamailioro"

## password for database read only user DBROPW="kamailioro"

Step 6 : Setup alias and port for run service

vi /data/kamailio/etc/kamailio/kamailio.cfg

edit content

alias="docker.azstack.com" port=5060

Step 7 : Init setup database

/data/kamailio/sbin/kamdbctl create

Please enter your password to authentication MySQL server, Kamailio will auto create database to work. If you have some errors please check status MySQL database.

Step 8 : Start Kamailio and check result

/data/kamailio/sbin/kamctl start

start

check server be listening on port 5060

netstat -apn | grep 5060

listen

It ok! in the next post i will guide how to create user and use SIP-Phone connect Kamailio to Call and message. See you next time!

Advertisements

Like this:

Like Loading...