0. 环境
ubuntu18或者ubuntu22 - SIP服务器
win10 - SIP客户端1
ubuntu18 - SIP客户端2
1. SIP服务器搭建asterisk
1.0 环境
虚拟机ubuntu18 或者ubuntu22
1.1 直接安装
sudo apt-get install asterisk
1.2 配置用户信息
分为两个部分,第一部分是修改general的键值。第二部分是后面加上1001、1002、1003用户信息
sudo gedit /etc/asterisk/sip.conf
1.2.1 修改sip.conf中[general]栏相关参数
[general]
context = public
udpbindaddr = 0.0.0.0
tcpenable = yes
videosupport=yes
textsupport=yes
1.2.2 sip.conf后添加几个用户信息
[1001]
videosupport=always
type = friend
username=1001
secret = 1001
host = dynamic
canreinvite = no
dtmfmode = rfc2833
mailbox = mailbox
transport = udp
nat=yes
videosupport=always
maxcallbitrate=384
canreinvite=no
disallow=all
allow = ulaw
allow=alaw
allow=h263
allow=h264[1002]
videosupport=always
type = friend
username=1002
secret = 1002
host = dynamic
canreinvite = no
dtmfmode = rfc2833
mailbox = mailbox
transport = udp
nat=yes
videosupport=always
maxcallbitrate=384
canreinvite=no
disallow=all
allow = ulaw
allow=alaw
allow=h263
allow=h264[1003]
videosupport=always
type = friend
username=1003
secret = 1003
host = dynamic
canreinvite = no
dtmfmode = rfc2833
mailbox = mailbox
transport = udp
nat=yes
videosupport=always
maxcallbitrate=384
canreinvite=no
disallow=all
allow = ulaw
allow=alaw
allow=h263
allow=h264
1.3 配置打电话策略
sudo gedit /etc/asterisk/extensions.conf
[general]
static=yes
writeprotect=no[public]
exten => 1001,1,Dial(SIP/1001)
exten => 1002,1,Dial(SIP/1002)
exten => 1003,1,Dial(SIP/1003)
1.4 重启测试
修改完上面的两个配置文件完,就可以重启下asterisk重新生效。
sudo /etc/init.d/asterisk restart
sudo asterisk -r 进入asterisk 的控制台
查看在线设备情况:
sip show peers
1.5 参考文档
asterisk服务器的搭建和配置,https://blog.csdn.net/qq_35547417/article/details/111278958
freepbx的SIP通话客户端X-lite Yate eyeBeam Linphone,https://www.cnblogs.com/operationhome/p/9088964.html
2. 客户端方案一
ubuntu18 | asterisk | IP: 192.168.125.137 |
win10 | Linphone | IP: 192.168.125.1 |
ubuntu22 | Linphone | IP: 192.168.125.144 |
2.1 win10安装Linphone
下载Linphone
得到 Linphone-5.0.18-win64.exe
2.2 ubuntu22安装Linphone
环境
ubuntu22
下载Linphone
得到 Linphone-5.0.18.AppImage
安装依赖
sudo apt install fuse
修改权限
chmod +x Linphone-5.0.18.AppImage
直接运行
./Linphone-5.0.18.AppImage
2.3 互打电话
Linphone客户端需要配置一下SIP服务器的IP,以及本机号码、本机名字、本机密码这三项。
服务器配置好了三个用户分别是1001、1002、1003,用户名和密码一样。
3. 客户端方案二
测试了Linphone不支持和eyeBeam互打。
ubuntu22 | asterisk | IP: 192.168.125.137 |
win10 | eyeBeam | IP: 192.168.125.1 |
ubuntu18 | yate | IP: 192.168.125.144 |
3.1 win10安装eyeBeam
eyeBeam配置账户,也只需要根据asterisk的服务器IP和用户信息输入即可,域名默认端口是5060,可以省略。
3.2 ubuntu18安装yate
安装依赖qt4
sudo apt install qt4-default qt4-qmake qtcore4-l10n libllvm9 libmng2 libodbc1 libqt4-dbus libqt4-declarative libqt4-designer libqt4-dev libqt4-dev-bin libqt4-help libqt4-network libqt4-opengl libqt4-opengl-dev libqt4-qt3support libqt4-script libqt4-scripttools libqt4-sql libqt4-sql-odbc libqt4-svg libqt4-test libqt4-xml libqt4-xmlpatterns libqtdbus4 libqtgui4 qdbus qt4-linguist-tools
获取源码
git clone https://github.com/yatevoip/yate
配置
cd yate
./autogen
./configure
编译安装
make -j8
sudo make install-noapi
运行
export LD_LIBRARY_PATH=/home/xxjianvm/work/yate:$LD_LIBRARY_PATH
yate-qt4
配置本机用户和域名
注册成功的情况下,asterisk的cli命令行可以输入sip show peers观察到账号和IP信息。
3.3 互打电话