Asterisk access from the Internet NAT

I have configured my server it works perfectly in the local network, but doesn’t work from the Internet.

My network topology is following

Router is connected to the Internet over PPPoE.
I set up port forwarding and range port forwarding
Here is settings from my router.

And port 5060 for SIP (but it doesn’t make sense, because it fits the range)

Asterisk Server is in the local network.

Consider situation I am calling from Internet via mobile phone network.
The problem is that I can hear well person inside my home local network, but he doesn’t hear me. And usually after few seconds connection is dropped.
But I can call this person or any other member of the network.
So SIP protocol works, but the problem I guess with RTP protocol, as far as all media data is transferred over RTP.

In case of two clients calling from the internet neither of them can hear anything.

As you can see, I opened all required ports.

Here is my sip.conf file

context=main-context                  ; Default context for incoming calls. Defaults to 'default'
allowguest=no                  ; Allow or reject guest calls (default is yes)
allowoverlap=no                 ; Disable overlap dialing support. (Default is yes)
udpbindaddr=             ; IP address to bind UDP listen socket to ( binds to all)
tcpenable=no                    ; Enable server for incoming TCP connections (default is no)
tcpbindaddr=             ; IP address for TCP server to bind to ( binds to all interfaces)
transport=udp                   ; Set the default transports.  The order determines the primary default transport.
srvlookup=yes                   ; Enable DNS SRV lookups on outbound calls
nat=route                               ; in SRV records
externaddr=         ; use this address.
limitonpeers=yes; may override the address/port information specified in the SIP/SDP messages,



Here is log SIP log of such call

RTP packets are sent only to my mobile phone and not back.

Sent RTP P2P packet to (type 08, len 000160)
Sent RTP P2P packet to (type 08, len 000160)
Sent RTP P2P packet to (type 08, len 000160)
Sent RTP P2P packet to (type 08, len 000160)
Sent RTP P2P packet to (type 08, len 000160)
Sent RTP P2P packet to (type 08, len 000160)

Of course over VPN it works perfectly.

Please suggest what should I check or maybe I missed something.

Thanks in advance.

You have not configured the localnet setting so chan_sip will not know when it should put your external IP address in and when it shouldn’t. The following line is probably what you’d need:


1 Like

Its awesome !!! Thank you so much, only one line solved huge problem, now everything works like a charm !!!