[asterisk-users] VPN between Asterisk server and phone client

Kai-Uwe Jensen kujensen at gmail.com
Wed May 2 12:24:47 MST 2007


Concur with Steve: OpenVPN is your friend. At one time, I used "VPN on
Demand"-type functionality in my dial plan to trunk a certain subset
of calls to a different * server via OpenVPN. This is what that
dialplan looked like:

[trunkfreecallsviaoffsite]
exten => _X.,1,NoOp
exten => _X.,n,Playback(creating_vpn)
exten => _X.,n,System(/usr/local/bin/startvpn clientname ${CALLERID(name)})
exten => _X.,n,Wait(10)
exten => _X.,n,Playback(success_vpn)
exten => _X.,n,Dial(IAX2/vpnmaster/**${EXTEN},60,TW)
exten => _X.,n,Hangup

exten => h,1,System(/usr/local/bin/stopvpn clientname ${CALLERID(name)})
exten => h,n,Playback(stopping_vpn)

The startvpn and stopvpn scripts (which I've since managed to lose)
would establish the VPN between this server and the "vpnmaster"
server. The scripts would also keep track of current users
(${CALLERID(name)} of the VPN-trunk. As a side effect of user
tracking, I'd know when the VPN was already established, so I didn't
need to re-connect. Similarly, I'd only tear it down when no users
were left.

As I mentioned, this does not address your direct need to create a VPN
between an endpoint (softphone) and your server. My example simply
illustrates the straight-forward OpenVPN approach. You can install the
OpenVPN GUI tools on your desktop/laptop and create the VPN manually
when you need it.

BTW, I stopped using this technique when we added a second local
server, so I didn't have to go across the WAN for offloading certain
calls anymore.


More information about the asterisk-users mailing list