How to set up an IAX2 trunk in FreePBX

Strong desire to stick with IAX2 trunks for this implementation

Equipment Overview:
I have two RasPBX:

  • One at site A (v13, work office)

  • One at site B (v15, my house)

  • One cloud FreePbx (Sangoma Distro) on Cyberlynk.

Issue:

  • Previously I had all three connected via IAX2 trunks, but then the cloud server failed mid upgrade to FreePBX 15.
  • I started over with Cyberlync and built a new v16 image for the cloud and rebuilt my IAX2 trunks, but for some reason I cannot reach Site A or B from my cloud server via the trunks.
  • Site A and B are connected and work via IAX2 trunks just fine.
  • Prior to the reimage the cloud server worked too.
  • I am getting an “All circuits busy” message and hangup cause 0, its not leaving the cloud PBX.
  • I’ve tried turning off all the firewalls on FreePBX and I know the credentials work, because Site A and Site B IAX2 trunk connections work.

I am not sure how to troubleshoot this as the IAX2 trunks don’t show monitored. I am at a loss since this same provider was working fine on Saturday (with the old FreePBX cloud server before it broke). I have never had it just not work before.

I am not sure how to troubleshoot this, I looked at the great write up from Jared linked above, but am still having issues. Anyone have any ideas?

Thanks!

I have never used IAX. What happens when you reproduce your call after enabling IAX debug?

iax2 set debug on
2 Likes

That’s what I was looking for. I’ll try it out and report back.

Thanks @PitzKey, this helped alot. It looks like the trunk was connecting to the far end, and I think I found the failure point but no idea why it is failing this way.

Failed Call from Cloud FreePBX to site A:

*IAX2 Debugging Enabled*
*Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 000 Type: IAX     Subclass: POKE*
*   Timestamp: 00007ms  SCall: 01099  DCall: 00000 IPADDRESS:4569*
*Tx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: PONG*
*   Timestamp: 00007ms  SCall: 00001  DCall: 01099 IPADDRESS:4569*
*Rx-Frame Retry[ No] -- OSeqno: 001 ISeqno: 001 Type: IAX     Subclass: ACK*
*   Timestamp: 00007ms  SCall: 01099  DCall: 00001 IPADDRESS:4569*

*Dial("PJSIP/Extension-00000003", "IAX2/CTT/00,300,Tb(func-apply-sipheaders^s^1,(1))U(sub-send-obroute-email^00^XXXXXXXXXX^1^AAAAAAAAAA^^ZZZZZZZZZZ)") in new stack*
*[2022-06-14 00:03:15] WARNING[11740][C-00000003]: chan_iax2.c:5839 ast_iax2_new: No formats specified for call to: IAX2/WORK-17313*
*[2022-06-14 00:03:15] WARNING[11740][C-00000003]: app_dial.c:2576 dial_exec_full: Unable to create channel of type 'IAX2' (cause 0 - Unknown)*
*   -- No devices or endpoints to dial (technology/resource)*
*   -- Executing [[email protected]:35] NoOp("PJSIP/Extension-00000003", "Dial failed for some reason with DIALSTATUS = CHANUNAVAIL and HANGUPCAUSE = 0") in new stack*

Successful Call from site B to site A:

Tx-Frame Retry[000] -- OSeqno: 000 ISeqno: 000 Type: IAX     Subclass: NEW
   Timestamp: 00026ms  SCall: 24645  DCall: 00000 IPADDRESS:4569
   VERSION         : 2
   CALLED NUMBER   : 00
   CODEC_PREFS     : (ulaw|alaw|gsm)
   CALLING NUMBER  : XXXXXXXXXX
   CALLING PRESNTN : 0
   CALLING TYPEOFN : 0
   CALLING TRANSIT : 0
   CALLING NAME    :
   LANGUAGE        : en
   USERNAME        : USERNAME
   FORMAT          : 4
   FORMAT2         : ulaw
   CAPABILITY      : 14
   CAPABILITY2     : Unknown
   ADSICPE         : 2
   DATE TIME       : 2022-06-14  06:31:38
   CALLTOKEN       : 51 bytes
 
Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 001 Type: IAX     Subclass: AUTHREQ
   Timestamp: 00007ms  SCall: 06678  DCall: 24645 IPADDRESS:4569
   AUTHMETHODS     : 3
   CHALLENGE       : \x36\x38\x36\x38\x39\x36\x32\x31\x32
   USERNAME        : USERNAME
 
Tx-Frame Retry[000] -- OSeqno: 001 ISeqno: 001 Type: IAX     Subclass: AUTHREP
   Timestamp: 00052ms  SCall: 24645  DCall: 06678 IPADDRESS:4569

It seems like it doesn’t know which codec to use, but I am not sure why? Any ideas?

Not sure if there’s such a thing, but try iax2 show peer <peer> and see what codecs are listed and if they match with the other two peers.

Before worrying about codecs, you need to worry about why it didn’t create an IAX2 channel to actual dial. Codecs won’t be a factor until the Dial is successful and the call is answered. Only then will the codecs matter and then you’ll get a completely different error.