HOW TO: Connect Asterisk to ADTRAN Atlas 550 Channel Bank

Greetings; I’m new to the Asterisk community, but old hat in the IT world. I recently attended the Asterisk Advanced training course although I did not take the dCAP test because it was my first real exposure to Asterisk. (I’m also a little shaky on *nix too.) Why did I skip the Fast Start class? Well, I had already compiled and set up a test Asterisk system in my lab as part of a study to determine if Asterisk would be a viable replacement for our aging NEC legacy system. Though the course of the class I realized I would need a little more hardware in my “lab” to simulate our environment. In discussions with Jared Smith (awesome guy) he suggested an ADTRAN Atlas 550 as a “service provider in a box” for emulating all sorts of provider services and protocols. If you’re interested these things are super cheap on eBay. I purchased my ADTRAN Atlas 550 with a T1 card, V.35 card, and three FXS-8 for $175.00.

Purpose: I work for a manufacturing company. We have a number of phones on the plant floor that live in a hostile environment. Currently we use a cheap analog Cortelco single-line wall unit as these phones see a lot of wear, tear, and flat-out abuse. Obviously we would need a method of connecting all these analog devices to Asterisk. With all the cabling already in place and punched down, a single strategically placed ADTRAN Atlas 550 would be perfect for the interconnection between the digital Asterisk and analog phones.

When I started trying to configure this setup I searched high and low for examples… I found very little useable information. This post is a collection of that information, in one place, that someone else who is trying to learn Asterisk/Telephony could use as a foundation. I’ll try to be as descriptive as I can because nothing is more frustrating than to read a post or mailing list message that’s either left open ended or the answer is wrong. What I write here isn’t hard and fast as I’m sure there’s other ways to solve the problem. This is just what worked for me while pointing out some of the issues I ran into and how I over came them. If anyone has anything to add please post up.

Assumptions: I’m going to assume you know how to navigate around Linux and edit files. I’m also going to assume that you have a good working Asterisk system and known good hardware. Certain steps are missing because they don’t directly pertain to this configuration… I’ve just assumed you got there as part of your normal compiling/install or basic configuration steps.

Suggested Documentation:
Your Digium T1 card’s documentation
Your Atlas’s system manual
ADTRAN Networking Academy for a few examples and configuration hints.

The “Lab” Setup: (Know your setup! Differences from my setup may cause issues!)

Hardware
[ul]
[li]Workstation for running Asterisk[/li]
[li]Digium TE122 Single Span T1 Card (PCI)[/li]
[li]Analog Phones[/li]
[li]SIP Phones[/li]
[li]Ethernet Switch[/li]
[li]ADTRAN Atlas 550 (1200305L1) with the following cards: T1 Card (1200307L1), Nx56/64 V.35 Card (1200311L1), 8-Port FXS Card (1200309L1). Firmware C.09.03.01 12/18/03.[/li][/ul]

Software
[ul]
[li]CentOS 5.5 (fully patched as of 11/20/2010)[/li]
[li]Asterisk 1.8.0[/li]
[li]libpri 1.4.11.4[/li]
[li]DAHDI 2.4.0[/li][/ul]

Putting it all together physically:
Hopefully at this point you already have Asterisk setup and the SIP phones talking to each other. I’m going to mainly focus on the ADTRAN Atlas to Asterisk connection at this point. With the Atlas powered down connect a T1 Crossover Cable from the T1 card on the Atlas to the T1 port on the Asterisk system. It must be a T1 Crossover Cable; a standard Ethernet patch cable will not work! Power up the Atlas and ignore the alarm light on the T1 card if you see one. You’ll need to connect a configuration cable from your PC’s serial port to the CRAFT port on the Atlas.

Configuring it:

<<<<Asterisk>>>>
In relative terms, this was the easy part. Again, I’m going to assume you know how to navigate Asterisk and restart services in the appropriate order. I’ll start with the DAHDI configuration part:

/etc/dahdi/system.conf

loadzone = us
defaultzone = us
span = 1,0,0,esf,b8zs,yellow
bchan = 1-23
dchan = 24
echocanceller = mg2,1-23

