Tuesday, April 17, 2018

Asterisk IAX trunk with dynamic IP address

You can run into situations where the IPs change on a PBX.   In this example will imagine we have a demo PBX that sales uses ad different customer sites with different WAN addresses. 
With this example, our main "corporate" pbx that allows external connections will now accept a properly formatted IAX trunk from a connection using a valid user/password.

I like IAX because MOST times it will tunnel straight through without any modifications to firewalls.  I've had it work from an Airplane so its pretty successful.

Build your IAX trunk between your two sites to be as dynamic as possible. This way, especially at the customer demo side, you wont care about what the external IP is.

CORPORATE SIDE make an IAX trunk using these settings!
Create a new IAX TRUNK in FreePBX
(GENERAL TAB)
TRUNKNAME=demotrunk
DISABLE TRUNK= NO
(IAX SETTINGS TAB)
TRUNKNAME=demotrunk
PEERDETAILS:
host=dynamic
username=demotrunk
password=blahbahayaddayadda
context=from-internal
type=friend
SUBMIT and SAVE these changes

DEMO PBX
Create a new IAX TRUNK in FreePBX
(GENERAL TAB)
TRUNKNAME=demotrunk
DISABLE TRUNK= NO
(IAX SETTINGS TAB)
TRUNKNAME=demotrunk
PEERDETAILS:
host=X.X.X.X (IP OF YOUR COMPANY)
username=demotrunk
password=blahbahayaddayadda
context=from-internal
type=friend

NOW CLICK ON THE INCOMING TAB !!!
REGISTER STRING= (syntax is   trunkname:password@DESTINATION_IP)

example based on above config examples
demotrunk:blahbahayaddayadda@X.X.X.X (this is your corporate IP HERE)

SUBMIT and APPLY your changes.
This type of IAX trunk should allow the "demo" side of your pbx to register to your corporation and use whatever WAN side IP its detected. This way you dont have to worry about programming the IP in your corporate PBX connection. You can use a mobile hot spot or whatever, the system will register as that IP.

ROUTING OF CALLS
On the corporate PBX create an outbound route that points to the IAX trunk you just created, and in the dial pattern, just put in the “match pattern” of the extensions at the far end. So if your demo PBX uses extension 4455 just put that in the that box and submit/apply the changes. Or you can do “4XXX” if you want to match everything from 4000-49999
On the DEMOPBX side, you can do a similar thing should you want them to make calls back. So if your extensions on the corporate PBX side are 7000-7999 put in 7XXX in the outbound routes of the demopbx, and the phones can call back.



No comments:

Post a Comment