Здравствуйте.
У меня, как я понял, довольно распространённая проблема, но пока решения для себя не нашёл, поэтому надеюсь на помощь специалистов.
Итак, суть. При звонке через шлюз звук идёт только в одном направлении (от dongle в SIP). Моя конфигурация на данный момент следующая:
Asterisk 1.8.11.0 (до этого использовал 1.6, думал, что апгрейд решит проблему, оказалось - нет)
chan_dongle-1.1.r10 (пересобрал из исходников)
момем Huawei 1550 (пробовал так же и E173, проблема присутствует на обоих устройствах)
роутер Asus RT-N16
DD-WRT Release: 04/07/12 (SVN revision: 18946)
Софтфон (PortSIP) на мобильном телефоне с интернетом от мегафона
Asterisk установлен на RT-N16 и находится на внешнем public IP (за NAT присутствует домашняя локалка)
Пытаюсь звонить с софтфона PortSIP, который на мобильном телефоне и работает через megafon-интернет
Соединение происходит нормально, посмотрел tcpdump'ом - пакеты на внешнем интерфейсе роутера бегают в обе стороны. Доступ к диапазону RTP-портов открыт снаружи:
SIP.CONF:
Код: Выделить всё
[general]
context=from-mysipprovider
allowoverlap=no
allowguest=no
alwaysauthreject=yes
defaultexpiry=360
callevents=yes
limitonpeer=yes
tcpenable=yes
rtptimeout=60
language=ru
rtpholdtimeout=300
rtpkeepalive=5
bindport=5060
transport=udp
bindaddr=0.0.0.0
externaddr=X.X.X.X
dtmfmode=rfc2833
srvlookup=yes
canreinvite=no
tos_sip=cs3
tos_audio=ef
tos_video=af41
disallow=all
allow=alaw
allow=ulaw
allow=gsm
[100]
type=friend
defaultuser=100
secret=
host=dynamic
nat=yes
qualify=yes
context=100
canreinvite=no
call-limit=1
busylevel=1
rtpkeepalive=5
disallow=all
allow=alaw
allow=ulaw
allow=gsm
TCPDUMP (на внешнем интерфейсе)
Код: Выделить всё
16:35:14.821951 IP ip-X-X-X-X.nwgsm.ru.53348 > Y-Y-Y-Y.home-provider.net.10002: UDP, length 332
16:35:14.828201 IP Y-Y-Y-Y.home-provider.net.10002 > ip-X-X-X-X.nwgsm.ru.53348: UDP, length 172
16:35:14.842103 IP ip-X-X-X-X.nwgsm.ru.53348 > Y-Y-Y-Y.home-provider.net.10002: UDP, length 332
16:35:14.847295 IP Y-Y-Y-Y.home-provider.net.10002 > ip-X-X-X-X.nwgsm.ru.53348: UDP, length 172
16:35:14.866890 IP Y-Y-Y-Y.home-provider.net.10002 > ip-X-X-X-X.nwgsm.ru.53348: UDP, length 172
16:35:14.886704 IP Y-Y-Y-Y.home-provider.net.10002 > ip-X-X-X-X.nwgsm.ru.53348: UDP, length 172
16:35:14.904348 IP ip-X-X-X-X.nwgsm.ru.53348 > Y-Y-Y-Y.home-provider.net.10002: UDP, length 332
16:35:14.904871 IP ip-X-X-X-X.nwgsm.ru.53348 > Y-Y-Y-Y.home-provider.net.10002: UDP, length 332
16:35:14.911328 IP Y-Y-Y-Y.home-provider.net.10002 > ip-X-X-X-X.nwgsm.ru.53348: UDP, length 172
16:35:14.927096 IP Y-Y-Y-Y.home-provider.net.10002 > ip-X-X-X-X.nwgsm.ru.53348: UDP, length 172
16:35:14.946937 IP Y-Y-Y-Y.home-provider.net.10002 > ip-X-X-X-X.nwgsm.ru.53348: UDP, length 172
16:35:14.962144 IP ip-X-X-X-X.nwgsm.ru.53348 > Y-Y-Y-Y.home-provider.net.10002: UDP, length 332
16:35:14.968080 IP Y-Y-Y-Y.home-provider.net.10002 > ip-X-X-X-X.nwgsm.ru.53348: UDP, length 172
16:35:14.978154 IP ip-X-X-X-X.nwgsm.ru.53348 > Y-Y-Y-Y.home-provider.net.10002: UDP, length 332
16:35:14.986898 IP Y-Y-Y-Y.home-provider.net.10002 > ip-X-X-X-X.nwgsm.ru.53348: UDP, length 172
16:35:15.006758 IP Y-Y-Y-Y.home-provider.net.10002 > ip-X-X-X-X.nwgsm.ru.53348: UDP, length 172
16:35:15.022130 IP ip-X-X-X-X.nwgsm.ru.53348 > Y-Y-Y-Y.home-provider.net.10002: UDP, length 332
16:35:15.027325 IP Y-Y-Y-Y.home-provider.net.10002 > ip-X-X-X-X.nwgsm.ru.53348: UDP, length 172
16:35:15.041963 IP ip-X-X-X-X.nwgsm.ru.53348 > Y-Y-Y-Y.home-provider.net.10002: UDP, length 332
SIP SET DEBUG ON (X.X.X.X - внешний IP софтфона, Y.Y.Y.Y - внешний IP Asterisk'а, A.A.A.A - адрес софтфона за NAT):
Код: Выделить всё
DD-WRT*CLI> sip set debug on
SIP Debugging enabled
<--- SIP read from UDP:X.X.X.X:53933 --->
<------------->
-- Executing [s@dongle-incoming:1] Dial("Dongle/dongle0-0100000001", "SIP/100,,") in new stack
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
Audio is at Y.Y.Y.Y port 10082
Adding codec 0x8 (alaw) to SDP
Adding codec 0x4 (ulaw) to SDP
Adding codec 0x2 (gsm) to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (NAT) to X.X.X.X:53933:
INVITE sip:100@A.A.A.A:5041;rinstance=a4270f46926f8043 SIP/2.0
Via: SIP/2.0/UDP Y.Y.Y.Y:5060;branch=z9hG4bK0a1a9982;rport
Max-Forwards: 70
From: "dongle0" <sip:+78122441244@Y.Y.Y.Y:5060>;tag=as30763f4b
To: <sip:100@A.A.A.A:5041;rinstance=a4270f46926f8043>
Contact: <sip:%2b78122441244@Y.Y.Y.Y:5060>
Call-ID: 7ddc7e447fc5cf7f522af29d7194f232@Y.Y.Y.Y
CSeq: 102 INVITE
User-Agent: Cisco-SIPGateway
Date: Thu, 26 Apr 2012 11:59:19 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 326
v=0
o=CiscoSystemsSIP-GW-UserAgent 1390461371 1390461371 IN IP4 Y.Y.Y.Y
s=SIP-Call
c=IN IP4 Y.Y.Y.Y
t=0 0
m=audio 10082 RTP/AVP 8 0 3 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv
---
-- Called 100
<--- SIP read from UDP:X.X.X.X:53933 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP Y.Y.Y.Y:5060;branch=z9hG4bK0a1a9982;rport=5060
To: <sip:100@A.A.A.A:5041;rinstance=a4270f46926f8043>
From: "dongle0" <sip:+78122441244@Y.Y.Y.Y:5060>;tag=as30763f4b
Call-ID: 7ddc7e447fc5cf7f522af29d7194f232@Y.Y.Y.Y
CSeq: 102 INVITE
Content-Length: 0
<------------->
--- (7 headers 0 lines) ---
<--- SIP read from UDP:X.X.X.X:53933 --->
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP Y.Y.Y.Y:5060;branch=z9hG4bK0a1a9982;rport=5060
Contact: <sip:100@A.A.A.A:5041;rinstance=a4270f46926f8043>
To: <sip:100@A.A.A.A:5041;rinstance=a4270f46926f8043>;tag=56055b20
From: "dongle0"<sip:+78122441244@Y.Y.Y.Y:5060>;tag=as30763f4b
Call-ID: 7ddc7e447fc5cf7f522af29d7194f232@Y.Y.Y.Y
CSeq: 102 INVITE
User-Agent: PortSIP CE for Mobile
Content-Length: 0
<------------->
--- (9 headers 0 lines) ---
-- SIP/100-00000001 is ringing
<--- SIP read from UDP:X.X.X.X:53933 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP Y.Y.Y.Y:5060;branch=z9hG4bK0a1a9982;rport=5060
Contact: <sip:100@A.A.A.A:5041;rinstance=a4270f46926f8043>
To: <sip:100@A.A.A.A:5041;rinstance=a4270f46926f8043>;tag=56055b20
From: "dongle0"<sip:+78122441244@Y.Y.Y.Y:5060>;tag=as30763f4b
Call-ID: 7ddc7e447fc5cf7f522af29d7194f232@Y.Y.Y.Y
CSeq: 102 INVITE
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, REGISTER, SUBSCRIBE, INFO, PUBLISH
Content-Type: application/sdp
Supported: replaces
User-Agent: PortSIP CE for Mobile
Content-Length: 221
v=0
o=- 41054201 41054201 IN IP4 A.A.A.A
s=http://www.portsip.com
c=IN IP4 A.A.A.A
t=0 0
m=audio 21692 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=ptime:20
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
<------------->
--- (12 headers 10 lines) ---
Found RTP audio format 8
Found RTP audio format 101
Found audio description format PCMA for ID 8
Found audio description format telephone-event for ID 101
Capabilities: us - 0xe (gsm|ulaw|alaw), peer - audio=0x8 (alaw)/video=0x0 (nothing)/text=0x0 (nothing), combined - 0x8 (alaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event), peer - 0x1 (telephone-event), combined - 0x1 (telephone-event)
Peer audio RTP is at port A.A.A.A:21692
list_route: hop: <sip:100@A.A.A.A:5041;rinstance=a4270f46926f8043>
set_destination: Parsing <sip:100@A.A.A.A:5041;rinstance=a4270f46926f8043> for address/port to send to
set_destination: set destination to A.A.A.A, port 5041
Transmitting (NAT) to X.X.X.X:53933:
ACK sip:100@A.A.A.A:5041;rinstance=a4270f46926f8043 SIP/2.0
Via: SIP/2.0/UDP Y.Y.Y.Y:5060;branch=z9hG4bK3669ed4f;rport
Max-Forwards: 70
From: "dongle0" <sip:+78122441244@Y.Y.Y.Y:5060>;tag=as30763f4b
To: <sip:100@A.A.A.A:5041;rinstance=a4270f46926f8043>;tag=56055b20
Contact: <sip:%2b78122441244@Y.Y.Y.Y:5060>
Call-ID: 7ddc7e447fc5cf7f522af29d7194f232@Y.Y.Y.Y
CSeq: 102 ACK
User-Agent: Cisco-SIPGateway
Content-Length: 0
---
-- SIP/100-00000001 answered Dongle/dongle0-0100000001
[Apr 26 11:59:24] NOTICE[4434]: rtp.c:1809 ast_rtp_read: Unknown RTP codec 126 received from 'X.X.X.X'
<--- SIP read from UDP:X.X.X.X:53933 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP Y.Y.Y.Y:5060;branch=z9hG4bK0a1a9982;rport=5060
Contact: <sip:100@A.A.A.A:5041;rinstance=a4270f46926f8043>
To: <sip:100@A.A.A.A:5041;rinstance=a4270f46926f8043>;tag=56055b20
From: "dongle0"<sip:+78122441244@Y.Y.Y.Y:5060>;tag=as30763f4b
Call-ID: 7ddc7e447fc5cf7f522af29d7194f232@Y.Y.Y.Y
CSeq: 102 INVITE
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, REGISTER, SUBSCRIBE, INFO, PUBLISH
Content-Type: application/sdp
Supported: replaces
User-Agent: PortSIP CE for Mobile
Content-Length: 221
v=0
o=- 41054201 41054201 IN IP4 A.A.A.A
s=http://www.portsip.com
c=IN IP4 A.A.A.A
t=0 0
m=audio 21692 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=ptime:20
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
<------------->
--- (12 headers 10 lines) ---
Reliably Transmitting (NAT) to X.X.X.X:53933:
OPTIONS sip:100@A.A.A.A:5041;rinstance=a4270f46926f8043 SIP/2.0
Via: SIP/2.0/UDP Y.Y.Y.Y:5060;branch=z9hG4bK12e18375;rport
Max-Forwards: 70
From: "asterisk" <sip:asterisk@Y.Y.Y.Y:5060>;tag=as2acf1283
To: <sip:100@A.A.A.A:5041;rinstance=a4270f46926f8043>
Contact: <sip:asterisk@Y.Y.Y.Y:5060>
Call-ID: 4f1a0a4c13637d08092ff1a715ca8964@Y.Y.Y.Y
CSeq: 102 OPTIONS
User-Agent: Cisco-SIPGateway
Date: Thu, 26 Apr 2012 11:59:29 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Length: 0
---
Retransmitting #1 (NAT) to X.X.X.X:53933:
OPTIONS sip:100@A.A.A.A:5041;rinstance=a4270f46926f8043 SIP/2.0
Via: SIP/2.0/UDP Y.Y.Y.Y:5060;branch=z9hG4bK12e18375;rport
Max-Forwards: 70
From: "asterisk" <sip:asterisk@Y.Y.Y.Y:5060>;tag=as2acf1283
To: <sip:100@A.A.A.A:5041;rinstance=a4270f46926f8043>
Contact: <sip:asterisk@Y.Y.Y.Y:5060>
Call-ID: 4f1a0a4c13637d08092ff1a715ca8964@Y.Y.Y.Y
CSeq: 102 OPTIONS
User-Agent: Cisco-SIPGateway
Date: Thu, 26 Apr 2012 11:59:29 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Length: 0
---
<--- SIP read from UDP:X.X.X.X:53933 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP Y.Y.Y.Y:5060;branch=z9hG4bK12e18375;rport=5060
Contact: <sip:A.A.A.A:5041>
To: <sip:100@A.A.A.A:5041;rinstance=a4270f46926f8043>;tag=ac66e95d
From: "asterisk"<sip:asterisk@Y.Y.Y.Y:5060>;tag=as2acf1283
Call-ID: 4f1a0a4c13637d08092ff1a715ca8964@Y.Y.Y.Y
CSeq: 102 OPTIONS
Accept: application/sdp
Accept-Language: en
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, REGISTER, SUBSCRIBE, INFO, PUBLISH
Supported: replaces
User-Agent: PortSIP CE for Mobile
Content-Length: 0
<------------->
--- (13 headers 0 lines) ---
Really destroying SIP dialog '4f1a0a4c13637d08092ff1a715ca8964@Y.Y.Y.Y' Method: OPTIONS
<--- SIP read from UDP:X.X.X.X:53933 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP Y.Y.Y.Y:5060;branch=z9hG4bK12e18375;rport=5060
Contact: <sip:A.A.A.A:5041>
To: <sip:100@A.A.A.A:5041;rinstance=a4270f46926f8043>;tag=ac66e95d
From: "asterisk"<sip:asterisk@Y.Y.Y.Y:5060>;tag=as2acf1283
Call-ID: 4f1a0a4c13637d08092ff1a715ca8964@Y.Y.Y.Y
CSeq: 102 OPTIONS
Accept: application/sdp
Accept-Language: en
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, REGISTER, SUBSCRIBE, INFO, PUBLISH
Supported: replaces
User-Agent: PortSIP CE for Mobile
Content-Length: 0
SET RTP DEBUG ON (X.X.X.X - внешний IP софтфона):
Код: Выделить всё
Got RTP packet from X.X.X.X:60405 (type 08, seq 047476, ts 3080021694, len 000320)
Sent RTP packet to X.X.X.X:60405 (type 08, seq 008979, ts 2349600, len 000160)
Got RTP packet from X.X.X.X:60405 (type 08, seq 047477, ts 3080021854, len 000320)
Sent RTP packet to X.X.X.X:60405 (type 08, seq 008980, ts 2349760, len 000160)
Got RTP packet from X.X.X.X:60405 (type 08, seq 047478, ts 3080022014, len 000320)
Sent RTP packet to X.X.X.X:60405 (type 08, seq 008981, ts 2349920, len 000160)
Sent RTP packet to X.X.X.X:60405 (type 08, seq 008982, ts 2350080, len 000160)
Sent RTP packet to X.X.X.X:60405 (type 08, seq 008983, ts 2350240, len 000160)
Got RTP packet from X.X.X.X:60405 (type 08, seq 047479, ts 3080022174, len 000320)
Sent RTP packet to X.X.X.X:60405 (type 08, seq 008984, ts 2350400, len 000160)
Sent RTP packet to X.X.X.X:60405 (type 08, seq 008985, ts 2350560, len 000160)
Sent RTP packet to X.X.X.X:60405 (type 08, seq 008986, ts 2350720, len 000160)
Sent RTP packet to X.X.X.X:60405 (type 08, seq 008987, ts 2350880, len 000160)
Got RTP packet from X.X.X.X:60405 (type 08, seq 047480, ts 3080022334, len 000320)
Sent RTP packet to X.X.X.X:60405 (type 08, seq 008988, ts 2351040, len 000160)
Got RTP packet from X.X.X.X:60405 (type 08, seq 047481, ts 3080022494, len 000320)
Sent RTP packet to X.X.X.X:60405 (type 08, seq 008989, ts 2351200, len 000160)
Got RTP packet from X.X.X.X:60405 (type 08, seq 047482, ts 3080022654, len 000320)
Sent RTP packet to X.X.X.X:60405 (type 08, seq 008990, ts 2351360, len 000160)
Sent RTP packet to X.X.X.X:60405 (type 08, seq 008991, ts 2351520, len 000160)
Sent RTP packet to X.X.X.X:60405 (type 08, seq 008992, ts 2351680, len 000160)
Sent RTP packet to X.X.X.X:60405 (type 08, seq 008993, ts 2351840, len 000160)
Got RTP packet from X.X.X.X:60405 (type 08, seq 047484, ts 3080022974, len 000320)
Sent RTP packet to X.X.X.X:60405 (type 08, seq 008994, ts 2352000, len 000160)
Sent RTP packet to X.X.X.X:60405 (type 08, seq 008995, ts 2352160, len 000160)
Sent RTP packet to X.X.X.X:60405 (type 08, seq 008996, ts 2352320, len 000160)
Got RTP packet from X.X.X.X:60405 (type 08, seq 047485, ts 3080023134, len 000320)
Sent RTP packet to X.X.X.X:60405 (type 08, seq 008997, ts 2352480, len 000160)
Got RTP packet from X.X.X.X:60405 (type 08, seq 047486, ts 3080023294, len 000320)
Sent RTP packet to X.X.X.X:60405 (type 08, seq 008998, ts 2352640, len 000160)
Got RTP packet from X.X.X.X:60405 (type 08, seq 047487, ts 3080023454, len 000320)
Sent RTP packet to X.X.X.X:60405 (type 08, seq 008999, ts 2352800, len 000160)
Got RTP packet from X.X.X.X:60405 (type 08, seq 047488, ts 3080023614, len 000320)
Sent RTP packet to X.X.X.X:60405 (type 08, seq 009000, ts 2352960, len 000160)
Sent RTP packet to X.X.X.X:60405 (type 08, seq 009001, ts 2353120, len 000160)
DD-WRT*CLI> rtp set debug off
RTP Debugging Disabled
Судя по отрабатывающему правилу файрвола, пакеты входящего rtp-трафика проходят:
Код: Выделить всё
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
70 20612 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpts:10000:20000
Дополнение: при нажатии клавиш на софтфоне слышны звуки тонов на противоположной стороне, а сам голос в этом направлении не передаётся.