Kamailio-SIP代理服务器单节点的安装与部署

news2024/10/6 1:40:59

使用背景:存在 Freeswitch 等语音网关应用服务,期望实现负载均衡、前置处理的功能,类似于Web应用服务的Nginx的角色

市场调研,发现了几家颇受欢迎的开源产品:

  • Kamailio
  • OpenSIPS
  • Asterisk

Kamailio和OpenSIPS由于其灵活性、高性能和强大的路由能力,在开源SIP服务器领域尤其受到欢迎。

基于以上背景,从头开始学习并了解Kamailio.

  • Kamailio 是什么?
  • 认识它,从源码安装、使用开始 5.8.x
    • 获取源码
    • 配置项目
  • 编译并安装项目
    • 配置日志输出
  • 配置MySQL数据库存储
  • 配置 kamailio.cfg 并启动
    • 后台启动服务
    • 服务校验
    • 终止服务

Kamailio 是什么?

在这里插入图片描述

Kamailio是一个:

  • SIP Server,SIP服务器
  • SIP Proxy Server,SIP代理服务器
  • SIP Registrar Server,SIP注册服务器
  • SIP Location Server,SIP地址查询服务器
  • SIP Redirection Server,SIP重定向服务器
  • SIP Application Server,SIP应用服务器
  • SIP Loadbalance Server,SIP负载均衡服务器
  • SIP WebSocket Server,SIP WebSocket服务器
  • SIP SBC Server,SIP SBC服务器

Kamailio基于GPLv2+开源协议发布,主要处理SIP协议,当你发现你的需求要对SIP报文类似于插桩、修饰的时候,你就应该想到这类产品。

Kamailio 开源项目地址,拥有2.2K的 Star, 也是不错的成绩。

当然,了解Kamailio 这个SIP服务器的前提就是,你知道什么是SIP。
很贴心的,官方还给专门写了一篇文章,作为你了解Kamailio的背景知识。这篇文章我也有学习和整理。

官方也推荐了其他的SIP知识学习网站:

  • siptutorial.net
  • tutorialspoint.com
  • voip-info.org

书籍:

  • SIP Beyond VoIP
  • Understanding the Session Initiation Protocol
  • SIP Demystified
  • Internet Communications Using SIP

认识它,从源码安装、使用开始 5.8.x

光看文章介绍,总是有点干巴巴,也有关于他的中文文档,但是看着四年多没有更新,讲的内容又很基础,我们直接就从英文文档入手吧,基础的是入门指南,想要了解更多当然要阅读CookBook-5.5.x,你还可以在这里找到其他版本的CookBook。

目前2024年最新版本是在 5.8.x,那么我们就跟着入门指南实践部署一个基于Debian(uBuntu下)单机版本源码构建Kamailio(Debian和Centos也有构建好的安装方式,可以自行选择)

  • Kamailio 5.8.2
  • MySQL 5.7(8.x不行,初始化语法不兼容),提前准备好
  • git指令
  • 一个Linux服务器

官方5.8 源码安装可参考

获取源码

创建目录

mkdir -p ~/kamailio-5.8
cd ~/kamailio-5.8

git上分支从3.1-5.8/master开发版,可以自行选择,我这边检出5.8最新稳定版本

git clone --depth 1 --no-single-branch git://git.kamailio.org/kamailio kamailio
cd kamailio
git checkout -b 5.8 origin/5.8

配置项目

在kamailio文件夹下,src文件夹是我们需要关注的,后续的编译配置都在这个目录下

在src文件夹下,项目结构是这样的:

¥:~/kamailio-5.8/kamailio/src$ ls -l
total 9608
-rw-r--r--   1 kama kama   36045 Jun 14 11:19 Makefile
-rw-r--r--   1 kama kama     327 Jun 14 11:19 Makefile.cfg
-rw-r--r--   1 kama kama   61022 Jun 14 11:19 Makefile.defs
-rw-r--r--   1 kama kama     619 Jun 14 11:19 Makefile.dirs
-rw-r--r--   1 kama kama   15180 Jun 14 11:19 Makefile.groups
-rw-r--r--   1 kama kama    4453 Jun 14 11:19 Makefile.libs
-rw-r--r--   1 kama kama    7161 Jun 14 11:19 Makefile.modules
-rw-r--r--   1 kama kama    1220 Jun 14 11:19 Makefile.radius
-rw-r--r--   1 kama kama    8184 Jun 14 11:19 Makefile.rules
-rw-r--r--   1 kama kama    1513 Jun 14 11:19 Makefile.shared
-rw-r--r--   1 kama kama     756 Jun 14 11:19 Makefile.sources
-rw-r--r--   1 kama kama    1824 Jun 14 11:19 Makefile.targets
-rw-r--r--   1 kama kama    3450 Jun 14 11:19 Makefile.utils
drwxr-xr-x   9 kama kama   12288 Jun 20 13:28 core
drwxr-xr-x  13 kama kama    4096 Jun 14 11:19 lib
-rw-r--r--   1 kama kama   91492 Jun 14 11:19 main.c
drwxr-xr-x 258 kama kama   12288 Jun 14 11:19 modules

在Makefile所在的项目根目录,初始化配置文件

make cfg

编译之后就会多出一些文件,这些也是在Makefile的脚本中可以有迹可循的

-rw-r--r--   1 kama kama      16 Jun 20 13:28 librpath.lst # 指定库文件的路径
-rw-r--r--   1 kama kama    6350 Jun 20 13:28 main.d # 帮助管理编译时的依赖关系
-rw-r--r--   1 root   root    479768 Jun 20 13:28 main.o # 编译后的二进制形式的目标文件 
-rw-r--r--   1 kama kama     966 Jun 14 11:20 makecfg.lst # 包含了编译Kamailio时需要的额外配置指令或变量定义
-rw-r--r--   1 kama kama    1885 Jun 26 09:50 modules.lst # 依赖模块的初始化文件,这个如果存在就会删了重新生成
-rw-r--r--   1 root   root      3600 Jun 20 13:27 config.mak # 用来指导后续的编译步骤(通常通过执行make命令)如何基于你的配置需求来构建Kamailio

其中 modules.lst 主要负责引入和排除加载的镜像,是通常使用过程中需要修改的,比如增加数据库模块、缓存模块、http请求模块

# this file is autogenerated by make modules-cfg

# the list of sub-directories with modules
modules_dirs:=modules

# the list of module groups to compile
cfg_group_include=

