【Linux】Centos7安装部署unimrcp,搭建MRCP服务器

发布于:2024-05-16 ⋅ 阅读:(62) ⋅ 点赞:(0)

yum install libtool

yum install libtool-ltdl-devel

yum install libsofia-sip-ua

find / -name libsofia-sip-ua.so.0 2>/dev/null

# 设置环境变量:如果库文件存在但不在默认搜索路径中,你可以通过设置 LD_LIBRARY_PATH 环境变量来告诉系统在哪里可以找到它。

# 例如,如果库文件在 /usr/local/lib 中,你可以在你的 shell 脚本或命令行中添加以下命令:

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH #临时有效

echo 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH' >> ~/.bashrc #永久有效

上传文件到/usr/local

unimrcp-deps-1.6.0.tar.gz

unimrcp-1.6.0.tar.gz

编译安装unimrcp-deps-1.6.0.

# cd /usr/local

# tar vzxf unimrcp-deps-1.6.0.tar.gz

# cd unimrcp-deps-1.6.0/

# ./build-dep-libs.sh

这是个交互式脚本,一路选y:

编译安装unimrcp-1.6.0

# tar vzxf unimrcp-1.6.0.tar.gz

# cd unimrcp-1.6.0/

# ./bootstrap

默认安装到 /usr/local/unimrcp, 按自己偏好设置prefix

# ./configure

# make && make install

注:

问题1:/usr/local/apr/lib/libapr-1.so: undefined reference to `uuid_generate@UUID_1.0'

collect2: error: ld returned 1 exit status

make[2]: *** [unimrcpclient] 错误 1

make[2]: 离开目录“/usr/local/unimrcp-1.6.0/platforms/unimrcp-client”

make[1]: *** [all-recursive] 错误 1

make[1]: 离开目录“/usr/local/unimrcp-1.6.0/platforms”

make: *** [all-recursive] 错误 1

解决方法:1、确保已安装 yum install libuuid-devel

2、检查库文件路径 ldconfig -p | grep libuuid

3、手动指定库文件(根据 2中所查到的路径)

export LDFLAGS="-L/path/to/libuuid/lib"

export LIBS="-luuid"

4、重新编译、安装

./configure ... # 其他configure选项

make && make install

加载程序

服务端:

打开一个终端,执行:

# cd /usr/local/unimrcp/bin

# ./unimrcpserver

客户端:

打开另一个终端,执行:

# cd /usr/local/unimrcp/bin

# ./umc

注 :

问题1:./unimrcpserver: error while loading shared libraries: libsofia-sip-ua.so.0: cannot open shared object file: No such file or directory

解决方法:find / -name libsofia-sip-ua.so.0 2>/dev/null

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH #临时有效

echo 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH' >> ~/.bashrc #永久有效

开机自启

创建一个系统服务文件。

假设你的Unimrcp安装在 /usr/local/unimrcp目录下,你可以创建一个名为unimrcp.service的文件在/etc/systemd/system/目录下

[Unit]

Description=Unimrcp Server

After=network.target

[Service]

Type=forking

ExecStart=/usr/local/unimrcp/bin/unimrcpserver start

ExecStop=/usr/local/unimrcp/bin/unimrcpserver stop

User=root

Group=root

Restart=on-failure

RestartSec=5

[Install]

WantedBy=multi-user.target

重新加载systemd管理器配置。

sudo systemctl daemon-reload

设置Unimrcp服务开机自启

sudo systemctl enable unimrcp.service

启动Unimrcp服务 systemctl start unimrcp.service  停止开机自启动 systemctl disable unimrcp.service 查看服务当前状态 systemctl status unimrcp.service 重新启动服务 systemctl restart unimrcp.service 

注:

问题1:没有正常开机自启,执行 journalctl -u unimrcp.service 发现报错

/usr/local/unimrcp/bin/unimrcpserver: error while loading shared libraries: libsofia-sip-ua.so.0: cannot open shared object file: No such file or directory

解决方法:1、根据 sudo find / -name libsofia-sip-ua.so.0 2>/dev/null 找到对应的路径

2、在unimrcp.service里的[Service] 节点添加

Environment=LD_LIBRARY_PATH=/usr/local/lib

3、重新加载配置文件

sudo systemctl daemon-reload

场景测试

Client端预设了几个CLI命令,提供几个MRCP测试场景:

语音合成:run synth

语音识别:run recog

DTMF识别: run dtmf

录音: run rec

语音鉴别:run verify

Client端输入 run recog:

Server端输出: