我最近在 AWS EC2 实例上安装了我的第一个 Asterisk,遇到了一些小问题,目前手机没有收到挂断指令,从服务器播放文件时也没有声音。
我认为问题与服务器实例的公共和私有 IP 问题有关,所以我在实例上有一个 x.x.x.x 的公共 IP 和一个 y.y.y.y 的私有 IP,电话在 x.x.x.x 上注册到服务器并可以拨打分机,现在通过一些 NAT 更改,我可以在电话之间听到和交谈,因为他们不会在通话结束时挂断, 此外,如果从服务器播放文件,则在通话结束时没有声音和挂断。
我尝试了防火墙强制关闭并且所有流量在实例上打开所有端口,所以我认为这不是前壁或 NAT 问题,因为解决了这些问题,我认为这与内部和外部 IP 不同有关,或者实例上的 RTP 原型端口未在某处设置
手机显示它们正在连接,但随后 RTP 协议失败(并且它显示 y.y.y.y 迭代 IP,如下所示,当我期望它显示公共 IP x.x.x.x
16/4/2019 15:30:06 [NOTICE] PHN: TPL: Socket 364 idle/connect timeout
16/4/2019 15:30:10 [ERROR ] PHN: SIP: transaction_timeout udp: 1001331 (32000)
16/4/2019 15:30:10 [ERROR ] PHN: SIP: transport error: 1001331 -> udp:y.y.y.y:5060
16/4/2019 15:30:10 [NOTICE] PHN: SIP: Add dirty host: udp:y.y.y.y:5060 (0 sec)
16/4/2019 15:30:10 [NOTICE] PHN: SIP: final transport error: 1001331 -> udp:y.y.y.y:5060
16/4/2019 15:30:10 [ERROR ] PHN: SIP: transport error 1001331: generating fake 599
16/4/2019 15:30:10 [NOTICE] MEDIA: MediaIpc::rtpClose: RP72
16/4/2019 15:30:10 [NOTICE] MEDIA: MediaIpc::rtpClose: RC72
16/4/2019 15:30:12 [WARN ] PHN: SIP: process_registrar_packet: 401 needs 128 bit nonce
16/4/2019 15:30:12 [NOTICE] PHN: SIP: process auth:Match challenge for user=WB001, realm=asterisk
16/4/2019 15:30:12 [NOTICE] PHN: RTP: set_destination RP73 adr=y.y.y.y:19684
16/4/2019 15:30:12 [WARN ] MEDIA: CallStats: 2156890680 not found
服务器显示以下日志。
== Using SIP RTP CoS mark 5
-- Executing [200@LocalSets:1] Answer("SIP/WB001-00000015", "") in new stack
-- Executing [200@LocalSets:2] Playback("SIP/WB001-00000015", "hello-world") in new stack
-- <SIP/WB001-00000015> Playing 'hello-world.gsm' (language 'en')
-- Executing [200@LocalSets:3] Hangup("SIP/WB001-00000015", "") in new stack
== Spawn extension (LocalSets, 200, 3) exited non-zero on 'SIP/WB001-00000015'
[Apr 16 15:30:45] WARNING[13228]: chan_sip.c:4119 retrans_pkt:
Retransmission timeout reached on transmission f2e6b55c11ce-zqpp4q4dbedu for seqno 2 (Critical Response) -- See https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions
Packet timed out after 31998ms with no response
== Using SIP RTP CoS mark 5
-- Executing [101@LocalSets:1] Dial("SIP/WB001-00000016", "SIP/WB002") in new stack
== Using SIP RTP CoS mark 5
-- Called SIP/WB002
-- SIP/WB002-00000017 is ringing
-- SIP/WB002-00000017 is ringing
-- SIP/WB002-00000017 answered SIP/WB001-00000016
-- Channel SIP/WB002-00000017 joined 'simple_bridge' basic-bridge <87c7a794-f9e6-4488-8957-9c0db9e0234f>
-- Channel SIP/WB001-00000016 joined 'simple_bridge' basic-bridge <87c7a794-f9e6-4488-8957-9c0db9e0234f>
[Apr 16 15:32:14] WARNING[13228]: chan_sip.c:4119 retrans_pkt: Retransmission timeout reached on transmission 49e7b55c4a45-rd1is68l1q0a for seqno 2 (Critical Response) -- See https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions
Packet timed out after 32000ms with no response
[Apr 16 15:32:14] WARNING[13228]: chan_sip.c:4143 retrans_pkt: Hanging up call 49e7b55c4a45-rd1is68l1q0a - no reply to our critical packet (see https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions).
-- Channel SIP/WB001-00000016 left 'native_rtp' basic-bridge <87c7a794-f9e6-4488-8957-9c0db9e0234f>
== Spawn extension (LocalSets, 101, 1) exited non-zero on 'SIP/WB001-00000016'
-- Channel SIP/WB002-00000017 left 'native_rtp' basic-bridge <87c7a794-f9e6-4488-8957-9c0db9e0234f>
[Apr 16 15:32:14] WARNING[13228][C-00000011]: chan_sip.c:24312 handle_response_invite: Re-invite to non-existing call leg on other UA. SIP dialog '3ca4381a658c7f5f2cee3d8c02acb2a7@172.31.29.187:5060'. Giving up.
如果其他人遇到此类问题,那是编解码器和防火墙问题,一旦打开服务器上的 RTP 端口(在传入的 EC2 实例上,确保 TCP 和 UDP 与 RTP.conf 中的 RTP 起点和终点匹配)
在星号 CLI 中,将详细程度设置为 3 或更多,然后开始 SIP 调试(您可以在 config.conf 或 CLI 中执行此操作)
我在电话中返回了以下内容
== Using SIP RTP CoS mark 5
-- Executing [200@LocalSets:1] Answer("SIP/WB001-00000000", "") in new stack
-- Executing [200@LocalSets:2] Playback("SIP/WB001-00000000", "hello-world") in new stack
[Apr 18 12:32:02] WARNING[3055][C-00000001]: channel.c:5579 set_format: Unable to find a codec translation path: (gsm) -> (g729)
[Apr 18 12:32:02] WARNING[3055][C-00000001]: file.c:1252 ast_streamfile: Unable to open hello-world (format (g729)): No such file or directory
[Apr 18 12:32:02] WARNING[3055][C-00000001]: app_playback.c:492 playback_exec: Playback failed on SIP/WB001-00000000 for hello-world
-- Executing [200@LocalSets:3] Hangup("SIP/WB001-00000000", "") in new stack
== Spawn extension (LocalSets, 200, 3) exited non-zero on 'SIP/WB001-00000000'
[Apr 18 12:32:34] WARNING[1334]: chan_sip.c:4119 retrans_pkt: Retransmission timeout reached on transmission 3160b85c0cbe-bx3kp12qqxec for seqno 2 (Critical Response) -- See https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions
数据包在 32001 毫秒后超时,无响应
问题是新安装我没有获得 G729 许可证,因此没有安装编解码器,我只是在 sip.conf 文件中 diss 允许此编解码器。