# the list of extra modules to compile
include_modules= app_lua db_mysql presence presence_conference presence_dialoginfo presence_mwi presence_profile presence_reginfo presence_xml http_async_client http_client

# the list of static modules
static_modules=

# the list of modules to skip from compile list
skip_modules=

# the list of modules to exclude from compile list
exclude_modules= acc_json acc_radius app_java app_mono app_perl app_python app_python3 app_python3s app_ruby app_ruby_proc auth_ephemeral auth_radius cdp cdp_avp cnxcc cplc crypto db2_ldap db_berkeley db_cassandra db_mongodb db_mysql db_oracle db_perlvdb db_postgres db_redis db_sqlite db_unixodbc dialplan dnssec erlang evapi gcrypt geoip geoip2 gzcompress h350 ims_auth ims_charging ims_dialog ims_diameter_server ims_icscf ims_ipsec_pcscf ims_isc ims_ocs ims_qos ims_registrar_pcscf ims_registrar_scscf ims_usrloc_pcscf ims_usrloc_scscf jansson janssonrpcc json jsonrpcc jwt kafka kazoo lcr ldap log_systemd lost lwsc memcached microhttpd misc_radius mqtt nats ndb_cassandra ndb_mongodb ndb_redis nghttp2 nsq osp outbound peering phonenum pua pua_bla pua_dialoginfo pua_json pua_reginfo pua_rpc pua_usrloc pua_xmpp rabbitmq regex rls rtp_media_server ruxc sctp secsipid secsipid_proc slack snmpstats stirshaken systemdops tls tls_wolfssl tlsa topos_redis utils uuid websocket xcap_client xcap_server xhttp_pi xmlops xmlrpc xmpp $(skip_modules)

