Connecting two PBX's over the internet with IAX trunks


This should be pretty basic but I am running into an issue here.
I have two PBX’s both running FreePBX
I have created IAX trunks on both PBX’s and the status on both PBX’s is showing to be okay.

I have System1 and System2
System1 has a DID that I am sending over the IAX trunk to System2
System2 has that same DID listed under inbound routes that is pointing to a voicemail box.
When I dial the DID, I see it hit System2 via Putty logs but the call does not complete… here is the output where the call fails:

– Called SIP/VOIP_INNOV_PRIMARY/16822027111
[2016-06-08 22:35:38] WARNING[26964]: chan_sip.c:4024 retrans_pkt: Retransmission timeout reached on transmission [email protected]:5060 for seqno 102 (Critical Request) – See
Packet timed out after 6401ms with no response
[2016-06-08 22:35:38] WARNING[26964]: chan_sip.c:4053 retrans_pkt: Hanging up call [email protected]:5060 - no reply to our critical packet (see
== Everyone is busy/congested at this time (1:0/0/1)
– Executing [[email protected]:23] NoOp(“IAX2/iaxtest-1179”, “Dial failed for some reason with DIALSTATUS = CHANUNAVAIL and HANGUPCAUSE = 18”) in new stack
– Executing [[email protected]:24] GotoIf(“IAX2/iaxtest-1179”, “0?continue,1:s-CHANUNAVAIL,1”) in new stack
– Goto (macro-dialout-trunk,s-CHANUNAVAIL,1)
– Executing [[email protected]:1] Set(“IAX2/iaxtest-1179”, “RC=18”) in new stack
– Executing [[email protected]:2] Goto(“IAX2/iaxtest-1179”, “18,1”) in new stack
– Goto (macro-dialout-trunk,18,1)
– Executing [[email protected]:1] Goto(“IAX2/iaxtest-1179”, “s-NOANSWER,1”) in new stack
– Goto (macro-dialout-trunk,s-NOANSWER,1)
– Executing [[email protected]:1] NoOp(“IAX2/iaxtest-1179”, “Dial failed due to trunk reporting NOANSWER - giving up”) in new stack
– Executing [[email protected]:2] Progress(“IAX2/iaxtest-1179”, “”) in new stack
– Executing [[email protected]:3] Playback(“IAX2/iaxtest-1179”, “number-not-answering,noanswer”) in new stack
– <IAX2/iaxtest-1179> Playing ‘number-not-answering.ulaw’ (language ‘en’)

Can anyone provide any advice as to what the issue is?

Thank you!

After further testing and analyzing the logs, the call is hitting System 1, passing over to System2 via IAX, then System2 is trying to send the call outbound to the first provider of my main outbound route. Why is that happening? Shouldn’t the call go from System 1, to System 2, and follow the direction of the inbound DID as configured on System2?

It depends on the context you have specified for your IAX2 trunk. If you want calls that arrive over your IAX2 trunk to be handled as if they come from the PSTN, you want a context of ‘from-trunk’. If you want calls to be handled as if they are dialed from an extension, you want a context of ‘from-internal’.