Pretty standard stuff in terms of configuration. Line by line:
[ul]
[li]I want to use US indications[/li]
[li]Use US indications by default[/li]
[li]This is the first span, use timing on the card, line build out is less than 133 feet, extended super frame, Bipolar coding, and transmit yellow alarms.[/li]
[li]Bearer Channels[/li]
[li]Delta Channel[/li]
[li]mg2 Echo Cancellation on lines 1-23 since this card doesn’t have a hardware echo canceller attached.[/li][/ul]
I wanted to use “Robbed Bit Signaling” (CAS) on the T1 so all 24 channels would be available for use, but I could not make the Atlas deliver Caller ID to Asterisk. Your next question might be why didn’t I just map a single channel to each phone connected to the Atlas? First of all that’s very tedious on the ADTRAN side of things and then what happens when I add five more analog phones above the twenty-four already in service? In theory I would have to add another ADTRAN Atlas then occupy another expensive span on the Asterisk system. A workaround would be to add one more ADTRAN Atlas and connect it to the first Atlas either by T1 or V.35. Because the connection to the Asterisk system is trunked to the first Atlas I have twenty-three useable “phone lines” for all the phones connected to both Atlas’s FXS ports. In my case it would be highly unlikely I would have all forty-eight phones vying for service at the same time. Next up is the DAHDI configuration in Asterisk:

/etc/asterisk/chan_dahdi.conf

[channels]
group = 1
echocancel = yes
usecallerid = yes
callerid = asreceived
context = local
signalling = pri_net
switchtype = national
channel => 1-23

Line by line:
[ul]
[li]Hardware Channels context[/li]
[li]Group 1. This will make more sense in a minute.[/li]
[li]Use echo cancelling[/li]
[li]Use Caller ID[/li]
[li]Trust incoming caller ID[/li]
[li]What context to deliver the call in extensions.conf.[/li]
[li]The Asterisk system is the service provider so I’m signaling like I’m the NETWORK.[/li]
[li]What signaling the PRI is using; in this case it’s National ISDN 2.[/li]
[li]How many channels this group can use.[/li][/ul]

Configure extensions.conf so we can make some calls:

/etc/asterisk/extensions.conf

; ******************************************
; ** GENERAL SETTINGS FOR EXTENSIONS

[general]
static=yes
writeprotect=no
autofallthrough=yes
clearglobalvars=no
priorityjumping=no

; ******************************************
; ** GLOBAL VARIABLES

[globals]

; ******************************************
; ** FEATURES AND DEFAULTS

[features]

exten => 1000,1,Answer()
exten => 1000,n,Playback(lyrics-louie-louie)
exten => 1000,n,Hangup()

exten => 1001,1,Zapateller(answer)
exten => 1001,n,Wait(1)
exten => 1001,n,Background(privacy-stop-calling-not-welcome2)
exten => 1001,n,Hangup()

; ******************************************
; ** DIALPLAN BELOW THIS LINE

[users]

include => features

exten => 2001,1,Dial(SIP/sipphone_one,20)
exten => 2002,1,Dial(SIP/sipphone_two,20)
exten => 2003,1,Dial(DAHDI/g1/2003)
exten => 2004,1,Dial(DAHDI/g1/2004)

[local]

include => users

exten => _NXXNXXXXXX,1,Answer()
exten => _NXXNXXXXXX,n,Playback(touchtone3)
exten => _NXXNXXXXXX,n,Hangup()

This is a simplistic extensions.conf that tests basic functionality and plays back funny messages if you get it right. Extensions in the 1000’s play back messages for testing purposes only. If you look back at the chan_dahdi.conf file you’ll see that I’m delivering incoming calls from the analog phones into the “local” context. This allows them to make local calls (we’re required to call using the area code) and by an include statement they can call internal extensions defined in the “users” context. One more include gets them to the features in the 1000’s. You should recognize the SIP statement in the Dial command for extension 2001. Look at extension 2003 which is an analog phone attached to the Atlas. Dissecting the Dial command I am telling Asterisk to call 2003 using DAHDI and where it can find the extension in group 1. Is your head spinning?

Let’s break it down a little further. Going back to chan_dahdi.conf again I grouped all twenty-three channels of the T1 PRI into group 1 (group = 1). By doing so when Asterisk wants to call extension 2003 it asks DAHDI to do it and use group 1. DAHDI grabs the first open channel in group 1 and tries to complete the call. The Atlas on the other end receives the call and completes it, but you’ll see that in the configuration of that device. DAHDI knows to use group 1 because it is signified by option “g1” after the first forward slash. What happens when all twenty-three channels are in use on the T1 PRI? Asterisk will return a “Busy” or “Congestion” on the called channel.

