微信搜索superit|邀请体验:大数据, 数据管理、OLAP分析与可视化平台 | 赞助作者:赞助作者

kamailio的安装

架构 aide_941 2℃ 0评论

 


这个可以:

kamailio/misc/examples/webrtc/websocket.cfg at master · kamailio/kamailio · GitHub

kamailio/kamailio.cfg at main · xsdhy/kamailio · GitHub
https://cn.linux-console.net/?p=22074#google_vignette
https://deb.kamailio.org/#stable58

wget -O- http://deb.kamailio.org/kamailiodebkey.gpg | sudo apt-key add –

sudo tee /etc/apt/sources.list.d/kamailio.list<<EOF
deb http://deb.kamailio.org/kamailio57 jammy main
deb-src http://deb.kamailio.org/kamailio57 jammy main
EOF

apt-get update
apt-get install -y libjsonrpccpp libjsonrpccpp-dev
apt-get install -y kamailio kamcli kamailio-lua-modules kamailio-outbound-modules kamailio-websocket-modules kamailio-tls-modules kamailio-utils-modules kamailio-json-modules

 

 

kamailio.cfg:

#!KAMAILIO

mpath="/usr/lib/x86_64-linux-gnu/kamailio/modules/"
####### Global Parameters #########

debug=2
log_stderror=yes
fork=no
children=2

memdbg=5
memlog=5

auto_aliases=no

listen=udp:0.0.0.0:5060;
#listen=tls:0.0.0.0:5062;
listen=tcp:0.0.0.0:5062;

tcp_accept_no_cl=yes
enable_tls=false

#!define FLT_NATS 5
#!define FLB_NATB 6
#!define FLB_NATSIPPING 7

loadmodule "jsonrpcs.so"
loadmodule "kex.so"
loadmodule "tm.so"
loadmodule "tmx.so"
loadmodule "sl.so"
loadmodule "pv.so"
loadmodule "maxfwd.so"
loadmodule "textops.so"
loadmodule "xlog.so"
loadmodule "ctl.so"
loadmodule "debugger.so"
loadmodule "siputils.so"
loadmodule "app_lua.so"

loadmodule "usrloc.so"
loadmodule "registrar.so"

#path依赖
loadmodule "rr.so"
loadmodule "path.so"

loadmodule "dispatcher.so"

loadmodule "outbound.so"
loadmodule "nathelper.so"

loadmodule "websocket.so"
loadmodule "xhttp.so"

loadmodule "auth.so"
loadmodule "http_client.so"

#loadmodule "tls.so"
#modparam("tls", "tls_method", "SSLv23")
#modparam("tls", "verify_certificate", 0)
#modparam("tls", "require_certificate", 0)
#modparam("tls", "private_key", "/etc/kamailio/domain.key")
#modparam("tls", "certificate", "/etc/kamailio/domain.pem")

# ----------------- setting module-specific parameters ---------------

# ----- jsonrpcs params -----
modparam("jsonrpcs", "pretty_format", 1)

# ----- tm params -----
# auto-discard branches from previous serial forking leg
modparam("tm", "failure_reply_mode", 3)
# default retransmission timeout: 30sec
modparam("tm", "fr_timer", 30000)
# default invite retransmission timeout after 1xx: 120sec
modparam("tm", "fr_inv_timer", 120000)

modparam("path","use_received",1)

# ----- debugger params -----
modparam("debugger", "cfgtrace", 1)

modparam("nathelper", "ping_nated_only", 0)
modparam("nathelper", "natping_interval", 5)
modparam("nathelper", "sipping_from", "sip:pinger@ws.sip.xsdhy.com")
modparam("nathelper", "received_avp", "$avp(received_avp)")
modparam("nathelper", "keepalive_timeout", 120)

modparam("registrar", "received_avp", "$avp(received_avp)")

modparam("usrloc", "db_mode", 0)
modparam("usrloc", "preload", "location")

modparam("rr", "enable_double_rr", 0)

modparam("xhttp","event_callback","ksr_xhttp_event")

modparam("app_lua", "load", "/etc/kamailio/r.lua")
cfgengine "lua"

r.lua



