Setting up an Asterisk system as a ‘middleman’

Installing an Asterisk server using Trixbox 2.2.4 between the Telco and a Nortel MICS.’, ‘

Installation And Configuration

Hardware Used

  1. Digium TE220 PCI-E Dual T1 Card
  2. Standard PC with PCI-E Slot
  3. T1 Cross Connect (Two RJ45 jacks, in my case)


I used .Nortel-Asterisk-0.2.pdf. as a general guide on
setting this up. The only major difference is that we use National (NI shown
in NRU). Also, I created an extensions_custom.conf file and included it in
extenstions.conf because Trixbox likes to play with the normal files. This
way, any changes done on the FreePBX interface will not overwrite our custom


  1. Installed Digium TE220 Card
  2. Installed Trixbox 2.2.4 (Prepackaged Asterisk Solution)


First step is to configure the hardware. Out of the box,
the T1 card should have amber lights blinking between the two T1 ports. This
indicates that the card isn.t configured (at all?). First, we need to define
each port so we edit the /etc/zaptel.conf file as so:


# PRI to telco




# PRI to Nortel




This tells it the T1 protocol information as well as
defining the channels for each port.

Again, because Trixbox likes to change files, we add this to
the end of the /etc/asterisk/Zapata.conf file:


;Include custom configs

#include zapata_custom.conf

And then make our real configs in the Zapata_custom.conf


;Incoming PRI






channel => 1-23

; PRI to Nortel






Now, these channel numbers are what you will see in Asterisk
if you do a .zap show channels. from the CLI. Because we have them bridged for
the most part, any call on 1-23 will also show up on 25-47 to show which
channels are bridged.

At this point, a reboot should make the lights on the back
flash red. And if you do a .zap show status. it will show them RED. As soon
as you plug it into the Telco T1, it should go green.

To connect to the Nortel MICS, you need a T1 crossover
cable, or as I used in my case, two RJ45 jacks with crossed over wires.

Now, to setup the routing.

Being that my first goal was to simply route every incoming
call to the Nortel MICS, and every call being made from the Nortel MICS out to
the Telco. One of the things I learned is that the Nortel MICS requires 7
digits coming in, and also strips a 9 from any extensions being dial. I
believe this is the reason 19XX DIDs us a 7XX extension. So, to start, I
created the [to-nortel] context and made it the standard route for all incoming

Under FreePBX, on the inbound routes page, I set it to
.Custom App. and used .to-nortel,${DNID},1.. This tells it to call the
.to-nortel. context and pass it the ${DNID} variable, which is the DID being



exten =>

This way, the DID then becomes the ${EXTEN} being passed to
the dialout-trunk. In the above code, we are telling it to dialout on trunk 1,
which is the T1 to the Nortel MICS and pass it ${EXTEN} which is the 7 digit
DID coming from the Telco. As noted, doing a direct ${DNID} also worked, but
when you looked at the call reports page, it would only show the destination as
S (System) instead of the correct destination extension. Anyway, with this
little bit of code, all inbound calls are routed to the Nortel MICS and it
accepts and connects them to the appropriate extension.

Next, we need to add the ability for all Nortel MICS
extensions to be able to dial out. And to do so, I created the following:



exten =>

exten =>

exten =>

exten =>

exten =>

exten =>

exten =>

This tells Asterisk to accept any of the provided numbers
and dialout on trunk 2, which is the T1 to the Telco. Because the Nortel MICS
requires you to dial a 9 to get an outside line (and strips the 9 before
passing it to the T1), we needed to do a little modification to the extensions
to allow the Nortel MICS to dial new extensions like 926. In this example, the
Nortel MICS would stip the 9 and send out only 26 to the T1. Asterisk will see
the 26 number, and then insert the 9 back into it and accept it as an internal
call. This allows for new extensions to match their DIDs of 19XX.

Next, we needed to create an outbound route for new
extensions to be able to dial Nortel MICS extensions. So, under FreePBX, I
created an outbound routed named .Nortel. with a dial pattern of just 711.
Being that it won.t ever be a valid extension on the Nortel MICS, it.s a safe
number to use. This is only needed to create the routing context. By default,
the routing context also includes .outrt-001-Nortel-custom. which doesn.t
exist. But, as we need to do some more extension manipulation, we are going to
create that context to use. So, we add the following to extensions_custom.conf
as well.



exten =>

exten =>

exten =>

exten =>

exten => _7XX,n,Macro(dialout-trunk,1,40919${EXTEN:1},,)

exten =>

exten =>

exten =>

exten =>

First, I.ll explain the 8XX extension, as it is easier.
Because the Nortel MICS requires 7 digits coming in, we need to take the 3
digits dialed and add 4091 to the beginning to make it 40918XX. This is pretty
simple. We also mark it as an intra company route so that we pass the CID for
the extensions along. Now, because the 7XX extensions actually have a 19XX
DID, we need to strip the 7 from the beginning of the extension and add 40919
to the beginning. The :1 after the EXTEN tells it to strip the first number.
And as before, we add the 40919 to the beginning. It.s as simple as that. 0
is there so that you can press 0 and get the operator, which is extension 810.

New Extensions

Now, when we create new extensions in Asterisk, there are a
few steps we have to do. First, we create the extension using FreePBX and have
to make sure we put in the direct DID of 40919XX (for a 9XX extension), we also
have to put in the 10 digit Outbound Caller ID as XXX40919XX. With these
settings, the new extension will be able to dial out as well as Nortel MICS
extensions. But, Nortel MICS extensions will not be able to dial the new
extension without adding it to the .from-nortel. context explained above.

Leave a Reply