Routing calls from PSTN via main PBX to Sub-PBX


i am having the following setup:

server1 has a sip trunk to my voip provider. all calls to a block of 200 phone numbers get routed to server1 by my voip provider. on server1 i can easy create extensions and assign DID and all is fine. now there is server2 which is connected via a iax2 trunk to server1. i can make calls from an extension on server2 via the trunk to server1 and then to my voip provider. how can i now route a block of 50 phone numbers to server2 ? i would logically think in inbound routes i should be able to select a trunk as destination but that is not the case. can anyone help with this ?

kind regards

For a large-scale installation such as this I think I’d try DUNDI, but since I don’t know that much about it you’d have to read up on it. I have another thought that might work but it’s more of a hack, and I think DUNDI is really the right way to do this.

ho wiseoldowl,

i have solved the problem now. i did not get it done on the freepbx environment, i had to touch config files. here is the link with the solution to my problem:

DUNDI looks very complex and i need to touch config files outside freepbx, so i rather choose above way which works fine for me.

thanks anyway!

Glad you got an answer, but to answer the question you had there about using a pattern, yes, it’s certainly possible. Taking part of the example shown…

exten => 02029011,1,Dial(iax2/your-trunk/02029011)
exten => 02029012,1,Dial(iax2/your-trunk/02029012)
exten => 02029013,1,Dial(iax2/your-trunk/02029013)
exten => 02029014,1,Dial(iax2/your-trunk/02029014)
exten => 02029015,1,Dial(iax2/your-trunk/02029015)
exten => 02029016,1,Dial(iax2/your-trunk/02029016)
exten => 02029017,1,Dial(iax2/your-trunk/02029017)
exten => 02029018,1,Dial(iax2/your-trunk/02029018)
exten => 02029019,1,Dial(iax2/your-trunk/02029019)

…all those lines could be replaced by one:

exten => _0202901X,1,Dial(iax2/your-trunk/${EXTEN})

Well, actually the X would replace all digits in the range 0-9 - if for some reason you really had to be more specific, you could use something like [1-9] in place of the X.

Note the underscore at the start of the pattern, and the use of the ${EXTEN} variable rather than repeating the number.

Mind you, I have not actually tested this, but I’m 99% sure it would work.

thanks for that. but what does the underscore do ?


Indicates that it’s a pattern rather than a user account name. Technically (although FreePBX doesn’t support it) you could have a sip extension named “[email protected]” so Asterisk needs a way to interpret whether something is a pattern or an actual account name.