Dial an external extension from an Asterisk IVR

I had to connect two Asterisk PBX I really had to split one PBX in two for bandwidth reasons but I wanted to keep them as one. One thing that I had to do was to keep the direct dial working on the main IVR. Well, there where TWO ivr’s now, so I had to make special magic on them.

To avoid the interference of FreePBX y edited, on both installations, the file


In the main office, to dial to the plant.


exten => _22X,1,dial(iax2/laplanta/${EXTEN})
exten => _62X,n,dial(iax2/laplanta/${EXTEN}

The other one, in the plant:

exten => _2[013]X,1,dial(iax2/oficinas/${EXTEN})
exten => _6[013]X,n,dial(iax2/oficinas/${EXTEN})

As you can see, the name of the IVR is not the one Asterisk is showing, it only has names as ivr-n. To find the right name I went to the editing page of the IVR in FreePBX and I looked the link it was showing for the editing of each IVR. The key was the ID, and the main IVR in the offices PBX was number 2. So the text I had to add was [ivr-2-custom].

FreePBX places an include => appname-custom as the first line of every application it adds. This custom thing may not exists –in fact, the usual thing is that there is no appname-custom–  but that’s not a problem with Asterisk. Go check the file /etc/asterisk/extensions_additional.conf and you will see. Make a search on -custom so you can find the custom call for an IVR, or calltrace, or any other thing.

On our code, we instruct our adendum to look for a number like 22X and to dial that number ${EXTEN} through the iax2 module using the trunk laplanta. Achtung! A change in the outbound routes will not modify this one, fixed here.

I think I’m going to create a new category on How to Connect Many Asterisks PBX.