Link 2 PBX Servers with IAX2

Hello everyone, I have configured my two FreePBX servers with IAX2, and if I type “iax2 show peers” on both servers, I see them both online. They are configured as follows:

Server 1
IAX settings > Outgoing > PEER Details:

username=locale
secret=PASSWORD (SAME ON BOTH)
host=SERVER2 IP
type=friend
context=from-internal
qualify=yes
qualifyfreqok=25000
transfer=no
trunk=yes

Server 2
IAX settings > Outgoing > PEER Details:

username=locale
secret=PASSWORD (SAME ON BOTH)
host=SERVER1 IP
type=friend
context=from-internal
qualify=yes
qualifyfreqok=25000
transfer=no
trunk=yes

I need calls from Server 1 in the NXXNXXXXXX format to be handled by Server 2 using a pjsip Trunk from my voice provider.
I tried setting an Outbound Route on Server 1 with Dial Pattern NXXNXXXXXX and selected the IAX2 Trunk of Server 2, but when I call, it says “All circuits are busy”. How can I configure everything properly?

Hey! Like you, I started using IAX2, I had a similar error, I got the same message that takes you to the limit: ‘All circuits are busy’. I left IAX2 because when I was an intern, it was suggested to me to use SIP/PJSIP. I didn’t need as many things as IAX2 could offer me.

I didn’t find much more information that was really useful to me, I read these two links when I was configuring everything and in the end it ended up working perfectly.

Honestly, I don’t have an extensive knowledge about Asterisk and FreePBX either. But, it is true that searching I found these two links.

Link to the first document

Link to the second document

Let’s see if something works out for you! :crossed_fingers:

It finally worked! I just have one problem: if I restart server 2, it connects to the SIP trunk for outgoing calls, but every time after about 30 minutes, it disconnects and doesn’t reconnect until I restart the server again. The IAX2 trunk works perfectly. What could be the issue?