Connecting Two Asterisk @Home Servers via IAX2

I have found very scattered and little documentation on connecting two asterisk servers via IAX2, so I decided to put these words together. IAX2 is a protocol that plays nice with NAT and very powerful.

The most important thing to keep in mind is the client/server relationship when calling/forwarding from one server to another. So when you are calling from Server A to Server B, then Server A is the “Client” and Server B is the “Server” and of course if you are calling from Server B to Server A, then Server B would be the “Client” and Server A would be the “Server”.

MORE…

The next thing to know is that “Trunks” allow endpoints to establish a communication channel between each other, but Outbound & Inbound Routes also need to be established.

Home Server:

TRUNKS:

Add IAX2 Trunk

OUTGOING SETTINGS

Trunk name: SOHO
Peer Details:
auth=rsa
context=from-pstn
host=Office server IP address/dns address
inkeys=otherserver
secret=
type=friend
username=home

INCOMING SETTINGS

User Context: office
User Details:
context=from-pstn
host=dynamic
outkey=otherservervoip
secret=
type=friend
username=office

Registration String:
home:@

OUTBOUND ROUTING:

Dial Patterns:
7|.

Trunk Sequence:
Select trunk just built.

Office Server:

TRUNKS:

Add IAX2 Trunk

OUTGOING SETTINGS

Trunk name: SOHO
Peer Details:
auth=rsa
context=from-pstn
host=home server IP address/dns address
inkeys=otherserver
secret=
type=friend
username=office

INCOMING SETTINGS

User Context: home
User Details:
context=from-pstn
host=dynamic
outkey=otherservervoip
secret=
type=friend
username=home

Registration String:
office:@

OUTBOUND ROUTING:

Dial Patterns:
7|.

Trunk Sequence:
Select trunk just built.

Leave a comment