May 4, 2005

293 words 2 mins read

Multiple Asterisk Servers via IAX2

So here’s the theory. You have a main office with a master asterisk server (Its on a Static IP). You want to add VoIP connection to a small remote office on DSL (Dynamic IP). I wanted to test this out for a while, I finally got the chance. In the extended contents I’ll run down the configuration (thats alot easier to understand than this) & an easy to test demo.

To the left is the over simple picture of the world. This is the setup that I was using since at the moment there was phones attached to the slave server (remote office). I’m going to configure a block (in this case 500-519) of extensions to point at the slave server. On the slave server extension 500 is going to be an echo test & 510 will be a talking clock test (of course you could point these at phones — No problem).

Master — IAX.conf

<br /> [SlaveServ]<br /> type=friend<br /> secret=x123x<br /> context=inbound<br /> host=dynamic<br />

Master — Extensions.conf

<br /> exten => _50X,1,Dial(IAX2/MasterServ:[email protected]/${EXTEN},30,r)<br /> exten => _51X,1,Dial(IAX2/MasterServ:[email protected]/${EXTEN},30,r)<br />

Slave — IAX.conf

;Somewhere under [general]
register => SlaveServ:[email protected]
; - Being your Master Servers IP or HostName

;At the bottom of the file

Slave — Extension.Conf

exten => 500,1,Playback(demo-echotest)
exten => 500,2,Echo
exten => 500,3,Playback(demo-echodone)
exten => 500,4,Hangup

exten => 510,1,Answer
exten => 510,2,SayUnixTime()
exten => 510,3,Hangup

Now restart Asterisk on both servers (give them about 1 min to sync) — Pick up your phone attached to the Master Server, dial 500 — and you should get the echo test. In my case the Slave was behind a linksys — but because it registers to the Master — No port forwarding was needed.