I am trying to connect my softphone to a remote freepbx installation on a raspberry pi. The raspberry pi is using an OpenVPN client to connect to my cloud server. My cloud server has a static public IP and I use firewalld to forward the required ports to RPi. I have set up port forwarding for UDP ports 5060, 5160, 10000-20000 on my cloud server using firewalld. I am able to connect to the cloud server IP with Zoiper and login with my EXT, but after establishing a call, there is no audio (both ways) and the call disconnects after 30s because of RTP failure.
I have played with various NAT setting in “General SIP Settings”, “chan_pjsip” and “chan_sip”, but I can’t make it work.
Here is how the net looks like:
My PC(Zoiper): 192.168.1.2[Private, DHCP]
===>===
My Modem: 192.168.1.1[Private, Static], 9.8.7.6[Public, Dynamic]
===>===
Cloud Server: 1.2.3.4[Public, Static], 10.8.0.1[Private, OpenVPN]
===>===
Remote Site Modem: 192.168.1.1[Private, Static], 5.6.7.8[Public, Dynamic]
===>===
Rpi Freepbx: 192.168.1.2[Private, DHCP], 10.8.0.4[Private, OpenVPN]
==============================
Zoiper connects directly to 1.2.3.4:5060[chan_pjsip] or 1.2.3.4:5160[chan_sip] without any problem.
RPi connects to cloud server using OpenVPN as I said. When I check my local udp traffic on my PC, i see that zoiper tries to send RTP packets to 10.8.0.4!!! which is the private ip lease from the openvpn server.
Freepbx’s “External Address” is set to 1.2.3.4
“Local Networks” are: 0.0.0.0/1, 10.8.0.0/24, 128.0.0.0/1, 192.168.1.0/24
There is a masquerade rule in firewalld => “firewall-cmd --add-masquerade --permanent”
Forwarded ports:
firewall-cmd --zone=public --add-port=5060/udp --permanent
firewall-cmd --add-forward-port=port=5060:proto=udp:toport=5060:toaddr=10.8.0.4 --permanent
firewall-cmd --zone=public --add-port=5160/udp --permanent
firewall-cmd --add-forward-port=port=5160:proto=udp:toport=5160:toaddr=10.8.0.4 --permanent
firewall-cmd --zone=public --add-port=10000-20000/udp --permanent
firewall-cmd --add-rich-rule ‘rule family=“ipv4” forward-port port=“10000-20000” protocol=“udp” to-port=“10000-20000” to-addr=“10.8.0.4”’ --permanent
A softphone connected directly to RPi works flawlessly with bidirectional audio.
What am I missing here?