function ksr_request_route()
    KSR.info("=====>>>>>>>router-request: " .. KSR.pv.gete('$rm').. " from ip:".. KSR.pv.gete("$si") ..  " du:".. KSR.pv.gete("$du") .." has_totag:".. KSR.siputils.has_totag() .."\n");
    KSR.tm.t_relay()
end

function ksr_xhttp_event(evname)
    KSR.info("=====xhttp module triggered event: " .. evname .. "\n")
    KSR.set_reply_close()
    KSR.set_reply_no_connect()

    local upgrade = KSR.hdr.get("Upgrade")
    if upgrade == "websocket" then
        if KSR.websocket.handle_handshake() > 0 then
            KSR.info("handshak ok \n")
        else
            KSR.err("handshake err \n")
        end
        return 1
    end
    KSR.xhttp.xhttp_reply("404","Not Found","text/plain","Not Found")
    return 1
end

 

 

 

/usr/sbin/kamailio -P /var/run/kamailio.pid -f /etc/kamailio/kamailio.cfg

 

kamctl stats

 

!/bin/bash

更新系统并安装必要的软件包

sudo apt-get update
sudo apt-get install -y git build-essential libmariadbclient-dev libssl-dev libpcre3-dev libcurl4-openssl-dev

安装Kamailio

cd /usr/src
sudo git clone https://github.com/kamailio/kamailio.git
cd kamailio
sudo make
sudo make install

安装Kamailio模块

sudo make install-modules

安装Kamailio数据库插件

sudo make install-db-mysql

安装Kamailio Web管理界面

cd /usr/src
sudo git clone https://github.com/kamailio/kamctl.git
cd kamctl
sudo make
sudo make install

初始化数据库并配置Kamailio

mysql -u root -e "CREATE DATABASE kamailio DEFAULT CHARACTER SET utf8;"
mysql kamailio < /usr/local/src/kamailio/kamailio-mysql.sql

配置Kamailio

sudo cp /usr/src/kamailio/kamailio.cfg /etc/kamailio/kamailio.cfg

启动Kamailio服务

sudo systemctl start kamailio
sudo systemctl enable kamailio

配置Web界面

sudo kamctl create_token
sudo kamctl setup_db mysql root

访问Kamailio Web管理界面

echo "Kamailio Web管理界面可以通过浏览器访问 http://your_server_ip:5000"

sudo apt-update
apt install git

sudo apt-get install -y build-essential autoconf libtool pkg-config libssl-dev libmysqlclient-dev libreadline-dev libspeex-dev libspeexdsp-dev libogg-dev libcurl4-openssl-dev libxml2-dev libpcre3-dev libncurses5-dev libgtk2.0-dev libglib2.0-dev libavformat-dev libavcodec-dev libswscale-dev libtiff5-dev libjpeg-dev libpng-dev libtiff-dev libsndfile1-dev libsqlite3-dev libglib2.0-dev libidn11-dev libpq-dev

apt-get update
apt-get install -y kamailio kamailio-lua-modules kamailio-outbound-modules kamailio-websocket-modules kamailio-tls-modules kamailio-utils-modules

wget https://github.com/kamailio/kamailio/archive/v5.8.0.tar.gz
tar -xvzf v5.8.0.tar.gz

