OS : Rocky Linux 8.x
SIP Solution : kamailio (https://www.kamailio.org/w/)
Kamailio SIP Server Website : siremis (https://kb.asipto.com/siremis:index)
Topology
mobile phone =>4G---->Internet--->Firewall--->NAT-->rtpproxy/kamailio
===========================
[root@rocky8 src]# yum info kamailio.x86_64
Last metadata expiration check: 0:08:20 ago on Sun 18 Dec 2022 01:52:43 PM CST.
Installed Packages
Name : kamailio
Version : 5.6.2
Release : 0.el8.centos
Architecture : x86_64
Size : 30 M
Source : kamailio-5.6.2-0.el8.centos.src.rpm
Repository : @System
From repo : kamailio
Summary : Kamailio - the Open Source SIP Server
URL : http://kamailio.org/
License : GPL-2.0
Description : Kamailio is an Open Source SIP Server released under GPL, able
: to handle thousands of call setups per second. Among features: asynchronous TCP,
: UDP and SCTP, secure communication via TLS for VoIP (voice, video); IPv4 and
: IPv6; SIMPLE instant messaging and presence with embedded XCAP server and MSRP
: relay; ENUM; DID and least cost routing; load balancing; routing fail-over;
: accounting, authentication and authorization; support for many backend systems
: such as MySQL, Postgres, Oracle, Radius, LDAP, Redis, Cassandra; XMLRPC control
: interface, SNMP monitoring. It can be used to build large VoIP servicing
: platforms or to scale up SIP-to-PSTN gateways, PBX systems or media servers
: like Asterisk™, FreeSWITCH™ or SEMS.
[root@rocky8 src]#
yum install kamailio kamailio-mysql kamailio-presence kamailio-ldap kamailio-debuginfo kamailio-xmpp kamailio-unixodbc kamailio-utils kamailio-gzcompress kamailio-tls kamailio-outbound
[root@rocky8 etc]# kamdbctl create
MySQL password for root:
INFO: test server charset
INFO: creating database kamailio ...
INFO: granting privileges to database kamailio ...
INFO: creating standard tables into kamailio ...
INFO: Core Kamailio tables successfully created.
Create the presence related tables? (y/n): y
INFO: creating presence tables into kamailio ...
INFO: Presence tables successfully created.
Create the tables for imc cpl siptrace domainpolicy carrierroute
drouting userblocklist htable purple uac pipelimit mtree sca mohqueue
rtpproxy rtpengine secfilter? (y/n): y
INFO: creating extra tables into kamailio ...
INFO: Extra tables successfully created.
Create the tables for uid_auth_db uid_avp_db uid_domain uid_gflags
uid_uri_db? (y/n): y
INFO: creating uid tables into kamailio ...
INFO: UID tables successfully created.
[root@rocky8 etc]#
[root@rocky8 kamailio]# pwd
/etc/kamailio
[root@rocky8 kamailio]# ls -la
total 72
drwxr-xr-x 2 kamailio kamailio 108 Dec 18 11:55 .
drwxr-xr-x. 166 root root 12288 Dec 18 08:41 ..
-rw-r--r-- 1 root root 1745 Oct 9 16:22 dictionary.kamailio
-rw-r--r-- 1 root root 26182 Dec 18 10:44 kamailio.cfg
-rw-r--r-- 1 root root 4280 Oct 21 22:02 kamctlrc
-rw-r--r-- 1 root root 10594 Oct 9 16:22 pi_framework.xml
-rw-r--r-- 1 root root 3343 Oct 9 16:22 tls.cfg
[root@rocky8 kamailio]# vi /etc/kamailio/kamailio.cfg
kamailio.cfg
#!KAMAILIO
#! define WITH_MYSQL
#! define WITH_AUTH
#! define WITH_USRLOCDB
#! define WITH_NAT
log_facility=LOG_LOCAL0
/* listen sockets - if none set, Kamailio binds to all local IP addresses
* - basic prototype (full prototype can be found in Wiki - Core Cookbook):
* listen=[proto]:[localip]:[lport] advertise [publicip]:[pport]
* - it can be set many times to add more sockets to listen to */
# listen=udp:10.0.0.10:5060
listen=udp:192.168.100.160:5060 advertise 114.35.xxx.xxx:5060
# ----- rtpproxy params -----
modparam("rtpproxy", "rtpproxy_sock", "udp:127.0.0.1:7722")
####### Routing Logic ########
/* Main SIP request routing logic
* - processing of any incoming SIP request starts with this route
* - note: this is the same as route { ... } */
request_route {
add_local_rport();
================
[root@rocky8 kamailio]# vi /etc/kamailio/kamctlrc
kamctlrc
## the SIP domain
# SIP_DOMAIN=kamailio.org
SIP_DOMAIN=114.35.XXX.XXX
## 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
## 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"
======================
vi /etc/rsyslog.conf
local0.* /var/log/kamailio.log
==================
credit id & pwd :
kamctl add id pwd
example
kamctl add 1234 1234
Topology
SIP ---->Internet--->Firewall (FortiGate)--->NAT-->SIP Gateway
https://community.fortinet.com/t5/FortiGate/Technical-Tip-FortiGate-Hosted-NAT-Traversal-for-SIP/ta-p/197508
config voip profile
edit "SIP-HNT"
config sip
set hosted-nat-traversal enable
set status enable
set rtp enable