modules_all= $(filter-out modules/CVS,$(wildcard modules/*))
modules_noinc= $(filter-out $(addprefix modules/, $(exclude_modules) $(static_modules)), $(modules_all))
modules= $(filter-out $(modules_noinc), $(addprefix modules/, $(include_modules) )) $(modules_noinc)
modules_configured:=1

可以直接打开文件进行编辑,或者使用命令的方式 make include_modules="app_lua db_mysql" exclude_modules="xxxxx" cfg

以上你如果选用了对应的模块,前提是你的环境已经安装了哦,比如已经安装了MySQL(我这边安装的是MySQL5.7),已经安装了Lua(我这边安装的是Lua5.4,liblua5.4-dev)

编译并安装项目

make all编译

$:~/kamailio-5.8/kamailio/src$ sudo make all
make[2]: 'libsrdb2.so.1.0' is up to date.
make[2]: 'libsrdb1.so.1.0' is up to date.
make[2]: 'libsrdb1.so.1.0' is up to date.
make[1]: 'acc_diameter.so' is up to date.
make[2]: 'libsrdb1.so.1.0' is up to date.
make[1]: 'app_jsdt.so' is up to date.
....

make install 安装

$:~/kamailio-5.8/kamailio/src$ sudo make install

安装完成后:

所有配置文件将位于:/usr/local/etc/kamailio,核心配置文件位于:/usr/local/etc/kamailio/kamailio.cfg

可执行文件位于: /usr/local/sbin/

  • kamailio - SIP 服务器脚本
  • kamdbctl - 创建和管理数据库的脚本,比如你使用MySQL作为其存储时就需要使用到这个
  • kamctl - 管理和控制SIP服务器的脚本
  • kamcmd - CLI 可以与SIP服务器交互的命令行接口

已经安装的模块位于:/usr/local/lib/kamailio/modules/,如果引用还有报包不存在的,就需要看看这里确认,没有的话编译安装可能要重来

一些文档位于: /usr/local/share/doc/kamailio/,/usr/local/share/man/man5/,/usr/local/share/man/man8/

日志输出位于: /var/log/syslog,好像有点疑惑为什么不是和其他的一样是关于kamailio的命名,这个可以配置

配置日志输出

  1. kamailio.cfg配置文件中,找到关于日志的配置行 log_facility=LOG_LOCAL0,确定没有注释掉
  2. 对于Unbuntu 22.04,找到/etc/rsyslog.d/50-default.conf文件,对syslog的配置进行调整
...
#注释掉这一行
#*.*;auth,authpriv.none    -/var/log/syslog 
#新加
*.*;auth,authpriv.none,local0.none    -/var/log/syslog  #追加local0
#新加
if $syslogfacility-text=='local0' then -/var/log/kamailio.log #将local0 输出到 kamailio.log,路径可以自定义 /var/log/kamailio/kamailio.log
...

配置MySQL数据库存储

默认情况下,不会引入任何数据库存储,我们这边是因为需要做持久化(也是正常使用的需求),前面modules已经引入 db_mysql的模块

/usr/local/etc/kamailio/kamctlrc

## The Kamailio configuration file for the control tools.
##
## Here you can set variables used in the kamctl and kamdbctl setup
## scripts. Per default all variables here are commented out, the control tools
## will use their internal default values.

## the SIP domain
# SIP_DOMAIN=kamailio.org

## 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=127.0.0.1

## 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="kamailiopassword"

## database read only user
DBROUSER="kamailioro"

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

## database access host (from where is kamctl used)
# DBACCESSHOST=192.168.0.1

## database host for super user (useful for specifying a local socket or virtual hostname)
# defaults to value of DBHOST when not set
# DBROOTHOST="localhost"

## database port for super user (on some DB specifying the port will force TCP connections)
# default value will depend on client DB tool
# DBROOTPORT=""

## database super user (for ORACLE this is 'scheme-creator' user)
# DBROOTUSER="root"

## password for database super user
## - important: this is insecure, targeting the use only for automatic testing
## - known to work for: mysql
# DBROOTPW="dbrootpw"

## option to ask confirmation for all database creation steps
# DBINITASK=yes

## database character set (used by MySQL when creating database)
#CHARSET="latin1"

## user name column
# USERCOL="username"


## SQL definitions
## If you change this definitions here, then you must change them
## in db/schema/entities.xml too.
## FIXME

# FOREVER="2030-05-28 21:32:15"
# DEFAULT_Q="1.0"


## Program to calculate a message-digest fingerprint
# MD5="md5sum"

## awk tool
# AWK="awk"

## gdb tool
# GDB="gdb"

## If you use a system with a grep and egrep that is not 100% gnu grep compatible,
## e.g. solaris, install the gnu grep (ggrep) and specify this below.
##
## grep tool
# GREP="grep"

## egrep tool
# EGREP="egrep"

## sed tool
# SED="sed"

## tail tool
# LAST_LINE="tail -n 1"

## expr tool
# EXPR="expr"


## Describe what additional tables to install. Valid values for the variables
## below are yes/no/ask. With ask (default) it will interactively ask the user
## for an answer, while yes/no allow for automated, unassisted installs.

## If to install tables for the modules in the EXTRA_MODULES variable.
# INSTALL_EXTRA_TABLES=ask

## If to install presence related tables.
# INSTALL_PRESENCE_TABLES=ask

## If to install uid modules related tables.
# INSTALL_DBUID_TABLES=ask

## Define what module tables should be installed.
## If you use the postgres database and want to change the installed tables, then you
## must also adjust the STANDARD_TABLES or EXTRA_TABLES variable accordingly in the
## kamdbctl.base script.

## Kamailio standard modules
# STANDARD_MODULES="standard acc lcr domain group permissions registrar usrloc msilo
#                   alias_db uri_db speeddial avpops auth_db pdt dialog dispatcher
#                   dialplan"

## Kamailio extra modules
# EXTRA_MODULES="imc cpl siptrace domainpolicy carrierroute userblocklist htable purple sca"


## type of aliases used: DB - database aliases; UL - usrloc aliases
## - default: none
# ALIASES_TYPE="DB"

## control engine: RPCFIFO
## - default RPCFIFO
# CTLENGINE="RPCFIFO"

## path to FIFO file for engine RPCFIFO
# RPCFIFOPATH="/run/kamailio/kamailio_rpc.fifo"

## check ACL names; default on (1); off (0)
# VERIFY_ACL=1

## ACL names - if VERIFY_ACL is set, only the ACL names from below list
## are accepted
# ACL_GROUPS="local ld int voicemail free-pstn"

## check if user exists (used by some commands such as acl);
## - default on (1); off (0)
# VERIFY_USER=1

## verbose - debug purposes - default '0'
# VERBOSE=1

## do (1) or don't (0) store plaintext passwords
## in the subscriber table - default '1'
# STORE_PLAINTEXT_PW=0

## Kamailio START Options
## PID file path - default is: /run/kamailio/kamailio.pid
# PID_FILE=/run/kamailio/kamailio.pid

## Kamailio Startup Configuration File
## Default is: kamailio.cfg
# STARTUP_CONFIG_FILE=kamailio.cfg

## Extra start options - default is: not set
## example: start Kamailio with 64MB shared memory: STARTOPTIONS="-m 64"
# STARTOPTIONS=

开始通过脚本初始化数据库配置

$:/usr/local/etc/kamailio$ sudo  /usr/local/sbin/kamdbctl create
[sudo] password for root:
MySQL password for : #要求输入root的密码
INFO: test server charset
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
WARNING: Your current default mysql characters set cannot be used to create DB. Please choice another one from the following list:
armscii8
ascii
big5
binary
cp1250
cp1251
cp1256
cp1257
cp850
cp852
cp866
cp932
dec8
eucjpms
euckr
gb18030
gb2312
gbk
geostd8
greek
hebrew
hp8
keybcs2
koi8r
koi8u
latin1
latin2
latin5
latin7
macce
macroman
sjis
swe7
tis620
ujis
utf16
utf16le
utf32
Enter character set name:
latin1  # 默认的latin1 字符编码
INFO: creating database kamailio ... #自动开始创建数据库
mysql: [Warning] Using a password on the command line interface can be insecure.
INFO: granting privileges to database kamailio ... #自动开始授权
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
INFO: creating standard tables into kamailio ... #自动开始初始化表格
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
INFO: Core Kamailio tables successfully created.
Create the presence related tables? (y/n): y #创建关联表
INFO: creating presence tables into kamailio ...
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
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 ... #创建额外表
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
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 ... #创建uid表
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
INFO: UID tables successfully created.

以上就结束了,可以再使用root账户登录,确认是否初始化完毕。

配置 kamailio.cfg 并启动

/usr/local/etc/kamailio/kamailio.cfg 重点开启#!define WITH_MYSQL #!define WITH_AUTH #!define WITH_USRLOCDB

#!KAMAILIO
#!define WITH_MYSQL
#!define WITH_AUTH
#!define WITH_USRLOCDB
#!define WITH_ANTIFLOOD
#!define WITH_PRESENCE
# change next line to comment to disable logging
#!define WITH_ACCDB
#
# Kamailio SIP Server v5.8 - default configuration script
#     - web: https://www.kamailio.org
#     - git: https://github.com/kamailio/kamailio
#
# Direct your questions about this file to: <sr-users@lists.kamailio.org>
#
# Refer to the Core CookBook at https://www.kamailio.org/wikidocs/
# for an explanation of possible statements, functions and parameters.
#
# Note: the comments can be:
#     - lines starting with #, but not the pre-processor directives,
#       which start with #!, like #!define, #!ifdef, #!endif, #!else, #!trydef,
#       #!subst, #!substdef, ...
#     - lines starting with //
#     - blocks enclosed in between /* */
# Note: the config performs symmetric SIP signaling
#     - it sends the reply to the source address of the request
#     - remove the use of force_rport() for asymmetric SIP signaling
#
# Several features can be enabled using '#!define WITH_FEATURE' directives:
#
# *** To run in debug mode:
#     - define WITH_DEBUG
#     - debug level increased to 3, logs still sent to syslog
#     - debugger module loaded with cfgtrace enabled
#
# *** To enable mysql:
#     - define WITH_MYSQL
#
# *** To enable authentication execute:
#     - enable mysql
#     - define WITH_AUTH
#     - add users using 'kamctl' or 'kamcli'
#
# *** To enable IP authentication execute:
#     - enable mysql
#     - enable authentication
#     - define WITH_IPAUTH
#     - add IP addresses with group id '1' to 'address' table
#
# *** To enable persistent user location execute:
#     - enable mysql
#     - define WITH_USRLOCDB
#
# *** To enable presence server execute:
#     - enable mysql
#     - define WITH_PRESENCE
#     - if modified headers or body in config must be used by presence handling:
#     - define WITH_MSGREBUILD
#
# *** To enable nat traversal execute:
#     - define WITH_NAT
#     - option for NAT SIP OPTIONS keepalives: WITH_NATSIPPING
#     - install RTPProxy: http://www.rtpproxy.org
#     - start RTPProxy:
#        rtpproxy -l _your_public_ip_ -s udp:localhost:7722
#
# *** To use RTPEngine (instead of RTPProxy) for nat traversal execute:
#     - define WITH_RTPENGINE
#     - install RTPEngine: https://github.com/sipwise/rtpengine
#     - start RTPEngine:
#        rtpengine --listen-ng=127.0.0.1:2223 ...
#
# *** To enable PSTN gateway routing execute:
#     - define WITH_PSTN
#     - set the value of pstn.gw_ip
#     - check route[PSTN] for regexp routing condition
#
# *** To enable database aliases lookup execute:
#     - enable mysql
#     - define WITH_ALIASDB
#
# *** To enable speed dial lookup execute:
#     - enable mysql
#     - define WITH_SPEEDDIAL
#
# *** To enable multi-domain support execute:
#     - enable mysql
#     - define WITH_MULTIDOMAIN
#
# *** To enable TLS support execute:
#     - adjust CFGDIR/tls.cfg as needed
#     - define WITH_TLS
#
# *** To enable JSONRPC over HTTP(S) support execute:
#     - define WITH_JSONRPC
#     - adjust event_route[xhttp:request] for access policy
#
# *** To enable anti-flood detection execute:
#     - adjust pike and htable=>ipban settings as needed (default is
#       block if more than 16 requests in 2 seconds and ban for 300 seconds)
#     - define WITH_ANTIFLOOD
#
# *** To load htable module execute:
#     - define WITH_HTABLE
#
# *** To block 3XX redirect replies execute:
#     - define WITH_BLOCK3XX
#
# *** To block 401 and 407 authentication replies execute:
#     - define WITH_BLOCK401407
#
# *** To enable VoiceMail routing execute:
#     - define WITH_VOICEMAIL
#     - set the value of voicemail.srv_ip
#     - adjust the value of voicemail.srv_port
#
# *** To enhance accounting execute:
#     - enable mysql
#     - define WITH_ACCDB
#     - add following columns to database
#!ifdef ACCDB_COMMENT
  ALTER TABLE acc ADD COLUMN src_user VARCHAR(64) NOT NULL DEFAULT '';
  ALTER TABLE acc ADD COLUMN src_domain VARCHAR(128) NOT NULL DEFAULT '';
  ALTER TABLE acc ADD COLUMN src_ip varchar(64) NOT NULL default '';
  ALTER TABLE acc ADD COLUMN dst_ouser VARCHAR(64) NOT NULL DEFAULT '';
  ALTER TABLE acc ADD COLUMN dst_user VARCHAR(64) NOT NULL DEFAULT '';
  ALTER TABLE acc ADD COLUMN dst_domain VARCHAR(128) NOT NULL DEFAULT '';
  ALTER TABLE missed_calls ADD COLUMN src_user VARCHAR(64) NOT NULL DEFAULT '';
  ALTER TABLE missed_calls ADD COLUMN src_domain VARCHAR(128) NOT NULL DEFAULT '';
  ALTER TABLE missed_calls ADD COLUMN src_ip varchar(64) NOT NULL default '';
  ALTER TABLE missed_calls ADD COLUMN dst_ouser VARCHAR(64) NOT NULL DEFAULT '';
  ALTER TABLE missed_calls ADD COLUMN dst_user VARCHAR(64) NOT NULL DEFAULT '';
  ALTER TABLE missed_calls ADD COLUMN dst_domain VARCHAR(128) NOT NULL DEFAULT '';
#!endif

####### Include Local Config If Exists #########
import_file "kamailio-local.cfg"

####### Defined Values #########

# *** Value defines - IDs used later in config
#!ifdef WITH_DEBUG
#!define DBGLEVEL 3
#!else
#!define DBGLEVEL 2
#!endif

#!ifdef WITH_MYSQL
# - database URL - used to connect to database server by modules such
#       as: auth_db, acc, usrloc, a.s.o.
#!trydef DBURL "mysql://kamailio:'kamailiorwpassword'@localhost/kamailio"
#!endif

#!ifdef WITH_MULTIDOMAIN
# - the value for 'use_domain' parameters
#!define MULTIDOMAIN 1
#!else
#!define MULTIDOMAIN 0
#!endif

#!ifdef WITH_ANTIFLOOD
# - hash table 'ipban' used to store blocked IP addresses
#!trydef WITH_HTABLE
#!endif

# - flags
#   FLT_ - per transaction (message) flags
#!define FLT_ACC 1
#!define FLT_ACCMISSED 2
#!define FLT_ACCFAILED 3
#!define FLT_NATS 5

#       FLB_ - per branch flags
#!define FLB_NATB 6
#!define FLB_NATSIPPING 7

####### Global Parameters #########

/* LOG Levels: 3=DBG, 2=INFO, 1=NOTICE, 0=WARN, -1=ERR, ... */
debug=DBGLEVEL

/* set to 'yes' to print log messages to terminal or use '-E' cli option */
log_stderror=no

memdbg=5
memlog=5

log_facility=LOG_LOCAL0
log_prefix="{$mt $hdr(CSeq) $ci} "

/* number of SIP routing processes for each UDP socket
 * - value inherited by tcp_children and sctp_children when not set explicitely */
children=8

/* uncomment the next line to disable TCP (default on) */
# disable_tcp=yes

/* number of SIP routing processes for all TCP/TLS sockets */
# tcp_children=8

/* uncomment the next line to disable the auto discovery of local aliases
 * based on reverse DNS on IPs (default on) */
# auto_aliases=no

/* add local domain aliases - it can be set many times */
# alias="sip.mydomain.com"

/* 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:127.0.0.1:5060

/* life time of TCP connection when there is no traffic
 * - a bit higher than registration expires to cope with UA behind NAT */
tcp_connection_lifetime=3605

/* upper limit for TCP connections (it includes the TLS connections) */
tcp_max_connections=2048

/* upper limit for TCP connections for one ip address - default 1024 */
#tcp_accept_iplimit=1024

#!ifdef WITH_JSONRPC
tcp_accept_no_cl=yes
#!endif

#!ifdef WITH_TLS
enable_tls=yes

/* upper limit for TLS connections */
tls_max_connections=2048

/* For OpenSSL 3 integration
 * functions calling libssl3 can be invoked in a transient thread
 * 0: disable threaded calls
 * 1: use thread executors for process#0 only
 * 2: no thread executors, but use atfork handler to reset thread-locals to NULL
 * 3: use thread executors for all processes */
tls_threads_mode=1
#!endif

/* set it to yes to enable sctp and load sctp.so module */
enable_sctp=no

####### Custom Parameters #########

/* These parameters can be modified at runtime via RPC interface
 * - see the documentation of 'cfg_rpc' module.
 *
 * Format: group.id = value 'desc' description
 * Access: $sel(cfg_get.group.id) or @cfg_get.group.id */

#!ifdef WITH_PSTN
/* PSTN GW Routing
 *
 * - pstn.gw_ip: valid IP or hostname as string value, example:
 * pstn.gw_ip = "10.0.0.101" desc "My PSTN GW Address"
 *
 * - by default is empty to avoid misrouting */
pstn.gw_ip = "" desc "PSTN GW Address"
pstn.gw_port = "" desc "PSTN GW Port"
#!endif

#!ifdef WITH_VOICEMAIL
/* VoiceMail Routing on offline, busy or no answer
 *
 * - by default Voicemail server IP is empty to avoid misrouting */
voicemail.srv_ip = "" desc "VoiceMail IP Address"
voicemail.srv_port = "5060" desc "VoiceMail Port"
#!endif

####### Modules Section ########

/* set paths to location of modules */
# mpath="/usr/local/lib64/kamailio/modules/"

# when using TLS with OpenSSL it is recommended to load this module
# first so that OpenSSL is initialized correctly
#!ifdef WITH_TLS
loadmodule "tls.so"
#!endif

#!ifdef WITH_MYSQL
loadmodule "db_mysql.so"
#!endif

#!ifdef WITH_JSONRPC
loadmodule "xhttp.so"
#!endif
loadmodule "jsonrpcs.so"
loadmodule "kex.so"
loadmodule "corex.so"
loadmodule "tm.so"
loadmodule "tmx.so"
loadmodule "sl.so"
loadmodule "rr.so"
loadmodule "pv.so"
loadmodule "maxfwd.so"
loadmodule "usrloc.so"
loadmodule "registrar.so"
loadmodule "textops.so"
loadmodule "textopsx.so"
loadmodule "siputils.so"
loadmodule "xlog.so"
loadmodule "sanity.so"
loadmodule "ctl.so"
loadmodule "cfg_rpc.so"
loadmodule "acc.so"
loadmodule "counters.so"

#!ifdef WITH_AUTH
loadmodule "auth.so"
loadmodule "auth_db.so"
#!ifdef WITH_IPAUTH
loadmodule "permissions.so"
#!endif
#!endif

#!ifdef WITH_ALIASDB
loadmodule "alias_db.so"
#!endif

#!ifdef WITH_SPEEDDIAL
loadmodule "speeddial.so"
#!endif

#!ifdef WITH_MULTIDOMAIN
loadmodule "domain.so"
#!endif

#!ifdef WITH_PRESENCE
loadmodule "presence.so"
loadmodule "presence_xml.so"
#!endif

#!ifdef WITH_NAT
loadmodule "nathelper.so"
#!ifdef WITH_RTPENGINE
loadmodule "rtpengine.so"
#!else
loadmodule "rtpproxy.so"
#!endif
#!endif

#!ifdef WITH_HTABLE
loadmodule "htable.so"
#!endif

#!ifdef WITH_ANTIFLOOD
loadmodule "pike.so"
#!endif

#!ifdef WITH_DEBUG
loadmodule "debugger.so"
#!endif

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


# ----- jsonrpcs params -----
modparam("jsonrpcs", "pretty_format", 1)
/* set the path to RPC fifo control file */
# modparam("jsonrpcs", "fifo_name", "/run/kamailio/kamailio_rpc.fifo")
/* set the path to RPC unix socket control file */
# modparam("jsonrpcs", "dgram_socket", "/run/kamailio/kamailio_rpc.sock")
#!ifdef WITH_JSONRPC
modparam("jsonrpcs", "transport", 7)
#!endif

# ----- ctl params -----
/* set the path to RPC unix socket control file */
# modparam("ctl", "binrpc", "unix:/run/kamailio/kamailio_ctl")

# ----- sanity params -----
modparam("sanity", "autodrop", 0)

# ----- 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)

# ----- rr params -----
# set next param to 1 to add value to ;lr param (helps with some UAs)
modparam("rr", "enable_full_lr", 0)
# do not append from tag to the RR (no need for this script)
modparam("rr", "append_fromtag", 0)

# ----- registrar params -----
modparam("registrar", "method_filtering", 1)
/* uncomment the next line to disable parallel forking via location */
# modparam("registrar", "append_branches", 0)
/* uncomment the next line not to allow more than 10 contacts per AOR */
# modparam("registrar", "max_contacts", 10)
/* max value for expires of registrations */
modparam("registrar", "max_expires", 3600)
/* set it to 1 to enable GRUU */
modparam("registrar", "gruu_enabled", 0)
/* set it to 0 to disable Path handling */
modparam("registrar", "use_path", 1)
/* save Path even if not listed in Supported header */
modparam("registrar", "path_mode", 0)

# ----- acc params -----
/* what special events should be accounted ? */
modparam("acc", "early_media", 0)
modparam("acc", "report_ack", 0)
modparam("acc", "report_cancels", 0)
/* by default we do not adjust the direct of the sequential requests.
 * if you enable this parameter, be sure the enable "append_fromtag"
 * in "rr" module */
modparam("acc", "detect_direction", 0)
/* account triggers (flags) */
modparam("acc", "log_flag", FLT_ACC)
modparam("acc", "log_missed_flag", FLT_ACCMISSED)
modparam("acc", "log_extra",
        "src_user=$fU;src_domain=$fd;src_ip=$si;"
        "dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
modparam("acc", "failed_transaction_flag", FLT_ACCFAILED)
/* enhanced DB accounting */
#!ifdef WITH_ACCDB
modparam("acc", "db_flag", FLT_ACC)
modparam("acc", "db_missed_flag", FLT_ACCMISSED)
modparam("acc", "db_url", DBURL)
modparam("acc", "db_extra",
        "src_user=$fU;src_domain=$fd;src_ip=$si;"
        "dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
#!endif

# ----- usrloc params -----
modparam("usrloc", "timer_interval", 60)
modparam("usrloc", "timer_procs", 1)
modparam("usrloc", "use_domain", MULTIDOMAIN)
/* enable DB persistency for location entries */
#!ifdef WITH_USRLOCDB
modparam("usrloc", "db_url", DBURL)
modparam("usrloc", "db_mode", 2)
#!endif

# ----- auth_db params -----
#!ifdef WITH_AUTH
modparam("auth_db", "db_url", DBURL)
modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "password_column", "password")
modparam("auth_db", "load_credentials", "")
modparam("auth_db", "use_domain", MULTIDOMAIN)

# ----- permissions params -----
#!ifdef WITH_IPAUTH
modparam("permissions", "db_url", DBURL)
modparam("permissions", "load_backends", 1)
#!endif

#!endif

# ----- alias_db params -----
#!ifdef WITH_ALIASDB
modparam("alias_db", "db_url", DBURL)
modparam("alias_db", "use_domain", MULTIDOMAIN)
#!endif

# ----- speeddial params -----
#!ifdef WITH_SPEEDDIAL
modparam("speeddial", "db_url", DBURL)
modparam("speeddial", "use_domain", MULTIDOMAIN)
#!endif

# ----- domain params -----
#!ifdef WITH_MULTIDOMAIN
modparam("domain", "db_url", DBURL)
/* register callback to match myself condition with domains list */
modparam("domain", "register_myself", 1)
#!endif

#!ifdef WITH_PRESENCE
# ----- presence params -----
modparam("presence", "db_url", DBURL)

# ----- presence_xml params -----
modparam("presence_xml", "db_url", DBURL)
modparam("presence_xml", "force_active", 1)
#!endif

#!ifdef WITH_NAT
#!ifdef WITH_RTPENGINE
# ----- rtpengine params -----
modparam("rtpengine", "rtpengine_sock", "udp:127.0.0.1:2223")
#!else
# ----- rtpproxy params -----
modparam("rtpproxy", "rtpproxy_sock", "udp:127.0.0.1:7722")
#!endif
# ----- nathelper params -----
modparam("nathelper", "natping_interval", 30)
modparam("nathelper", "ping_nated_only", 1)
modparam("nathelper", "sipping_bflag", FLB_NATSIPPING)
modparam("nathelper", "sipping_from", "sip:pinger@kamailio.org")

# params needed for NAT traversal in other modules
modparam("nathelper|registrar", "received_avp", "$avp(RECEIVED)")
modparam("usrloc", "nat_bflag", FLB_NATB)
#!endif

#!ifdef WITH_TLS
# ----- tls params -----
modparam("tls", "config", "/usr/local/etc/kamailio/tls.cfg")
#!endif

#!ifdef WITH_ANTIFLOOD
# ----- pike params -----
modparam("pike", "sampling_time_unit", 2)
modparam("pike", "reqs_density_per_unit", 16)
modparam("pike", "remove_latency", 4)
#!endif

#!ifdef WITH_HTABLE
# ----- htable params -----
#!ifdef WITH_ANTIFLOOD
/* ip ban htable with autoexpire after 5 minutes */
modparam("htable", "htable", "ipban=>size=8;autoexpire=300;")
#!endif
#!endif

#!ifdef WITH_DEBUG
# ----- debugger params -----
modparam("debugger", "cfgtrace", 1)
modparam("debugger", "log_level_name", "exec")
#!endif

####### 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 {
    #...
}

后台启动服务

/usr/local/sbin/kamailio start
那么这个时候也有可能你配置文件里面写的有语法、引用等异常,你会看到ERROR: PID file /run/kamailio/kamailio.pid does not exist -- Kamailio start failed,还要去日志看错误信息,很麻烦怎么办呢?

校验下服务,能看到错误输出,如果没有错误,再用后台启动

服务校验

$:/run$ sudo /usr/local/sbin/kamailio -M 8 -E -e -dd
 0(274273) INFO: <core> [main.c:2292]: main(): private (per process) memory: 8388608 bytes
 0(274273) WARNING: <core> [core/socket_info.c:1811]: fix_hostname(): could not rev. resolve 172.19.53.235
 0(274273) WARNING: <core> [core/socket_info.c:1811]: fix_hostname(): could not rev. resolve 172.17.0.1
 0(274273) WARNING: <core> [core/socket_info.c:1811]: fix_hostname(): could not rev. resolve 172.18.0.1
 0(274273) WARNING: <core> [core/socket_info.c:1811]: fix_hostname(): could not rev. resolve 172.19.53.235
 0(274273) WARNING: <core> [core/socket_info.c:1811]: fix_hostname(): could not rev. resolve 172.17.0.1
 0(274273) WARNING: <core> [core/socket_info.c:1811]: fix_hostname(): could not rev. resolve 172.18.0.1
Listening on
             udp: 127.0.0.1:5060
             udp: 172.19.53.235:5060
             udp: 172.17.0.1:5060
             udp: 172.18.0.1:5060
             tcp: 127.0.0.1:5060
             tcp: 172.19.53.235:5060
             tcp: 172.17.0.1:5060
             tcp: 172.18.0.1:5060
Aliases:
             tcp: localhost:5060
             udp: localhost:5060

 0(274273) INFO: <core> [core/tcp_main.c:5218]: init_tcp(): using epoll_lt as the io watch method (auto detected)
 0(274279) INFO: rr [../outbound/api.h:53]: ob_load_api(): unable to import bind_ob - maybe module is not loaded
 0(274279) INFO: rr [rr_mod.c:185]: mod_init(): outbound module not available
 0(274279) INFO: <core> [main.c:3257]: main(): processes (at least): 49 - shm size: 67108864 - pkg size: 8388608
 0(274279) INFO: <core> [core/udp_server.c:167]: probe_max_receive_buffer(): SO_RCVBUF is initially 212992 for fd 9
 0(274279) INFO: <core> [core/udp_server.c:237]: probe_max_receive_buffer(): SO_RCVBUF is finally 425984 on fd 9
 0(274279) INFO: <core> [core/udp_server.c:268]: probe_max_send_buffer(): SO_SNDBUF is initially 212992 for fd 9
 0(274279) INFO: <core> [core/udp_server.c:338]: probe_max_send_buffer(): SO_SNDBUF is finally 425984 on fd 9
 0(274279) INFO: <core> [core/udp_server.c:167]: probe_max_receive_buffer(): SO_RCVBUF is initially 212992 for fd 10
 0(274279) INFO: <core> [core/udp_server.c:237]: probe_max_receive_buffer(): SO_RCVBUF is finally 425984 on fd 10
 0(274279) INFO: <core> [core/udp_server.c:268]: probe_max_send_buffer(): SO_SNDBUF is initially 212992 for fd 10
 0(274279) INFO: <core> [core/udp_server.c:338]: probe_max_send_buffer(): SO_SNDBUF is finally 425984 on fd 10
 0(274279) INFO: <core> [core/udp_server.c:167]: probe_max_receive_buffer(): SO_RCVBUF is initially 212992 for fd 11
 0(274279) INFO: <core> [core/udp_server.c:237]: probe_max_receive_buffer(): SO_RCVBUF is finally 425984 on fd 11
 0(274279) INFO: <core> [core/udp_server.c:268]: probe_max_send_buffer(): SO_SNDBUF is initially 212992 for fd 11
 0(274279) INFO: <core> [core/udp_server.c:338]: probe_max_send_buffer(): SO_SNDBUF is finally 425984 on fd 11
 0(274279) INFO: <core> [core/udp_server.c:167]: probe_max_receive_buffer(): SO_RCVBUF is initially 212992 for fd 12
 0(274279) INFO: <core> [core/udp_server.c:237]: probe_max_receive_buffer(): SO_RCVBUF is finally 425984 on fd 12
 0(274279) INFO: <core> [core/udp_server.c:268]: probe_max_send_buffer(): SO_SNDBUF is initially 212992 for fd 12
 0(274279) INFO: <core> [core/udp_server.c:338]: probe_max_send_buffer(): SO_SNDBUF is finally 425984 on fd 12
 0(274279) INFO: <core> [core/tcp_main.c:3274]: tcp_init(): Set TCP_USER_TIMEOUT=10000 ms
 0(274279) ERROR: <core> [core/tcp_main.c:3279]: tcp_init(): bind(e, 0x7f3eed110ec8, 16) on 127.0.0.1:5060 : Address already in use
 0(274279) INFO: <core> [core/sctp_core.c:53]: sctp_core_destroy(): SCTP API not initialized

直观地看到错误信息,上面这个错误就很明显了,服务端口已经起着了,或者和别的服务端口冲突了。一切正常的话没有ERROR的话,就是没有语法错误。
对于新手的我,改脚本直接上文件写的,有这个命令还是很好用的,能告诉我第几行有错误。

终止服务

$ ps axw | /usr/bin/egrep kamailio
  40551 ?        S      0:00 ./kamailio
  40552 ?        S      0:00 ./kamailio
  40553 ?        S      0:00 ./kamailio
  40554 ?        S      0:00 ./kamailio
  40555 ?        S      0:00 ./kamailio
  40556 ?        S      0:00 ./kamailio
  40557 ?        S      0:00 ./kamailio
  40558 ?        S      0:00 ./kamailio
  40559 ?        S      0:00 ./kamailio
  40560 ?        S      0:00 ./kamailio
  40561 ?        S      0:00 ./kamailio
  40562 ?        S      0:00 ./kamailio
  40563 ?        S      0:00 ./kamailio
  40564 ?        S      0:00 ./kamailio
  40565 ?        S      0:00 ./kamailio
  40566 ?        S      0:00 ./kamailio
  40567 ?        S      0:00 ./kamailio
  40568 ?        S      0:00 ./kamailio
  40569 ?        S      0:00 ./kamailio
  40570 ?        S      0:00 ./kamailio
  40571 ?        S      0:00 ./kamailio
  40572 ?        S      0:00 ./kamailio
  40573 ?        S      0:00 ./kamailio
  40574 ?        S      0:00 ./kamailio
  40575 ?        S      0:00 ./kamailio
  40576 ?        S      0:00 ./kamailio
  40577 ?        S      0:00 ./kamailio
  40578 ?        S      0:00 ./kamailio
  40579 ?        S      0:00 ./kamailio
  40580 ?        S      0:00 ./kamailio
  40581 ?        S      0:00 ./kamailio
  40582 ?        S      0:00 ./kamailio
  40583 ?        S      0:00 ./kamailio
  40584 ?        S      0:00 ./kamailio
  40585 ?        S      4:01 ./kamailio
  40586 ?        S      0:13 ./kamailio
  40587 ?        S      0:00 ./kamailio
  40588 ?        S      0:00 ./kamailio
  40589 ?        S      0:00 ./kamailio
  40590 ?        S      0:01 ./kamailio
  40591 ?        S      0:06 ./kamailio
  40592 ?        S      0:06 ./kamailio
  40593 ?        S      0:06 ./kamailio
  40594 ?        S      0:06 ./kamailio
  40595 ?        S      0:06 ./kamailio
  40596 ?        S      0:06 ./kamailio
  40597 ?        S      0:06 ./kamailio
  40598 ?        S      0:06 ./kamailio
  40599 ?        S      0:02 ./kamailio
 274124 pts/2    S+     0:00 grep -E kamailio

 $ sudo /usr/bin/killall kamailio
 $ ps axw | /usr/bin/egrep kamailio

通常kamailio启动会调起很多端口,stop有时候清不干净,我通常会使用这个命令

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1888184.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

vlan基础相关

7.2以太网交换基础 数据链路层也叫2层网络&#xff0c;用的是Mac地址&#xff0c;想到Mac地址就要想到交换机。 以太网协议&#xff08;LAN&#xff09;以太网是建立在CSMA/CD载波监听多路访问/冲突检测&#xff0c;机制上的广播型网络。CSMA工作原理是先监听&#xff0c;在介…

《C++20设计模式》适配器模式经验分享

文章目录 一、前言二、对于接口的讨论三、实现1、对象适配器1.1 UML类图1.2 实现 2、类适配器 四、最后 一、前言 从适配器模式开始就是类的组合聚合&#xff0c;类与类之间结构性的问题了。 适配器模式解决的问题&#xff1a; 适配器模式能够在不破坏现有系统结构的情况下&a…

震惊!张宇强化36讲1200页,暑期强化高效利用指南!

特别喜欢张宇老师的讲课风格 如果你打算跟张宇老师&#xff0c;那么基础——>强化——>冲刺&#xff0c;你应该这么买书&#xff01; 张宇老师25版课程大改版&#xff0c;其中&#xff0c;36讲的变动是最大的&#xff0c;张宇老师25版课程把以往的强化课程前移&#xff0…

Lumière:开创性的视频生成模型及其应用

视频内容创造领域迎来了突破性进展&#xff0c;但视频生成模型由于运动引入的复杂性而面临更多挑战。这些挑战主要源自运动的引入所带来的复杂性。时间连贯性是视频生成中的关键要素&#xff0c;模型必须确保视频中的运动在时间上是连贯和平滑的&#xff0c;避免出现不自然的跳…

法国工程师IMT联盟 密码学及其应用 2023年期末考试补考题

1 JAVA 安全 1.1 问题1 1.1.1 问题 用 2 或 3 句话解释 Java 执行模型&#xff08;Java 虚拟机machine virtuelle Java)&#xff09;中引入introduit沙箱bac sable机制 mcanisme d’excution par isolation的目的。 1.1.2 问题解释 在 Java 执行模型&#xff08;Java 虚拟机…

带电池监控功能的恒流直流负载组

EAK的交流和直流工业电池负载组测试仪对于测试和验证关键电力系统的能力至关重要&#xff0c;旨在实现最佳精度。作为一家客户至上的公司&#xff0c;我们继续尽我们所能应对供应链挑战&#xff0c;以提供出色的交货时间&#xff0c;大约是行业其他公司的一半。 交流负载组 我…

Python面试宝典第4题:环形链表

题目 给你一个链表的头节点 head &#xff0c;判断链表中是否有环。如果存在环 &#xff0c;则返回 true 。 否则&#xff0c;返回 false 。 如果链表中有某个节点&#xff0c;可以通过连续跟踪 next 指针再次到达&#xff0c;则链表中存在环。 为了表示给定链表中的环&#xf…

基于多视点编码光场的全景三维重建方法

欢迎关注GZH《光场视觉》 摘要&#xff1a;在基于光场的一系列应用中&#xff0c;目标的三维重建是基础且关键的任务。普通光场只能重建单一视角而无法重建全景&#xff0c;并且在纹理特征匮乏的区域也无法生成准确的三维信息。针对以上问题&#xff0c;提出一种基于多视点编码…

端口被占用的解决办法、netstat命令;Linux ps命令详解,Linux查看进程

文章目录 一、端口被占用的原因二、端口被占用的解决方法2.1 Windows系统2.2 Linux系统 三、Linux命令补充3.1 Linux查看端口占用情况3.2 netstat命令详解3.3 ps命令3.3.1 常用命令3.3.2 拓展命令3.3.3 字段补充 运行软件或程序时&#xff0c;有时会出现以下问题、导致运行失败…

JavaScript中的立即执行函数表达式(Immediately Invoked Function Expression, IIFE)

聚沙成塔每天进步一点点 本文回顾 ⭐ 专栏简介JavaScript中的立即执行函数表达式&#xff08;Immediately Invoked Function Expression, IIFE&#xff09;1. 引言2. IIFE的概念2.1 概述2.2 语法2.3 历史背景 3. IIFE的作用3.1 创建独立作用域3.2 模块化代码3.3 防止变量提升3.…

我不小心把生产的数据改错了!同事帮我用MySQL的BinLog挽回了罚款

之前在生产做修改数据的时候不小心改错了一行数据&#xff0c;本来以为会被通报批评&#xff0c;但是同事利用binlog日志查看到了之前的旧数据&#xff0c;并且帮我回滚了&#xff0c;学到了&#xff0c;所以写了一篇binlog的文章分享给大家。 MySQL的Binary Log&#xff08;简…

CentOS 7 停止维护(2024-6-30)后可用在线yum源 —— 筑梦之路

众所周知&#xff0c;centos 7 在2024年6月30日&#xff0c;生命周期结束&#xff0c;官方不再进行支持维护&#xff0c;而很多环境一时之间无法完全更新替换操作系统&#xff0c;因此对于yum源还是需要的&#xff0c;特别是对于互联网环境来说&#xff0c;在线yum源使用方便很…

标注比赛一种计分方法

这段时间试着在公司内部举办一场图片标注大赛&#xff0c;我负责制定规则&#xff0c;挑选比赛素材。这几天试了一种得分计算方法&#xff0c;结果尚可。利用我司研发的标注工具&#xff0c;我们很容易就可以得出下图结果。 这个结果中的标注框其实就是标准答案&#xff0c;漏检…

面向物联网行业的异常监控追踪技术解决方案:技术革新与运维保障

在现代高度数字化和互联的环境中&#xff0c;物联网技术已经深入到我们生活的方方面面。特别是在家庭和工业环境中&#xff0c;物联网系列通讯作为连接各类设备的关键枢纽&#xff0c;其稳定性和可靠性显得尤为重要。本文将介绍一种创新的监控系统&#xff0c;旨在实时跟踪和分…

无人机基础知识(模式篇)

姿态模式&#xff1a;姿态模式通常是在GPS模式无法使用的情况下进行操作的模式。通过操作杆对无人机进行操控&#xff0c;姿态模式下无人机只能提供自稳&#xff0c;不提供定点悬停&#xff0c;受外界影响很大&#xff1b; GPS模式&#xff1a;GPS模式通俗一点就是依靠GPS将无…

电路笔记(PCB):电流容量(IPC-2221和IPC-2152)+阻抗匹配

电流容量 IPC-2221经验公式 I K T b A c IK\times T^{b}\times A^{c} IKTbAc 这个公式用于估计PCB&#xff08;Printed Circuit Board&#xff0c;印刷电路板&#xff09;导线上的电流&#xff08;I&#xff09;&#xff0c;其中T和A分别表示温度&#xff08;Temperature&a…

SQL语句(DDL)

关系型数据库&#xff1a;建立在关系模型基础上&#xff0c;由多张相互连接的二维表组成的数据库 SQL语句 DDL-数据库操作 DDL-表操作-查询 DDL-表操作-创建 创建一个名为tb_user的表 mysql> use itheim; Database changed mysql> create table tb_user(-> id …

Python基础入门知识

目录 引言 简要介绍Python语言 为什么要学习Python Python的应用领域 Python安装和环境配置 Python的下载和安装(Windows, macOS, Linux) 配置Python环境变量 安装和使用IDE(如PyCharm, VS Code) Python基本语法 注释 变量和数据类型(数字,字符串,列表,元组,字典,…

【CUDA】 由GPGPU控制核心架构考虑CUDA编程中线程块的分配

GPGPU架构特点 由于典型的GPGPU只有小的流缓存&#xff0c;因此一个存储器和纹理读取请求通常需要经历全局存储器的访问延迟加上互连和缓冲延迟&#xff0c;可能高达数百个时钟周期。与CPU通过巨大的工作集缓存而降低延迟不同&#xff0c;GPU硬件多线程提供了数以千计的并行独…

服务器数据恢复—raid5阵列硬盘出现大量坏道的数据恢复案例

服务器存储数据恢复环境&故障&#xff1a; 一台DELL EqualLogic PS 4000存储中有一组由12块磁盘组建的raid5阵列&#xff0c;存储空间划分3个同等大小的卷&#xff0c;采用的VMFS文件系统。 两块硬盘指示灯亮黄色&#xff0c;raid5阵列崩溃&#xff0c;存储变得不可用。 服…