Thursday, May 21, 2009

Connecting Two Asterisk via IAX2 with VPN

On my previous blog I discussed how to install and set up OpenVPN. Now will take a look on how we could be able to use VPN to

connect Asterisk vi IAX2 servers.

1. Assuming this scenario

The OpenVPN server(Asterisk A) is at 10.8.0.1
The OpenVPN client(Asterisk B) is at 10.8.0.10

(At server B)

Add an entry on the iax.conf like this

[MdPhone2]
type=friend
auth=plaintext
username=MdPhil2
secret=md2004
context=incoming
canreinvite=yes
host=10.8.0.1
disallow=all
allow=ulaw
jitterbuffer=yes

(At server A)
[MdPhil2]
type=friend
auth=plaintext
username=MdPhone2
secret=md2004
context=MDI-Phones
canreinvite=no
host=10.8.0.10
host=dynamic
disallow=all
allow=ulaw
qualify=4000


2. Next add this on your dialplan route

(At server B)

exten => _1XX,1,Answer()
exten => _1XX,2,Dial(IAX2/MdPhil2@MdPhone2/${EXTEN}@MDI-Phones)
exten => _1XX,3,Hangup

(At server A)
exten => _1XX,1,Answer()
exten => _1XX,2,Dial(IAX2/MdPhone2@MdPhil2/${EXTEN}@incoming,90,t)
exten => _1XX,3,Hangup

3. Go to the asterisk console

/usr/sbin/asterisk -r

Issue command:

iax2 reload

dialplan reload

And you are done. You have now Asterisk with IAX2 connection via VPN.

Hope you find this useful. Thanks, Cheers and God Bless!!!

No comments: