IAX from Asterisk Vanilla to FreePBX

I am tasked with doing a migration test to see how we can get our system migrated to using FreePBX. Currently we have 17 locations and a corporate office management of flat files varried versions has proven to be less than ideal. For this first test I am testing out how it would work having an IAX2 trunk that will pass calls from one system to another. I have been following this tutorial Connecting Two FreePBX/Asterisk Systems Together Over the Internet - PBX GUI - Documentation

FreePBX = Sangoma Linux release 7.8.2003 (Core) with Asterisk 16.17.0

The setup has been performed exactly how it is described for Step 1. System1 to the letter (minus the last three lines). System 2 beginning on step 3 however is a vanilla asterisk system running 15.6.2 below is the config I have so far.


exten => _2XXX,1,Dial(IAX2/System1/${EXTEN},30,g)
    same => n,Hangup(${HANGUPCAUSE})



Yes for the purpose of testing I am just using secret=password from the console of System2 I can see the followign when a call is made to 2002 below you see that I am getting a busy/congested error and instant hangup.

  == Setting global variable 'SIPDOMAIN' to ''
    -- Executing [[email protected]:1] Dial("PJSIP/4912-00000171", "IAX2/System1/2002,,g") in new stack
    -- Called IAX2/System1/2002
    -- Hungup 'IAX2/System1-20892'
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [[email protected]:2] Hangup("PJSIP/4912-00000171", "50") in new stack
  == Spawn extension (SANITIZED-voip, 2002, 2) exited non-zero on 'PJSIP/4912-00000171'
    -- Executing [[email protected]:1] NoOp("PJSIP/4912-00000171", "DialStatus returned: CHANUNAVAIL HangupCause returned: 50") in new stack
    -- Executing [[email protected]:2] Hangup("PJSIP/4912-00000171", "50") in new stack
  == Spawn extension (SANITIZED-voip, h, 2) exited non-zero on 'PJSIP/4912-00000171'

Here is an iax peer query…

spk-asterisk*CLI> iax2 show peers
Name/Username    Host                                           Mask                                      Port           Status      Description
System1/System1                             (S)                           4569  (T)      OK (3 ms)
1 iax2 peers [1 online, 0 offline, 0 unmonitored]

I am hoping that someone out here has an idea of where I may be going wrong on this setup. I can ping from one system to another. I can setup a sip trunk and get calls flowing in a single direction. We would really like to get away from the legacy sip trunks that we are using now. Both systems are on the same subnet. Systems do not have overlapping extensions. When I dial out from FreePBX I can see the call using outbound route 3 on the correct trunk. Nothing displays in either console when the other initiates a call.

I have tried this as well:

exten => _2XXX,1,Dial(IAX/System1/${EXTEN},30,g)

That told me I have to use the IAX2.

Thank you for any assistance you may be able to lend and I hope that I have provided a clear enough picture of what I am working with to easy in diagnosis and if more information is required of me I can pass that along in a jiffy.

Connecting two or three FreePBI is manageable, for 17 I would suggest a true proxy, perhaps kamailio, it will make your life much easier.

Some of the shops are 2-3 man locations with as little phones as that as well. In fact most of them are around that population. 90% of traffic that goes on is to-from the PSTN using either sip trunking or pots lines to a Patton. The 4 digit dialing from location to location is the only thing that we really need the IAX trunks for. My shop is a one of kind with 30+ endpoints and we have maybe around 100 minutes a day shop-to-shop calling. scattered over 15 calls or so.

If you really think Kamailio would be a better fit than FreePBX I am more than willing to give that go. I only went down this road cause I have used FreePBX for years now.

Why cant you do this with SIP trunks?

No , kamailio not to replace your FreePBI but to be the SIP proxy between all of them (and your network trunks if appropriate) DSipRouter makes it all a warm and gooey thing.

If lots of 2-3 man operations, one cloud based FusionPBX multihoming all of the shops would be a very economic solution replacing dozens of FPBI’s

Setting up new inter-office trunks, I would choose SIP over IAX, unless you have a network constraint that would preclude SIP. Reasons include:

  1. If you need to change either end to a non-Asterisk-based system, the trunk will still work.
  2. Compatible with many proxies.
  3. Better tools for analysis and debugging.
  4. Easier to get help; there are many more SIP experts.
  5. If all else fails, SIP is a plain text protocol that is easy to troubleshoot manually.

If the branch is using (only) SIP trunks to the PSTN, I agree with @dicko that eliminating the PBX and having the endpoints register to the headquarters PBX (cloud or on-site) greatly simplifies management and maintenance. However, with POTS trunks it’s a tougher call. For example, an internet outage would prevent making an emergency call.

To troubleshoot your present problem, at the Asterisk command prompt type
iax2 set debug on
(or if you switch to a pjsip trunk)
pjsip set logger on
then make a failing call.
The IAX2 or SIP trace will appear in the Asterisk log, along with the regular entries.

I’d suggest the balance between a satellite PABX and direct extensions on the main system also depends on whether there is a lot of local traffic within the branch and how critical that traffic is.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.