环境
ubuntu 20.04 x64
概述
测试客户端使用sipdroid
服务端刚开始使用的是ASTERISK, 而后改用miniSIPServer
ASTERISK
参考Install Asterisk 18 LTS on Ubuntu 20.04|18.04
在ubuntu20.04下, 可以跳过前面的源码编译部分直接安装sudo apt-get install asterisk
不使用源码编译的方式是否会导致后面打印输出的错误, 各位自行验证
/etc/asterisk/asterisk.conf
runuser = asterisk ; The user to run as. rungroup = asterisk ; The group to run as
/etc/asterisk/sip.conf
[9001] type=friend host=dynamic secret=9001 [9002] type=friend host=dynamic secret=9002
/etc/asterisk/extensions.conf
[general] static=yes writeprotect=no priorityjumping=no autofallthrough=yes clearglobalvars=no [default] exten => 9001,1,Dial(SIP/9001,10) exten => 9002,1,Dial(SIP/9002,10)
anson@anson-MR26:/etc/asterisk$ sudo systemctl status asterisk ● asterisk.service - Asterisk PBX Loaded: loaded (/lib/systemd/system/asterisk.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2021-10-15 19:20:58 CST; 2s ago Docs: man:asterisk(8) Main PID: 80345 (asterisk) Tasks: 77 (limit: 18935) Memory: 38.8M CGroup: /system.slice/asterisk.service ├─80345 /usr/sbin/asterisk -g -f -p -U asterisk └─80346 astcanary /var/run/asterisk/alt.asterisk.canary.tweet.tweet.tweet 80345 10月 15 19:20:58 anson-MR26 asterisk[80345]: [Oct 15 19:20:58] ERROR[80345]: loader.c:2249 load_modules: cel_radius declined to load. 10月 15 19:20:58 anson-MR26 asterisk[80345]: [Oct 15 19:20:58] ERROR[80345]: loader.c:2249 load_modules: cdr_pgsql declined to load. 10月 15 19:20:58 anson-MR26 asterisk[80345]: [Oct 15 19:20:58] ERROR[80345]: loader.c:2249 load_modules: cel_sqlite3_custom declined to load. 10月 15 19:20:58 anson-MR26 asterisk[80345]: [Oct 15 19:20:58] ERROR[80345]: loader.c:2249 load_modules: cdr_sqlite3_custom declined to load. 10月 15 19:20:58 anson-MR26 asterisk[80345]: [Oct 15 19:20:58] ERROR[80345]: loader.c:2249 load_modules: chan_unistim declined to load. 10月 15 19:20:58 anson-MR26 asterisk[80345]: [Oct 15 19:20:58] ERROR[80345]: loader.c:2249 load_modules: pbx_dundi declined to load. 10月 15 19:20:58 anson-MR26 asterisk[80345]: [Oct 15 19:20:58] ERROR[80345]: loader.c:2249 load_modules: res_hep_rtcp declined to load. 10月 15 19:20:58 anson-MR26 asterisk[80345]: [Oct 15 19:20:58] ERROR[80345]: loader.c:2249 load_modules: res_hep_pjsip declined to load. 10月 15 19:20:58 anson-MR26 asterisk[80345]: Asterisk Ready. 10月 15 19:20:58 anson-MR26 systemd[1]: Started Asterisk PBX.
anson@anson-MR26:/etc/asterisk$ sudo asterisk -r Asterisk 16.2.1~dfsg-2ubuntu1, Copyright (C) 1999 - 2018, Digium, Inc. and others. Created by Mark Spencer <markster@digium.com> Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details. This is free software, with components licensed under the GNU General Public License version 2 and other licenses; you are welcome to redistribute it under certain conditions. Type 'core show license' for details. ========================================================================= Running as user 'asterisk' Running under group 'asterisk' Connected to Asterisk 16.2.1~dfsg-2ubuntu1 currently running on anson-MR26 (pid = 80345)
到这里, 可以开始打开sipdroid, 分别使用 9001 和 9002 账号密码进行设置并拨号.
测试的结果是: 可以拨号对方也响铃, 但接通后, 没有音频, 原因未知
miniSIPServer
实用的SIP服务器 miniSIPServer
Ubuntu下的miniSIPServer
下载DEB包, 装好依赖, 如QT5之类的, 再按文档执行:
anson@anson-MR26:/opt/sipserver$ /opt/sipserver/minisipserver-cli 2021-10-15 21:05:25 | STUN server: 192.168.43.175:3478 2021-10-15 21:05:25 | STUN server: 192.168.43.175:3479 2021-10-15 21:05:25 | SIP server address (ipv4) is '192.168.43.175' 2021-10-15 21:05:25 | SIP server address (ipv6) is '2409:8954:e6a8:5977:1a27:a2b:7834:2c19' 2021-10-15 21:05:25 | SIP server UDP port is 5060 2021-10-15 21:05:25 | SIP server TCP port is 5060 2021-10-15 21:05:25 | HTTP server is running at port 8080, default password is '2C98487E501ABBF3'. 2021-10-15 21:05:25 | All data are stored in '/home/anson/.minisipserver'. 2021-10-15 21:05:25 | This version is 'V38 (5 clients) build 20210923, linux'. 2021-10-15 21:05:25 | Server is ready now.
通过打印信息, 可以访问管理页面:
SIP server web system 登陆信息中的随机密码即可进入.
默认配置了100, 101, 102 三个账号, 对于测试来讲足够了.
实测, 可以拨号语音!