Kamailio installation on Debian 11 - Omid-Mohajerani/Learn-Kamailio GitHub Wiki
wget -O- https://deb.kamailio.org/kamailiodebkey.gpg | sudo apt-key add -
vim /etc/apt/sources.list
deb http://deb.kamailio.org/kamailio56 bullseye main
deb-src http://deb.kamailio.org/kamailio56 bullseye main
Kamailio Installation:
apt update
apt -y install default-mysql-server
apt -y install kamailio kamailio-mysql-modules
Check Kamailio Module: To check all kamailio Module use this command
apt search kamailio
For example to install kamailio websocket:
apt install kamailio-websocket-modules
Configuration files are located in /etc/kamailio/ folder.
vim /etc/kamailio/kamctlrc
Change SIP_DOMAIN to your server IP Address
SIP_DOMAIN=45.76.93.47
Change DB Engine to MYSQL
DBENGINE=MYSQL
Set DB Password
DBRWPW="kamailiorw"
vim /etc/kamailio/kamailio.cfg
To enable use of MySQL server backend, user authentication and persistent user location, add after the first line:
#!define WITH_MYSQL
#!define WITH_AUTH
#!define WITH_USRLOCDB
To create the database structure needed by Kamailio, run:
kamdbctl create
If you changed the value of DBRWPW in kamctlrc, you must update the value of DBURL define inside kamailio.cfg.
#!define DBURL "mysql://kamailio:_NEW_DBRWPW_@localhost/kamailio"
Adding Subscribers To add subscribers (users), you can use the kamctl command:
kamctl add userid password
Like:
kamctl add omid DFcfs238r4f5
Start Kamailio Service
systemctl start kamailio
Check if the sip endpoint is registered using kamcmd (ul stands for user location)
kamcmd ul.dump
Output sample:
{
Domains: {
Domain: {
Domain: location
Size: 1024
AoRs: {
Info: {
AoR: user1
HashID: 2079352211
Contacts: {
Contact: {
Address: sip:[email protected]:3060;transport=UDP;rinstance=7fc89443da2ba7bf
Expires: 26
Q: -1.000000
Call-ID: QWyAGN07aLEr0ljd5FwT7g..
CSeq: 5
User-Agent: Z 5.5.13 v2.10.18.3
Received: [not set]
Path: [not set]
State: CS_SYNC
Flags: 0
CFlags: 0
Socket: udp:95.179.251.147:5060
Methods: 5087
Ruid: uloc-63a84790-e7bd-1
Instance: [not set]
Reg-Id: 0
Server-Id: 0
Tcpconn-Id: -1
Keepalive: 0
Last-Keepalive: 1671973038
KA-Roundtrip: 0
Last-Modified: 1671973038
}
}
}
}
Stats: {
Records: 1
Max-Slots: 1
}
}
}
}
source : https://kamailio.org/docs/tutorials/devel/kamailio-install-guide-deb/