Freeswitch over NETMAPped VPN

I’ve made a configuration with Freeswitch and a VPN connection that could help other, so I post it here. The network configuration is: two local networks (192.168.0.0/24) using one gateway for each network. The two gateways are connected through a PPTP VPN, and use NETMAP to map from their local 192.168.0.0/24 to the VPN addresses 172.16.X.0/24 (and vice versa), X being different for the two local networks of course. This way the Freeswitch network is accessible via 172.16.1.0/24 and the other network (with the phone on it) is accessible via 172.16.2.0/24. A little schematic to be clear about it:

   172.16.2.0/24 — 172.16.2.1 (gateway) 192.168.0.1 — 192.168.0.2 (phone)
   (VPN)
   172.16.1.0/24 — 172.16.1.1 (gateway) 192.168.0.1 — 192.168.0.5 (Freeswitch)

In this configuration, the phone can be accessed either locally with 192.168.0.2 or by the two networks with 172.16.2.2 (thanks to the NETMAP rules). In the same way, Freeswitch has the local IP 192.168.0. but can also be reached via the VPN address: 172.16.1.5.

Main difficulties were to: 1) make phone and Freeswitch use the VPN addresses instead of “probed” local ones, and 2) make the phone be recognized as an internal member, and as such a “default plan” user (and not just the “public plan” like external members do).

Read more