[asterisk-users] Curious problem with NAT

Luca Bertoncello lucabert at lucabert.de
Sun Jun 7 02:43:47 CDT 2015


Hi list!

Since the internal calls work as expected and I can register my Asterisk on
an external provider, I'd like to add a new feature and allow my mobile phone
to connect to my Asterisk and manage calls.

Well, first of all, my Asterisk is NOT direct on Internet available, but
behind a NAT.
So I configured my sip.conf:

localnet=192.168.200.0/24
externhost=myhost.noip.com
externrefresh=180

Then I added the peer in my users.con:

[00491771111111]
fullname = 00491771111111
secret = MYVERYSECRET
type=peer
nat=yes
qualify=yes
qualifyfreq=60
hassip = yes
dahdichan = 1
transport=udp,tcp
callwaiting = no
context = default
host = dynamic
dtmfmode=rfc2833
dial=SIP/00491771111111

and finally "core reload".

On my Gateway I configured the NAT so:

/sbin/iptables -t nat -A PREROUTING -p udp --sport 6060 -j DNAT --to-destination 192.168.200.120:5060
/sbin/iptables -t nat -A PREROUTING -p tcp --sport 6060 -j DNAT --to-destination 192.168.200.120:5060
/sbin/iptables -t nat -A PREROUTING -p udp --dport 6060 -j DNAT --to-destination 192.168.200.120:5060
/sbin/iptables -t nat -A PREROUTING -p tcp --dport 6060 -j DNAT --to-destination 192.168.200.120:5060

Well, the phone connect to the server and I can see it reachable:

OpenWrt*CLI> sip show peers
Name/username             Host                                    Dyn Forcerport ACL Port     Status     
00491771111111/0049177111 192.168.200.3                            D   N             40702    OK (1768 ms)

Well, now I call the mobile phone from another peer. It rings and I can
answer the call.
Wonderful!

But no word will be sent... :(
I cannot hear anything on my mobile phone and I cannot transmit a single
word....

I tried to connect my mobile phone to a public VoIP-Provider and it works
as expected, so I'm sure that the problem is on my network, but I can't
find it...

What am I doing wrong?

Thanks a lot
Luca Bertoncello
(lucabert at lucabert.de)



More information about the asterisk-users mailing list