Call forward or redirection between two Asterisk boxes through SIP trunk


I have teh following setup

Box A - Asterisk 1.4.22 With extensions 1XXX
Box B - Asterisk 1.4.22 With Extensions 2XXX
FreePBX 2.5 installed on both of the boxes.
SIP Trunk between them as follows:


register => bmindmed:[email protected]



register => bmindbog:[email protected]

When someone in Box A dials 2XXX the call gets routed to Box B and vice-versa.

I have an IVR on both boxes and when someone dials 0 the call goes to a ring-group whic has operator extensions, I added 200 and then 100, I’m confused because the call never goes trhough the trunk to extension 200 from Box A to Box B.

My guess is, that it has something to do with contexts, but I haven’t been able to figure this out.

I appreciate your valuable suggestions.


Since you are running FreePBX 2.5 probably the best way is to configure Dundi. It is a way for one box to know all the extensions on another (or many other) server and treat them like they are a part of the local box. It’s real nice once you get it setup.

Currently how does one box know about the other boxes extensions?

Hi there fskrotzki

Well, the only way is that when at Box A someone dials 2XX or 2XXX the call gets routed to Box B and vice versa, whichever extension dialed gets directed the opposite way using the trunk.

DUNDI would be good but unfortunatelly I don’t know how to set it up, I have read some theory on it, but I have never implemented it.

I would like to know why doens’t it work when I have a ring goupr like this 100, 200, 201, 101, why Asterisk or FreePBS would report on Box A that 2XX extensions are unknown and vice-versa, what should I do to redirect calls ithough having to have people register on both boxes.

If you have some link to reffer me too or an example config based on what I told before, go ahead and email me or post it.

Thank you for your reply.

In a ring group, you would have to add the # symbol after the 2XX extension to tell FreePBX that this extension is external and so use the SIP trunk, otherwise it is treating it as an internal.

But I agree with fskrotzki, DUNDI would be best for this situation.

Hey mag (Leap Frog),

That was exactly what I needed, as I said, I have some Ring Groups which call different extensions if someone dials and the 1st person on the RG doesn’t answer it’d go to the 2nd, and that 2nd person is in another city.

But thank you man that’s the most thrilling thing and the happiest that’s happened to me today; I just added the # at the end of the remote extensions and IT WORKED!.

In the meantime, I still want some idea on how to dial using DUNDi and join together my two boxes.

Thanks o you and to all of those of the FreePBX team, this thing rocks.


You didn’t answer the question “Currently how does one box know about the other boxes extensions?” which makes it hard. Did you custom program each extension? create a special inbound route for the range, what? Luckly Mag took a shot and you got it working, but answering other peoples questions also helps and will help the next person who goes looking for the answer and comes across this thread.

There are a few documents here on this site on how to setup a Dundi config (use the search for Dundi Dundihack if I remember correctly and you get At the same time if you searched this site for Dundi you’d have come across the postings of John Mullinix (jmullinix),and his link to how to do it: which also explains it very nicely.

So that you understand a bit better. newer versions of FreePBX maintain a database of known extensions so that you don’t attempt create a duplicate dialing pattern. Because of this feature in FreePBX (it was introduced in 2.4.x) it now knows about the extensions. That’s why you should use the custom extensions if you create something “custom” so that they are “registered” in the database, once that is done it will consider them “local” even if they are remote (via Dundi). Once they are defined properly you can then refer to them just like any other extension. If it does not know about them and they need to be routed via a outbound route (must be how you are doing it and why I asked HOW) then you would need to use a # at the end to tell it to use a outbound route to dial it.

Another advantage of Dundi is when it is configured it will automatically know about the other system(s) extensions on the fly so that you can’t create a duplicate extensions which are also then a problem.

Sorry if I didn’t answer the question properly, here’s how I do to let each system know thw other system’s extensions.

I have
Sys A with extensions 1XX and 1XXX
Sys B with extensions 2XX and 2XXX

I created a SIP trunk between them and a route stating that when someone at sys A dials 2XX or 2XXX it’ll use the sip trunk and the same at sys B whe someone dials 1XX or 1XXX it’ll route the call to the extension at Sys A.

I had no knowledge on how to let each system know the others extensios, I just created the trunk and the route between the systems, It’s not the best way to do it and error prone but I only have 20 extensions on each system and people calling from the outside uses the IVR menu and then getsrouted to the proper destination being it Sys A or Sys B.

Again I apologize if I didn’t answer properly or wasn’t very cincise on my response.

Thanks again for your support, I’ll dive into the DUNDi stuff later this afternoon to see how it works and implement it.