Implementing trixbox in a network with legacy PBX

I work in a enterprise in Portugal that have about 55 extensions and legacy pbx, with primary connection to the provider (isdn pri) that works on top a e1 connection.
The objective is to gradually migrate to voip, so the new extensions would be connected directly to trixbox (voip), keeping the old pbx pbx and old extensions. The legacy pbx is a Alcatel 4200.

The configuration would be like this (Provider —> Trixbox —> Alcatel 4200 (PBX) ).

I have been digging around and studying the process how to accomplish this and i just need a opinion from someone with experience telling me if i am doing anything wrong.

The plan is to get a sangoma 102d, i know it has a wizard that remove some of the guest work but i am putting the process here:


#Connection to my provider

#Connection to my PBX Alcatel 4200


#Trunk group 1:
#the next line is what a Portugal style PRI is set to when connecting to telco
signalling = pri_cpe
group = 1
channel => 1-15,17-31
switchtype => EuroISDN

#Trunk group 2:
#The next context makes asterisk think these are extensions instead of trunks
#pri-net makes this PRI act like it is the telco, and connects to your other switch
group = 2
channel => 32-46,48-62

Finally i will create a ZAP trunk with freepbx (this will be used to connect to my provider):

Outgoing Settings
Zap Identifier (trunk name): 1
(i am not sure if i should use 1 or g1, to match the group1 in zapata)

Then i will create a ZAP extension with freepbx (this will be used to connect to my pbx Alcatel)

[ZAP Extension]
User Extension: 400
Display Name: Alcatel
This device uses zap technology.
channel: 32-62
(i also not sure if creating a zap extension and put all the channels from group 2 from zapata is correct)

Then i create a inbound route with freepbx

[Inbound Route]
Any cid any did
and route to destination
Extension 650

And last a outbond route with freepbx

[Outbound Route]

2XXXXXXXX ( will route national land calls)
9XXXXXXXX ( will route cell phone calls)
XXXX|. (this will route international calls)

Through trunk ZAP/1

Is it possible to put it work this way? or my setup is completly wrong?
I would appreciate some feeback

Sorry for my english
Thank you


I have done this before and we did some custom stuff outside of freepbx gui, but basically you should set up the 55 extensions as zap extensions in freepbx if you can dial them via the pri (if you have DID for all extensions, otherwice set up extensions for your DID’s). Create Inbound routes that Send’s the incomming DID to the correct extension. It’s a bit of work, but makes it easy to move someone from legacy to voip. And it makes your legacy pbx to a nice channelbank… You will get some issues with call transfer from a legacy ext to voip ext - it can be reduced with some config of the legacy pbx.

But it’s possible.

We had a context where the incomming pri landed in, with extensions for all voip ext - if it didn’t found any it bridged it to the legacy pbx pri, and similary on the other way around. It is easier to set up, if you have a few voip ext - and less things can go wrong…

We only have 9 DID numbers so most of the extensions cant be dialed from the pri, for what i understand i must create 9 zap extensions define the Direct DID that belongs in the configuration of each zap extension?

What about the remaining 46 extensions? I must add some kind of rule so i can dial them from a voip extension on my trixbox machine, i am thinking in creating a second zap trunk where i will define the “Zap Identifier (trunk name): 2” that will pick the configuration on zapata. Then i will create a outbond route where i will add “3XX” (this is number that all extensions from legacy pbx begins with) in the dial paterns, and use the ZAP/2 trunk.

Is this correct?

Thank you

And in my case the selection of the extension to ring is done in the Alcatel by DID number, not by channel number.

The calls from the telco always arrive at the first available PRI channel, starting from 31 and then downward. Also, the PBX selects for its outgoing calls always the 1st available channel starting at 32 and then upward

If your case is similar, you might want to look at

Basicly, it advises to use custom extensions in stead of zap extensions.

In my case, I used group 0 and group 1 in stead of group 1 and group 2

Also, if you want your Alcatel-connected extensions to communicate with Asterisk, you probably want to set overlapdial=yes .

In my case I had a 100-number block, so I had seperate DID numbers for all extensions. In your case you have more extensions then numbers, so this might be more challenging.

Have you control over the setup of your PBX? If so, you might consider faking a 100-number block, and assign each extension its own number in this block. A drawback of this is that the solution isn’t backwards compatible. In case of emergency you can;t simple bypass asterisk any more.

I am starting to see how to do it but i still have some questions

Where should i put “overlapdial=yes”?

Can you explain me how to configure those custom extensions?

I only need to create 9 custom extensions right?

I see an option there in custom extension
"This device uses custom technology.
dial" do i put here the correct extension of my alcatel pbx for my did number?

No, i dont have control over my legacy pbx and my provider wants we to pay for changing the configuration.