cd kamailio-5.8.0/
./bootstrap.sh
./configure –prefix=/usr –sysconfdir=/etc –localstatedir=/var –enable-mysql –enable-postgresql –enable-mysql –enable-sqlite –enable-ldap –enable-xml_rpc –enable-tls –enable-b64_auth –enable-db_hash –enable-db_radius –enable-db_textops –enable-db_extra –enable-db_uri –enable-presence –enable-dialog –enable-sip_nat –enable-sip_stun –enable-sip_redirect –enable-sip_rewrite –enable-sip_auth –enable-sip_auth_pw –enable-sip_refer –enable-sip_route –enable-sip_proxy –enable-sip_invite –enable-sip_subscribe –enable-sip_notify –enable-sip_info –enable-sip_prack –enable-sip_update –enable-sip_measure –enable-sip_frag –enable-sip_timer –enable-sip_100rel –enable-sip_history –enable-sip_extra –enable-sip_nat_extra –enable-sip_dialog_extra –enable-sip_dialog_extra_m –enable-sip_dialog_extra_s –enable-sip_dialog_extra_p –enable-sip_dialog_extra_t –enable-sip_dialog_extra_r –enable-sip_dialog_extra_d –enable-sip_dialog_extra_h –enable-sip_dialog_extra_u –enable-sip_dialog_extra_c –enable-sip_dialog_extra_x –enable-sip_dialog_extra_y –enable-sip_dialog_extra_z –enable-sip_dialog_extra_a –enable-sip_dialog_extra_b –enable-sip_dialog_extra_v –enable-sip_dialog_extra_i –enable-sip_dialog_extra_j –enable-sip_dialog_extra_k –enable-sip_dialog_extra_l –enable-sip_dialog_extra_o –enable-sip_dialog_extra_w –enable-sip_dialog_extra_q –enable-sip_dialog_extra_n –enable-sip_dialog_extra_p –enable-sip_dialog_extra_g –enable-sip_dialog_extra_e –enable-sip_dialog_extra_f –enable-sip_dialog_extra_z –enable-sip_dialog_extra_h –enable-sip_dialog_extra_i –enable-sip_dialog_extra_j –enable-sip_dialog_extra_k –enable-sip_dialog_extra_l –enable-sip_dialog_extra_m –enable-sip_dialog_extra_o –enable-sip_dialog_extra_p


add-apt-repository ppa:maxmind/ppa
apt update
apt install libgeoip1 libgeoip-dev geoip-bin

apt install sqlite3 libsqlite3-dev
apt install libunistring-dev db_sqlite db_sqlite-dev
apt install liblua5.3-dev centos lua-devel
apt-get install –reinstall build-essential

https://github.com/kamailio/kamailio/blob/master/misc/examples/webrtc/websocket.cfg

https://segmentfault.com/a/1190000044249766
https://blog.csdn.net/qq_56167818/article/details/140351464

git clone https://github.com/kamailio/kamailio kamailio
cd kamailio

make PREFIX="/usr/local/kamailio" include_modules="db_sqlite http_client http_async_client jansson tls uuid utils app_lua geoip2 websocket" cfg

make PREFIX="/usr/local/kamailio" include_modules="http_client tls uuid utils app_lua websocket outbound jsonrpcs jsonrpcc kex tm tmx sl pv maxfwd textops xlog ctl debugger siputils usrloc registrar rr path dispatcher nathelper xhttp auth " cfg && make all
make install
ln -sf /usr/local/etc/kamailio /etc/kamailio

默认会安装到 /usr/local/etc/kamailio文件下

[Unit]
Description=Kamailio SIP server
After=network.target

[Service]
Type=simple
ExecStart=/usr/local/sbin/kamailio -P /var/run/kamailio.pid -f /etc/kamailio/kamailio.cfg
Restart=on-failure

[Install]
WantedBy=multi-user.target

原文链接:https://blog.csdn.net/crayonChen04/article/details/134729066

要从命令行直接执行相应的二进制文件,请确保/usr/local/kamailio/sbin路径被设置在环境变量中。你可能通过命令echo $PATH检查一下。如果没有,可以使用bash,编辑/root/.bash_profile文件,添加以下两行:

PATH=$PATH:/usr/local/kamailio/sbin

export PATH

Kamailio 模块文件被安装在以下目录中:

/usr/local/kamailio/lib64/kamailio/modules/

相关文档和readme文件被安装在:

/usr/local/kamailio/share/doc/kamailio/

帮助手册被安装在:

/usr/local/kamailio/share/man/man5/

/usr/local/kamailio/share/man/man8/

配置文件的安装位置是:

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

https://blog.csdn.net/yetyongjin/article/details/8106997


wget https://luarocks.org/releases/luarocks-3.11.1.tar.gz
$ tar zxpf luarocks-3.11.1.tar.gz
$ cd luarocks-3.11.1
$ ./configure && make && sudo make install
$ sudo luarocks install luasocket
$ lua
Lua 5.3.5 Copyright (C) 1994-2018 Lua.org, PUC-Rio

require "socket"

转载请注明:SuperIT » kamailio的安装

喜欢 (0)or分享 (0)

您必须 登录 才能发表评论!