echo 'deb https://deb.sipwise.com/spce/mr11.1.1/ bullseye main' > /etc/apt/sources.list.d/sipwise.list
echo 'deb-src https://deb.sipwise.com/spce/mr11.1.1/ bullseye main' >> /etc/apt/sources.list.d/sipwise.list
wget -q -O - https://deb.sipwise.com/spce/keyring/sipwise-keyring-bootstrap.gpg | apt-key add -
apt-get update && apt-get install -y ngcp-rtpengine
安装之后日志有点小问题,有二个解决办法:
修改/etc/rsyslog.conf,插入下面的几行:
if $programname == ["rtpengine","rtpengine-recording"] then {
-/var/log/rtpengine.log;SipwiseTraditionalFormat
stop
}
修改/lib/systemd/system/ngcp-rtpengine-daemon.service
ExecStart=/usr/sbin/rtpengine -f -E --no-log-timestamps ...
把 -E 删除即可。
此外,rtpengine支持内核转发(In-Kernal Packet Forwarding,据说效率极高),但如果debian内核版本(uname -r)变了,rtpengine需要重新编译。
下面是sipwise的/etc/rsyslog.conf文件:
# /etc/rsyslog.conf configuration file for rsyslog
#
# For more information install rsyslog-doc and see
# /usr/share/doc/rsyslog-doc/html/configuration/index.html
#################
#### MODULES ####
#################
module(load="imuxsock") # provides support for local system logging
module(load="imklog") # provides kernel logging support
module(load="immark") # provides --MARK-- message capability
# provides UDP syslog reception
#module(load="imudp")
#input(type="imudp" port="514")
# provides TCP syslog reception
#module(load="imtcp")
#input(type="imtcp" port="514")
###########################
#### GLOBAL DIRECTIVES ####
###########################
#
# Use traditional timestamp format.
# To enable high precision timestamps, comment out the following line.
#
#$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
#
# Use format with server-time instead of client-time.
#
$template SipwiseTraditionalFormat,"%timegenerated% %HOSTNAME% %syslogtag%%msg:::drop-last-lf%\n"
$template SipwiseTraditionalSevFormat,"%timegenerated% %HOSTNAME% (%syslogseverity-text%) %syslogtag%%msg:::drop-last-lf%\n"
$template SipwiseTraditionalFormatHighPrec,"%timegenerated%.%timegenerated:21:26:date-rfc3339% %HOSTNAME% %syslogtag%%msg:::drop-last-lf%\n"
$template SipwiseHTTPDAccessFormat,"%msg:2:$:drop-last-lf%\n"
$template SipwiseHTTPDErrorFormat,"%msg:2:$:drop-last-lf%\n"
$template SipwiseRedisFormat,"%timegenerated% %HOSTNAME% (%syslogseverity-text%) %syslogtag% %msg:R,ERE,1,FIELD:^[ 0-9]+:[A-Z] [0-9]{1,2} [a-zA-Z]{3} [0-9.:]{12} . (.*)$--end:drop-last-lf%\n"
$ActionFileDefaultTemplate SipwiseTraditionalFormat
#
# Set the default permissions for all log files.
#
$FileOwner root
$FileGroup adm
$FileCreateMode 0640
$DirCreateMode 0755
$Umask 0022
#
# Where to place spool and state files
#
$WorkDirectory /var/spool/rsyslog
# Memory and disk Queuing support
$ActionQueueType LinkedList
$ActionQueueFileName SL
$ActionQueueMaxDiskSpace 4g
$ActionQueueSaveOnShutdown on
$ActionResumeRetryCount -1
# accept 4k messages so ossbss xml dumps will be logged completely
$MaxMessageSize 4k
# Rate Limiting
$SystemLogRateLimitInterval 0
$SystemLogRateLimitBurst 0
####################
#### NGCP rules ####
####################
#
# NGCP: We need to declare the rules before the $IncludeConfig otherwise,
# those could break the precedence ordering.
#
#Syslogtag filter rules for ngcp services
# Kamailio LB
if $syslogfacility-text == 'local6' and $msg contains 'M=OPTIONS' then {
-/var/log/ngcp/kamailio-options-lb.log;SipwiseTraditionalFormatHighPrec
stop
}
:programname, isequal, "lb" {
-/var/log/ngcp/kamailio-lb.log;SipwiseTraditionalFormatHighPrec
stop
}
# Kamailio Proxy
if $syslogfacility-text == 'local7' and $msg contains 'M=OPTIONS' then {
-/var/log/ngcp/kamailio-options-proxy.log;SipwiseTraditionalFormatHighPrec
stop
}
:programname, isequal, "proxy" {
-/var/log/ngcp/kamailio-proxy.log;SipwiseTraditionalFormatHighPrec
stop
}
:programname, isequal, "prosody" {
-/var/log/ngcp/xmpp.log;SipwiseTraditionalSevFormat
stop
}
# Re-route dnsmasq to special log
if $programname == ["dnsmasq-dhcp","dnsmasq-tftp"] then {
-/var/log/ngcp/ngcp-bootenv.log
stop
}
:programname, isequal, "asterisk" {
-/var/log/ngcp/voicemail.log
stop
}
:programname, isequal, "systemd-timesyncd" {
-/var/log/ngcp/ntp.log;SipwiseTraditionalSevFormat
stop
}
:programname, contains, "prometheus" {
-/var/log/ngcp/prometheus.log
stop
}
:programname, contains, "victoria-metrics" {
-/var/log/ngcp/prometheus.log
stop
}
# NGINX
:programname, isequal, "nginx" {
-/var/log/ngcp/nginx/error.log;SipwiseHTTPDErrorFormat
stop
}
:programname, isequal, "ngcpcfg_api_access" {
-/var/log/ngcp/nginx/ngcpcfg_api_access.log;SipwiseHTTPDAccessFormat
stop
}
:programname, isequal, "ngcpcfg_api_error" {
-/var/log/ngcp/nginx/ngcpcfg_api_error.log;SipwiseHTTPDErrorFormat
stop
}
:programname, isequal, "admin_api_access" {
-/var/log/ngcp/nginx/admin_api_access.log;SipwiseHTTPDAccessFormat
stop
}
:programname, isequal, "admin_api_debug" {
-/var/log/ngcp/nginx/admin_api_debug.log;SipwiseHTTPDAccessFormat
stop
}
:programname, isequal, "admin_api_error" {
-/var/log/ngcp/nginx/admin_api_error.log;SipwiseHTTPDErrorFormat
stop
}
:programname, isequal, "approx_ro_access" {
-/var/log/ngcp/nginx/approx_ro_access.log;SipwiseHTTPDAccessFormat
stop
}
:programname, isequal, "approx_ro_error" {
-/var/log/ngcp/nginx/approx_ro_error.log;SipwiseHTTPDErrorFormat
stop
}
:programname, isequal, "autoprov_access" {
-/var/log/ngcp/nginx/autoprov_access.log;SipwiseHTTPDAccessFormat
stop
}
:programname, isequal, "autoprov_error" {
-/var/log/ngcp/nginx/autoprov_error.log;SipwiseHTTPDErrorFormat
stop
}
:programname, isequal, "autoprov_bootstrap_access" {
-/var/log/ngcp/nginx/autoprov_bootstrap_access.log;SipwiseHTTPDAccessFormat
stop
}
:programname, isequal, "autoprov_bootstrap_error" {
-/var/log/ngcp/nginx/autoprov_bootstrap_error.log;SipwiseHTTPDErrorFormat
stop
}
:programname, isequal, "csc_access" {
-/var/log/ngcp/nginx/csc_access.log;SipwiseHTTPDAccessFormat
stop
}
:programname, isequal, "csc_debug" {
-/var/log/ngcp/nginx/csc_debug.log;SipwiseHTTPDAccessFormat
stop
}
:programname, isequal, "csc_error" {
-/var/log/ngcp/nginx/csc_error.log;SipwiseHTTPDErrorFormat
stop
}
:programname, isequal, "pushd_access" {
-/var/log/ngcp/nginx/pushd_access.log;SipwiseHTTPDAccessFormat
stop
}
if $programname == ["oss","csc","provisioning",
"apache2","/usr/sbin/apache2"] then {
-/var/log/ngcp/oss.log
stop
}
:programname, isequal, "ngcp_panel_fastcgi.pl" {
-/var/log/ngcp/panel-fcgi.log
stop
}
if $programname == 'ngcp-panel' and $msg startswith ' DEBUG' then {
-/var/log/ngcp/panel-debug.log
stop
}
$FileGroup _ngcp-li
if $programname == 'ngcp-panel' and $msg contains 'CALLED=API' then {
-/var/log/ngcp/api.log
stop
}
$FileGroup adm
:programname, isequal, "ngcp-panel" {
-/var/log/ngcp/panel.log
stop
}
if $programname == ["rtpengine","rtpengine-recording"] then {
-/var/log/ngcp/rtp.log;SipwiseTraditionalFormatHighPrec
stop
}
if $programname == ["mediator","ngcp-mediator"] then {
-/var/log/ngcp/cdr.log;SipwiseTraditionalSevFormat
stop
}
:programname, isequal, "ngcp-rate-o-mat" {
-/var/log/ngcp/rate-o-mat.log;SipwiseTraditionalSevFormat
stop
}
:programname, isequal, "ngcp-cdr-exporter" {
-/var/log/ngcp/cdr-exporter.log;SipwiseTraditionalSevFormat
stop
}
:programname, isequal, "ngcp-event-exporter" {
-/var/log/ngcp/cdr-exporter.log;SipwiseTraditionalSevFormat
stop
}
:syslogtag, startswith, "ngcpcfg" {
-/var/log/ngcp/ngcpcfg.log;SipwiseTraditionalSevFormat
stop
}
if $syslogtag contains ["redis", "keydb"] then {
-/var/log/ngcp/redis.log;SipwiseRedisFormat
stop
}
:programname, isequal, "ngcp-licensed" {
-/var/log/ngcp/licensed.log
stop
}
:programname, startswith, "ffproxy" {
-/var/log/ngcp/ffproxy.log
stop
}
:programname, startswith, "FFPROXY" {
-/var/log/ngcp/ffproxy.log
stop
}
:programname, isequal, "ngcp-service" {
-/var/log/ngcp/service.log
stop
}
:programname, isequal, "ngcp-witnessd" {
-/var/log/ngcp/ngcp-witnessd.log;SipwiseTraditionalSevFormat
stop
}
:programname, isequal, "ngcp-exporter" {
-/var/log/ngcp/exporter.log
stop
}
:programname, isequal, "ngcp-rest-api" {
-/var/log/ngcp/rest-api.log
stop
}
# MT#7349 ngcp-sems 1.4 do not use the proper programname
if $programname == ["ngcp-sems","sems"] then {
-/var/log/ngcp/sems.log
stop
}
#
# Include all config files in /etc/rsyslog.d/
#
$IncludeConfig /etc/rsyslog.d/*.conf
#Log by facility.
auth,authpriv.* /var/log/auth.log
*.*;auth,authpriv.none,cron.none,mail.none -/var/log/syslog
cron.* /var/log/cron.log
daemon.* -/var/log/daemon.log
kern.* -/var/log/kern.log
mail.* -/var/log/mail.log
user.* -/var/log/user.log
#
# Logging for the mail system. Split it up so that
# it is easy to write scripts to parse these files.
#
mail.info -/var/log/mail.info
mail.warn -/var/log/mail.warn
mail.err /var/log/mail.err
#
# Some "catch-all" log files.
#
*.=debug;\
auth,authpriv.none;\
mail.none -/var/log/debug
*.=info;*.=notice;*.=warn;\
auth,authpriv.none;\
cron,daemon.none;\
mail.none -/var/log/messages
#
# Emergencies are sent to everybody logged in.
#
*.emerg :omusrmsg:*