Restart Asterisk and DAHDI to enact your configuration changes. Or simply reboot the computer, that’s easier.

<<<<ADTRAN Atlas>>>>
Now the hard, well, more tedious part. I’m going to assume you have your ADTRAN Atlas reset to factory defaults. Connect to the console using a Telnet program. (Example: Putty for Windows) Since my particular ADTRAN Atlas uses a console GUI for configuration I will have to walk you through each individual steps because it won’t give you many hints when something isn’t configured right.

System Config > Primary Timing Source
Set it to T1/PRI. Remember that Asterisk is the “network” (chan_dahdi.conf) so we want to sync with it.

Dial Plan > Global Param
Set End of Number Timeout to 6. This waits six seconds after the last digit is dialed before attempting the call. This only happens if the number dialed doesn’t match a pattern.
Clear Area or City Code to be blank. We don’t need it and it messes with Caller ID.

Dial Plan > Network Term
When you press the right arrow key it should add the first entry and allow you to configure it. If not, press I to add the first entry. Configure it this way:
Slot/Service: 1/PRI-1 (My card is in network slot 1)
Port/Packet Endpoint: T1/PRI
Signaling: PRI

Now open the “Outgoing Number Accept List” inside the Network Term you just created:
Dial Plan > Network Term [1] > Outgoing Number Accept List
Add a new entry like you did above. Since it’s your first entry your SRC ID will be 0. Change the following:
Accept Number: $

Back up using the left arrow key and enter the following configuration:
Dial Plan > Network Term[1] > Interface Configuration
Change the following:
Switch Type: National ISDN
First DS0: 1
Number of DS0s: 23
Outgoing Caller ID: Send As Provided

Now back up using the left arrow key until you’ve highlighted “Dial Plan” on the menu. This saves the configuration and don’t be surprised if you see the channel come up in the Asterisk console. Everything about the configuration should be self explanatory so far except for the “Outgoing Number Accept List” and its options. The accept number is set to “$” (Dollar sign) because we want to accept anything the analog phones dial and then let Asterisk sort out what to do with it. No sense in adding a potential configuration tripping point, let Asterisk spank their hand when they dial an invalid number or feature. For those interested; the “Network Term” part of the dial plan is for configuring services that terminate from the network. Remember that Asterisk is the “network” in this example. Now let’s configure the analog phones:

Dial Plan > User Term
When you press the right arrow key it should add the first entry and allow you to configure it. If not, press I to add the first entry. Configure it this way:
Slot/Service: S1/FXS-8 (This FXS card is in Module slot 1)
Port/Packet Endpoint: 1)FXS 1/1 (The phone is plugged into port 1 of this card)

Now open “Incoming Number Accept List” inside the User Term you just created:
Dial Plan > User Term[1] > Incoming Number Accept List
Add a new entry like you did above. Since it’s your first entry your SRC ID will be 0. Change the following:
Accept Number: 2003

Back up using the left arrow key and enter the following configuration:
Dial Plan > User Term[1] > Interface Configuration
Change the following:
Signaling Method: Loop Start
Caller ID number: 2003

Now back up using the left arrow key until you’ve highlighted “Dial Plan” on the menu. The “User Term” part of the dial plan is for configuring service that terminates to the Atlas. At this point you should be able to pick up the analog phone and hear dial tone. This is the Atlas generating a local confidence tone, NOT Asterisk. Try to dial a local number and you should hear a message telling you to purchase a touchtone phone. Now try dialing one of the SIP phones; after you dial the four digits there will be a six second pause then the “End of Number Timeout” expires and the Atlas tries to complete the call. You should see call messages scrolling past in the Asterisk console and hear the SIP phone ringing. Check the display on the SIP phone and make sure Caller ID is being delivered. Call the analog phone from a SIP phone and it should ring and stop as soon as you hang up.

Congratulations, you’ve set up an inexpensive channel bank!

Troubleshooting:
After configuring the “Network Term” on the Atlas you can use dahdi_tool to make sure the T1 Span Card and the Atlas T1 card are talking. DAHDI tools are not compiled with the DAHDI installation so in your source directory enter the tools directory and run “make install” to compile the tools.

Check the Event Log under “System Status” on the Atlas for some clues.

When in doubt, reboot. All of it.