Skip to content

A-big-fish-in-a-small-pond/kamailio-config

Repository files navigation

kamailio config

What is Kamailio

Kamailio® (successor of former OpenSER and SER) is an Open Source SIP Server released under GPLv2+, able to handle thousands of call setups per second. Kamailio can be used to build large platforms for VoIP and realtime communications – presence, WebRTC, Instant messaging and other applications. Moreover, it can be easily used for scaling up SIP-to-PSTN gateways, PBX systems or media servers like Asterisk™, FreeSWITCH™ or SEMS.


how to install kamailio

  1. update apt
$ sudo apt update
  1. install mariadb-server
$ apt-get install gnupg2 mariadb-server curl unzip -y
  1. add apt-key
$ wget -O- http://deb.kamailio.org/kamailiodebkey.gpg | sudo apt-key add -
  1. update kamailio version
$ sudo tee /etc/apt/sources.list.d/kamailio.list<<EOF
deb     http://deb.kamailio.org/kamailio55 focal main
deb-src http://deb.kamailio.org/kamailio55 focal main
EOF
  1. update apt
$ sudo apt update
  1. install kamilio
$ sudo apt update
$ sudo apt-get install kamailio*
$ sudo apt-get install kamailio kamailio-mysql-modules kamailio-websocket-modules kamailio-tls-modules -y
  1. set root password
$ mysql
$ use mysql;
$ set password=password('root');
$ exit
  1. create database
$ vi  /etc/kamailio/kamctlrc

edit your DOMAIN

## the SIP domain
SIP_DOMAIN=202.30.249.27

## chrooted directory
# CHROOT_DIR="/path/to/chrooted/directory"

## database type: MYSQL, PGSQL, ORACLE, DB_BERKELEY, DBTEXT, or SQLITE
## by default none is loaded
##
## If you want to setup a database with kamdbctl, you must at least specify
## this parameter.
DBENGINE=MYSQL

## database host
DBHOST=localhost

## database port
DBPORT=3306

create database

$ kamdbctl create

how to install siremis

  1. install lib
$ apt-get install apache2 php libapache2-mod-php php-mysql php-gd php-curl php-xml php-pear php-xmlrpc make git -y
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt-get update
$ sudo apt install php7.4 php7.4-common php7.4-cli libapache2-mod-php7.4
$ sudo apt install php7.4-bcmath php7.4-bz2 php7.4-curl php7.4-intl php7.4-mbstring php7.4-mysql php7.4-readline php7.4-xml php7.4-zip php7.4-gd php7.4-memcached php7.4-redis php7.4-xmlrpc
  1. put and execute
$ pear install XML_RPC2

$ cd /var/www/
$ git clone https://github.com/asipto/siremis

$ cd siremis
$ make apache24-conf | tee /etc/apache2/sites-enabled/siremis.conf

$ make prepare24
$ make chown
  1. set siremis user in mysql
$ mysql
$ use mysql;

$ GRANT ALL PRIVILEGES ON siremis.* TO siremis@localhost IDENTIFIED BY 'siremisrw';
$ flush privileges;

$ exit;
  1. execute
$ a2enmod rewrite
$ systemctl restart apache2

# next line is disable on php8.1
$ sudo a2dismod php8.1
$ sudo a2enmod php7.4

how to install nodejs

  1. execute
$ curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -

$ sudo apt install nodejs
$ sudo apt install build-essential

how to change logging in kamailio

$ chmod 777 /var/log/kamailio.log

$ vi /lib/systemd/system/kamailio.service
$ vi /etc/rsyslog.conf

$ service rsyslog restart

setting kamailio-cfg

  1. edit your address
$ vi kamailio-local.cfg
  1. set your kamailio's routing tables (Loadbalance)
$ vi settings/dispatcher.list

# gateways 
1 sip:123.123.123.123:5060  # insert your group
# 1 sip:daum.net:5060  # insert your group
# 1 sip:kakao.com:5060  # insert your group

# gateways
2 sip:202.30.241.33:5070 # insert your group
# 2 sip:202.30.242.33:5070 # insert your group
# 2 sip:202.30.243.33:5070 # insert your group
$ vi settings/help.json

# this is comment    
# INBOUND: OUTBOUND
# default port is 5060

{
    "123.123.123.123": "202.30.241.33:5070",
    "202.30.241.33:5070": "123.123.123.123"
}

References

  1. Kamailio Module Page
  2. Kamailio Core Page
  3. Kamilio PseudoVariables Page

Contact

Junho Kim
JongSun Park


HomePage

Github © Page