Thank you for answering

When you dial your phone numbers, can you see at the atsreisk CLI (asterisk -r) at which ZAP channels they enter? Does each phonenumber use its own set of ZAP channels, or is the first available used (top-down or bottom-up)?

Likewise, can you check which ZAP channels the PBX-extensions use when they connect to the outside world?

The biggest challange in your case might be how Asterisk can select a specifix PBX extension, and how it can detect a specifix PBX extension. Usually this is done either by channel and/or DID number, but in your case they are probably all pooled.

The overlapdial=yes is placed in the zapata.conf (or one of its include files),for the trunkspecificatin of the PBX, so near the signalling=pri_net

The definition of your extensions depend on whether your channels are pooled and/or dedictated

My channels are pooled, phone numbers use the first channel available.

You said " The biggest challange in your case might be how Asterisk can select a specifix PBX extension, and how it can detect a specifix PBX extension."

Does this mean my possible setup isnt correct?

To pass a call from provider or voip extension to my pbx:

First i will create the trunk for my pbx and define inbound route for my custom extensions using the did numbers, then i will create the 9 custom extensions that will the pick the did numbers and with the setting “This device uses custom technology.
dial” put the right pbx extension. For this to work right i will create a trunk to the pbx using my zapata group 2 that has the channels definied to use, then last will create a outbound route that will route “3XX” numbers to my legacy pbx.

To pass a call from pbx to trixbox or outside.

I think i dont need a inbound route for my legacy pbx, cause asterisk sees the numbers dialed from my pbx, correct?
Then i will create a outbound route that will route my dial plans for outside numbers using the trunk for my provider.

Tell me if i am wrong, and if yes how should i proceed

Thank you

Since the channels of your PBX are pooled, this means that as far as asterisk is concerend there are only 9 PBX extensions, each identified by their DID number. It has no way to select the individuals phones, unless in the PBX some DID numbers are mapped to 1 phone. But there are at least (44-8)=36 phones which share a DID number. .

When you dial out from your PBX, which DID number (callerid) is provided by the PBX? Are the phones grouped, and has each group its own outward DID number? or is only 1 DID number used for all outgoing traffic?


  • you can route inward calls to the PBX and/or SIP
  • the PBX and/or SIP can use the outward lines
  • you can reach a PBX phone from a PBX phone
  • you can reach a SIP phone from a SIP phone
  • you can reach a SIP phone from a PBX phone
  • you can NOT select each individual PBX phone from a SIP phone,

The Asterisk functions, like call-forwarding, will be applied to the DID number, and not to the individual PBX-phoens behind it.

Of course you can still use your Alcatel PBX functionality for forwarding atc

Basicly it will work, and you will still benefit form asterix/freepbx/trixbox, but you will have to live with the limitations the DID sharing imposes.

You can avoid the limitations by having your installer map each phone to its own (fake?) DID number in yoru PBX. However, they will probably charge for this and, if your installer and telco are the same, they might wonder/object to using a fake DID number.

Sorry for my delay answering, i am really thankfull for your answers. But i really need some guindance to how configure my trixbox especially how to configure my custom extensions.

In custom extension i have to put in the direct DID for the particular extension, correct? but how asterisk knows that the particular extension has to be routed to the alcatel pbx? where do i put that information? At least in zapata extension i can define wich channel the extension uses.

Thank you

You do this by using the Dial entry in the Device Options section of the Custom Extension
It should look like
Where 123456789 should be replaced by a number which is the same as the DID number

From there the ‘routing’ as programmed in your Alcatel PBX will take over. So if in the Alcatel this DID is configured to ring on 2 extensions, those extension will ring.

The /g2/ part will use the 1st available channel in the Group 2 range.

Now i just need to solve the problem with my voip extensions cant reach individual pbx extensions on my alcatel, planning to get a sangoma a200 with slave card to give total of 8 ports then i will connect to 8 available ports in my alcatel, and in trixbox i will pick that 8 channels and make a trunk.

But i just i am not sure with this, i read that FXS modules make the call and FXO modules make the devices ring, so the available ports on my alcatel are FXS ports, right?

Then i should get FXO modules for my analog cards? right?

But that doesnt make much sense for what i am thinking if asterisk has to make calls it has to be FXS modules and not FXO? or i am confused?
Another thing if a normal telephone is a FXO device, then how can it make calls?

Thank you for your answers

Basicly, a FXO port acts as a phone and a FXS port as a telephoneline from the telco.

See also

A telephone makes calls by dialing a number, and request the PBX to ring another phone.

Your scheme can work, but it is a workaround and will need some additional configuration. Maybe some other forum member has experience with this?

Hello All,

I need to connect my Omnipcx Alcatel ( to Asterisk(
Everyone can help me .