我在客户所在地的 CentOS 服务器上运行 Asterisk 16.9.0。该服务器通过电信公司提供的 SIP 中继进行连接。
我在那里的几台电脑上配置了 Zoiper,使用 IAX 连接可以接通来电和拨出电话。出于某种原因,通过 SIP 连接会出现音频问题。现在,分机与分机之间的通话、分机与外部之间的通话以及来电都运行正常,没有问题。
现在我正尝试从办公室的 PC 连接到该服务器。没有 VPN;端口 5060 已从客户端的防火墙转发。
从 Zoiper,我使用 IAX 进行连接,控制台显示客户端已注册。我可以拨打外线号码,并能听清被叫方的声音。被叫方听到的是我的声音失真严重。
使用 Grandstream GXP1625,控制台显示 SIP 客户端已连接。拨出后,我可以听到被叫方的声音,但他听不到声音,通话在 60 秒后断开。
我应该检查/改变什么?
Connected to Asterisk 16.9.0 currently running on server2 (pid = 2733)
-- Registered SIP '1001' at xx.xx.xx.xx:61548
-- Unregistered SIP '1001'
-- Registered IAX2 '1001' (UNAUTHENTICATED) at xx.xx.xx.xx:4569
-- Accepting UNAUTHENTICATED call from xx.xx.xx.xx:4569:
-- > requested format = opus,
-- > requested prefs = (),
-- > actual format = gsm,
-- > host prefs = (gsm|ilbc|speex|g729|g723|ulaw|alaw|g726|g726aal2|adpcm|slin|slin16|lpc10|speex16|g722|siren7|siren14|testlaw|g719|opus...),
-- > priority = mine
-- Executing [x-Called num-x@test:1] Set("IAX2/1001-3187", "CALLERID(num)=99222333") in new stack
-- Executing [x-Called num-x@test:2] Dial("IAX2/1001-3187", "SIP/x-Called num-x@ntc-out") in new stack
== Using SIP RTP CoS mark 5
-- Called SIP/x-Called num-x@ntc-out
-- SIP/ntc-out-0000001b is ringing
-- SIP/ntc-out-0000001b is making progress passing it to IAX2/1001-3187
-- SIP/ntc-out-0000001b answered IAX2/1001-3187
-- Channel SIP/ntc-out-0000001b joined 'simple_bridge' basic-bridge <f874b82d-74f3-430f-8475-2ea62dec3ff6>
-- Channel IAX2/1001-3187 joined 'simple_bridge' basic-bridge <f874b82d-74f3-430f-8475-2ea62dec3ff6>
-- Channel SIP/ntc-out-0000001b left 'simple_bridge' basic-bridge <f874b82d-74f3-430f-8475-2ea62dec3ff6>
-- Channel IAX2/1001-3187 left 'simple_bridge' basic-bridge <f874b82d-74f3-430f-8475-2ea62dec3ff6>
== Spawn extension (test, x-Called num-x, 2) exited non-zero on 'IAX2/1001-3187'
-- Hungup 'IAX2/1001-3187'
-- Unregistered IAX2 '1001' (UNAUTHENTICATED)
-- Registered SIP '1001' at xx.xx.xx.xx:53486
== Using SIP RTP CoS mark 5
-- Executing [x-Called num-x@test:1] Set("SIP/1001-0000001d", "CALLERID(num)=99222333") in new stack
-- Executing [x-Called num-x@test:2] Dial("SIP/1001-0000001d", "SIP/x-Called num-x@ntc-out") in new stack
== Using SIP RTP CoS mark 5
-- Called SIP/x-Called num-x@ntc-out
-- SIP/ntc-out-0000001e is ringing
-- SIP/ntc-out-0000001e is making progress passing it to SIP/1001-0000001d
-- SIP/ntc-out-0000001e answered SIP/1001-0000001d
-- Channel SIP/ntc-out-0000001e joined 'simple_bridge' basic-bridge <57e8fc55-7721-4465-840c-3d37bc76329c>
-- Channel SIP/1001-0000001d joined 'simple_bridge' basic-bridge <57e8fc55-7721-4465-840c-3d37bc76329c>
[Mar 17 22:13:26] WARNING[2978]: chan_sip.c:4126 retrans_pkt: Retransmission timeout reached on transmission 187fd4970375442eafe988f72e7ce772 for seqno 413 (Critical Response) -- See https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions
Packet timed out after 31999ms with no response
[Mar 17 22:13:26] WARNING[2978]: chan_sip.c:4150 retrans_pkt: Hanging up call 187fd4970375442eafe988f72e7ce772 - no reply to our critical packet (see https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions).
-- Channel SIP/1001-0000001d left 'simple_bridge' basic-bridge <57e8fc55-7721-4465-840c-3d37bc76329c>
-- Channel SIP/ntc-out-0000001e left 'simple_bridge' basic-bridge <57e8fc55-7721-4465-840c-3d37bc76329c>
== Spawn extension (test, x-Called num-x, 2) exited non-zero on 'SIP/1001-0000001d'
-- Unregistered SIP '1001'
编辑 查看日志,我发现 SIP 连接存在网络问题,因为服务器无法将数据包发送回我的客户端 PC。因此,我通过 VPN 连接到客户端的 LAN,并将客户端上的连接地址从防火墙的外部 IP 更改为 Asterisk 服务器的 LAN IP。结果相同。
编辑 sip.conf 用于电话线路。该线路连接到服务器的第二个网络端口。
[telco]
type=friend
description=Telco
context=from-telco
externip = 10.12.15.222 <-- My server's 2nd port IP
localnet = 10.12.15.224/29
host=10.12.15.225 <-- telco's IP
media_address =10.12.15.226
permit=10.12.15.224/29
username=
fromuser=
secret=
insecure=invite
canreinvite=yes
qualify=yes
dtmfmode=rfc2833
allow=ulaw,alaw,gsm
nat=no
用户配置文件:
[101]
type=peer
username=clientpc
callerid="Client PC" <101>
secret=123123123
context=test
host=dynamic
qualify=yes
allow=all
nat=no
[1001]
type=peer
callerid="My office" <1001>
username=hussain
password=111222333
context=test
host=dynamic
allow=all
qualify=yes
nat=force_rport,comedia
答案1
您应该阅读更多有关网络和 NAT 遍历的内容