Asterisk No sound behind OpenVPN

Hi. I am having an Asterisk server in my local network configured fine.
I am trying to setup in my mobile the Bria Counterpath but without exposing Asterisk in Internet. So I have enable a VPN server in my router.
OpneVPN is configured and mobile connects fine. I see all machines with local ip.
Softphone also is registered with Asterisk, call start fine, I hear what they say to me but they cannot hear me at all.
So no outgoing sound from softphone. If I go to my local network and connect with VPN or not, softphone works fine.
I believe that my issue is that I have configured externip and localnet of asterisk wrong.
What I have done is this:

  1. In my router I have forwarded ports 5060,5061 - 10000:20000 - 5004:5062 to local asterisk ip. Which is 172.20.20.27
  2. My router uses private 192.168.1.x because it is after my internet provider
  3. In Asterisk I set:
    externhost: mydomain.dyndns.com ( because I use dynDNS, dynamic ip)
    localnet: 172.20.20.0/255.255.255.0   (my asterisk have static ip 172.20.20.27)
    localnet: 10.8.0.1/255.0.0.0   (for openVPN ip when connected)

VPN Subnet / Netmask is 172.20.21.0/255.255.255.0

Any help please here? I can’t find a solution for this and I am not a VOIP or Network expert

The issue might be related to the localnet and externhost settings in your Asterisk config.

You might need to adjust the localnet to include your OpenVPN subnet (172.20.21.0/24) instead of 10.8.0.1/8.

Also, double-check that externhost resolves to the correct public IP from your DynDNS setup.

Another thing to confirm is that the RTP port range (10000-20000) in rtp.conf matches the ports forwarded on your router.

Try enabling SIP debugging (sip set debug on) to verify if the RTP streams are using the expected IP addresses.

1 Like