Asterisk 13 PJSIP 有时声音来了有时不来

Asterisk 13 PJSIP sometime sound coming sometime not coming

我最近用 PJSIP 和数据库设置了我的 asterisk 13。一切正常,但有时我听不到声音,而大多数时候我都能听到声音。所以我需要RTP软件?以下是详细日志,我正在寻找但没有发现任何语音或编解码器问题,因为我为所有设置了编解码器,这是本地环境所有本地服务,所以不应该有任何 nat 相关问题但似乎我配置了不正确的 nat问题。我迁移了,也注意到旧的 sip 服务器中也存在同样的问题,由于这个语音问题,我把它移到了新的服务器上。所以可以肯定不是软件问题,一定是配置问题。以下是我的日志。注意:我是 PJSIP 的新手,这是我第一次安装 PJSIP。

-- Executing [1567241111@default:1] AGI("PJSIP/192.168.56.103-00000004", "myagi.pl,0000FFFF0001,1567241111,,PJSIP/192.168.56.103-00000004,,1547882181.8") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/myagi.pl
<--- Transmitting SIP response (913 bytes) to UDP:192.168.56.103:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.56.103:5060;received=192.168.56.103;branch=z9hG4bK08e608fd
Call-ID: 25918c527ec2200b25e99b862ff7ac80@192.168.56.103:5060
From: "vendorTest" <sip:0000FFFF0001@192.168.56.103>;tag=as7756e843
To: <sip:1567241111@192.168.56.102>;tag=1bf6a0d2-1c8b-431f-91c7-a074337a7b88
CSeq: 102 INVITE
Server: Asterisk PBX certified/13.21-cert3
Contact: <sip:192.168.56.102:5060>
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, REFER, MESSAGE
Supported: 100rel, timer, replaces, norefersub
Content-Type: application/sdp
Content-Length:   288

v=0
o=- 2131651698 2131651700 IN IP4 192.168.56.102
s=Asterisk
c=IN IP4 192.168.56.102
t=0 0
m=audio 24874 RTP/AVP 0 8 3 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

<--- Received SIP request (460 bytes) from UDP:192.168.56.103:5060 --->
ACK sip:192.168.56.102:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.56.103:5060;branch=z9hG4bK62ff354e
Max-Forwards: 70
From: "vendorTest" <sip:0000FFFF0001@192.168.56.103>;tag=as7756e843
To: <sip:1567241111@192.168.56.102>;tag=1bf6a0d2-1c8b-431f-91c7-a074337a7b88
Contact: <sip:0000FFFF0001@192.168.56.103:5060>
Call-ID: 25918c527ec2200b25e99b862ff7ac80@192.168.56.103:5060
CSeq: 102 ACK
User-Agent: Asterisk PBX 11.13.1~dfsg-2+deb8u5
Content-Length: 0

我的 PJSIP 配置调用点

[192.168.56.103]
type = aor
contact = sip:192.168.56.103
maximum_expiration = 60
minimum_expiration = 60
default_expiration = 180

[192.168.56.103]
type = identify
endpoint = 192.168.56.103
match =  192.168.56.103

[192.168.56.103]
type = endpoint
context = default
dtmf_mode = rfc4733
disallow = all
allow =all
direct_media = yes
language = en
aors = 159.203.27.198
t38_udptl = yes
t38_udptl_ec = none
rtp_symmetric = yes
force_rport = no
rewrite_contact = yes
direct_media = no

我的服务器

192.168.56.103 - Asterisk 13 with PJSIP  - call receiver
192.168.56.102 - Asterisk 11 with PJSIP - Caller

为了清楚起见,我已经设置了语音信箱,所以另一部分实际上是带星号的回复,正常情况下它要求输入密码并且它输入了 10 次但有 2 次没有语音?知道我哪里做错了。我应该安装 RTP 引擎还是 RTPProxy。我听到很多人说我们必须有 RTP、Stun 或 ICE 服务器,所以如果我将 opensips 作为 SBC 放在前面而不是转发对 Asterisk 的调用,那将是一个更好的环境,因为我期望在当前设置中有更多的服务器所以需要强大的通信基础设施,没有任何声音问题。

问题已通过使用 RTP 调试解决,我注意到由于防火墙的原因,无法从另一端接收声音数据包。防火墙设置了 10000-20000 个端口,但是这个星号发送了不同的端口,现在我使用 RTP.conf 端口修复了,而且语音也很完美。