本文主要是介绍rtpengine faq,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
- 安装
我目前用的是debian11
cat /etc/debian_version,结果是11.8
我试过这样安装:
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
改成11.2.1也可以,但是11.3.1则失败
至于debian12我还没来得及做测试
不改任何配置的情况下服务是可以启动的
systemctl status rtpengine
systemctl status rtpengine-recording
# 为了节省篇幅就不贴日志了
用下面的命令可以检查到是否启动了内核转发模块:
# lsmod | grep -i rtp
xt_RTPENGINE 61440 4
x_tables 53248 3 nft_compat,xt_RTPENGINE,ip_tables
- rtpengine的配置
配置项目比较多,但可能比较难配置的可能是interface,下面是我的配置:
interface=priv/172.16.228.202;pub/172.16.228.202!113.113.113 # 1:1 nat
interface=priv/172.16.228.202;pub/172.16.228.202!113.113.113.113;inner/172.16.228.203 # double nic
interface=eth0
- rtpengine-ctl常用命令(类似FreeSWITCH的fs_cli)
rtpengine-ctl list numsessions
rtpengine-ctl list sessions all
rtpengine-ctl terminate all
rtpengine-ctl是用perl写的,如果不想用perl,可以考虑用curl,使能rtpengine的http配置即可
- 关于录音
先看这个配置:
recording-dir = /var/spool/rtpengine
recording-method = pcap
这个够简单,rtpengine一个进程就搞定,但是需要后期处理pcap文件
再看这个配置:
table = 0 #必须大于等于0
recording-method = proc
并且录音(rtpengine-recording)要这样配置:
# rtpengine-recording.conf
table = 0 #必须大于等于0
output-dir = /var/lib/rtpengine-recording
output-format = wav
mp3-bitrate = 48000
output-mixed = true
output-single = true
output-chmod = 0660
output-chown = root
output-chgrp = root
mysql-host = localhost
mysql-port = 3306
mysql-user = root
mysql-pass = root
mysql-db = rtpengine
log-mark-prefix = «
log-mark-suffix = »
log-facility = local2
同时,需要创建mysql数据库rtpengine,并创建下面的三张表:
CREATE TABLE `recording_calls` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`call_id` varchar(250) NOT NULL,
`start_timestamp` decimal(13,3) DEFAULT NULL,
`end_timestamp` decimal(13,3) DEFAULT NULL,
`status` enum('recording','completed','confirmed') DEFAULT 'recording',
PRIMARY KEY (`id`),
KEY `call_id` (`call_id`)
);
CREATE TABLE `recording_streams` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`call` int(10) unsigned NOT NULL,
`local_filename` varchar(250) NOT NULL,
`full_filename` varchar(250) NOT NULL,
`file_format` varchar(10) NOT NULL,
`stream` mediumblob,
`output_type` enum('mixed','single') NOT NULL,
`stream_id` int(10) unsigned NOT NULL,
`sample_rate` int(10) unsigned NOT NULL DEFAULT '0',
`channels` int(10) unsigned NOT NULL DEFAULT '0',
`ssrc` int(10) unsigned NOT NULL,
`start_timestamp` decimal(13,3) DEFAULT NULL,
`end_timestamp` decimal(13,3) DEFAULT NULL,
`tag_label` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
KEY `call` (`call`),
CONSTRAINT `fk_call_id` FOREIGN KEY (`call`) REFERENCES `recording_calls` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE TABLE `recording_metakeys` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`call` int(10) unsigned NOT NULL,
`key` char(255) NOT NULL,
`value` char(255) NOT NULL,
PRIMARY KEY (`id`),
KEY `prim_lookup` (`value`,`key`),
KEY `fk_call_idx` (`call`),
CONSTRAINT `fk_call_idx` FOREIGN KEY (`call`) REFERENCES `recording_calls` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
);
可参考这里:
https://blog.opensips.org/2018/02/16/audio-recording-and-speech-detection-experiments-with-opensips/
还有一种模式叫forwarding,可能用的人比较少,就不介绍了
- 讨论组在哪里:
https://groups.google.com/g/rtpengine/
ng控制协议是怎样的:
https://github.com/sipwise/rtpengine/blob/master/docs/ng_control_protocol.md
- 常用的flag
replace-session-connection # 更换c地址(连接地址)
original-sendrecv # 保持原始的sendrecv,默认情况下rtpengine自动给每个media添加
a=sendrecv
属性
未完待续
这篇关于rtpengine faq的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!