Adtran TA924 PRI Conversion – Routing Inbound DIDs to FXS Ports or via a SIP Trunk to Asterisk and Allowing Bi-Directional Communications Between the Two

I have to say, I’ve worked with the Adtran TA924 Gen1 and Gen2 in the past and thought it was a great product then, but here recently I’ve just rediscovered the amazing flexibility of this unit and I am extremely impressed.

I’ve used the TA924 with a SIP trunk from both a Metaswitch and Asterisk before to convert to analog FXS ports and have had great success. It has always been rock solid but even back when the device was still in it’s infancy stages, it had a few limitations. I remember specifically when the unit could only do a PRI into a PBX and that is certainly no longer the case any more. There doesn’t seem to be anything this unit can’t do at this point. <3

At work, we had around 20 plus regular POTS lines through AT&T and were getting massively raped over the past several years (every year our prices have went up and at the time of porting our numbers out, we were looking at $74 dollars per POTS line and not including usage charges. Effing ridiculous. That is why I hate AT&T and refuse to support them, not to mention all their NSA spying garbage.) and I got a great deal on a PRI through our fiber internet provider so I needed a way to sort of peel out some of the channels into fax lines with DIDs and then bring the rest of the lines into my Asterisk server. In comes my old TA924 Gen2, that was collecting dust on a shelf, to the rescue.

After a firmware update and a whole lot of tinkering, first I was able to set up a complete test environment with an Asterisk box, a Sangoma T1 card, and the TA924. I was able to create the PRI in Asterisk acting as the Network and the TA924 as the User side of things and I was able to get both inbound and outbound calling and passing of fake DIDs to each. In addition to that, I was able to get caller ID working between the two. Here are a few hints if you are ever trying to set that up.

wanpipe1.conf

#================================================
# WANPIPE1 Configuration File
#================================================
#
# Date: Wed Dec  6 20:29:03 UTC 2006
#
# Note: This file was generated automatically
#       by /usr/local/sbin/setup-sangoma program.
#
#       If you want to edit this file, it is
#       recommended that you use wancfg program
#       to do so.
#================================================
# Sangoma Technologies Inc.
#================================================

[devices]
wanpipe1 = WAN_AFT_TE1, Comment

[interfaces]
w1g1 = wanpipe1, , TDM_VOICE, Comment

[wanpipe1]
CARD_TYPE       = AFT
S514CPU         = A
CommPort        = PRI
AUTO_PCISLOT    = NO
PCISLOT         = 4
PCIBUS          = 6
FE_MEDIA        = T1
FE_LCODE        = B8ZS
FE_FRAME        = ESF
FE_LINE         = 1
TE_CLOCK        = MASTER
TE_REF_CLOCK    = 0

TE_HIGHIMPEDANCE        = NO
TE_RX_SLEVEL    = 360
HW_RJ45_PORT_MAP = DEFAULT
LBO             = 0DB
FE_TXTRISTATE   = NO
MTU             = 1500
UDPPORT         = 9000
TTL             = 255
IGNORE_FRONT_END        = NO
TDMV_SPAN               = 1
TDMV_DCHAN              = 24
TE_AIS_MAINTENANCE = NO         #NO: defualt  YES: Start port in AIS Blue Alarm and keep line down
                                #wanpipemon -i w1g1 -c Ttx_ais_off to disable AIS maintenance mode
                                                                #wanpipemon -i w1g1 -c Ttx_ais_on to enable AIS maintenance mode
TDMV_HW_DTMF            = YES           # YES: receive dtmf events from hardware
TDMV_HW_FAX_DETECT              = NO            # YES: receive fax 1100hz events from hardware
HWEC_OPERATION_MODE     = OCT_NORMAL    # OCT_NORMAL: echo cancelation enabled with nlp (default)
                                                                                # OCT_SPEECH: improves software tone detection by disabling NLP (echo possible)
                                                                                # OCT_NO_ECHO:disables echo cancelation but allows VQE/tone functions.
HWEC_DTMF_REMOVAL       = NO    # NO: default  YES: remove dtmf out of incoming media (must have hwdtmf enabled)
HWEC_NOISE_REDUCTION    = NO    # NO: default  YES: reduces noise on the line - could break fax
HWEC_ACUSTIC_ECHO       = NO    # NO: default  YES: enables acustic echo cancelation
HWEC_NLP_DISABLE        = NO    # NO: default  YES: guarantees software tone detection (possible echo)
HWEC_TX_AUTO_GAIN       = 0     # 0: disable   -40-0: default tx audio level to be maintained (-20 default)
HWEC_RX_AUTO_GAIN       = 0     # 0: disable   -40-0: default tx audio level to be maintained (-20 default)
HWEC_TX_GAIN            = 0             # 0: disable   -24-24: db values to be applied to tx signal
HWEC_RX_GAIN            = 0             # 0: disable   -24-24: db values to be applied to tx signal

[w1g1]
ACTIVE_CH       = ALL
TDMV_HWEC       = YES
MTU             = 8

system.conf

#autogenerated by /usr/sbin/wancfg_dahdi do not hand edit
#autogenrated on 2015-08-28
#Dahdi Channels Configurations
#For detailed Dahdi options, view /etc/dahdi/system.conf.bak
loadzone=us
defaultzone=us

#Sangoma A102 port 1 [slot:4 bus:6 span:1] 
span=1,0,0,esf,b8zs
bchan=1-23
echocanceller=mg2,1-23
hardhdlc=24

chan_dahdi.conf

;autogenerated by /usr/sbin/wancfg_dahdi do not hand edit
;autogenrated on 2015-08-28
;Dahdi Channels Configurations
;For detailed Dahdi options, view /etc/asterisk/chan_dahdi.conf.bak

[trunkgroups]

[channels]
context=default
usecallerid=yes
hidecallerid=no
callwaiting=yes
usecallingpres=yes
callwaitingcallerid=yes
threewaycalling=yes
transfer=yes
canpark=yes
cancallforward=yes
callreturn=yes
echocancel=yes
echocancelwhenbridged=yes
relaxdtmf=yes
rxgain=0.0
txgain=0.0
group=1
callgroup=1
pickupgroup=1
immediate=no

;Sangoma A102 port 1 [slot:4 bus:6 span:1] 
switchtype=national
pridialplan=unknown
prilocaldialplan=unknown
facilityenable=yes
context=from-whatever
group=1
signalling=pri_net
channel => 1-23

Again, those were suggestions on how to create a PRI from Asterisk to the Adtran if you ever wanted to.

Then came the implementation phase of the project. As a side note, the pinout of the T1 on the Adtran did throw me off a bit (so much so that I had to download the user guide that showed the pinout). When connecting directly from my Sangoma card into the Adtran, normally you would use a crossover cable but they must already have taken the crossover into account when they built the Adtran unit, so it required just a regular straight through cable.

Sangoma card to Adtran T1 Pinout (clip facing downwards)
Side A (TA568B)
Pin 1 - White Orange 
Pin 2 - Orange
Pin 4 - Blue
Pin 5 - White Blue

Side B (TA568B)
Pin 1 - White Orange 
Pin 2 - Orange
Pin 4 - Blue
Pin 5 - White Blue

This also threw me off again when connecting from the telco to the Adtran so I had to try many different pinout configurations until I got it right. Also, I realize this is beyond the scope of the article but I just wanted to document all of this info to save it in case I ever need it.

Telco to Adtran T1 Pinout (clip facing downwards)
Side A (TA568B)
Pin 1 - White Orange 
Pin 2 - Orange
Pin 4 - Blue
Pin 5 - White Blue

Side B
Pin 1 - Blue
Pin 2 - White Blue
Pin 4 - White Orange
Pin 5 - Orange

Now back to the main subject at hand, how to convert an incoming PRI from a telco and have bi-directional calling between Asterisk and the Adtran. Here is the main configuration to create a SIP trunk from Asterisk to the Adtran.

sip.conf

[adtran]
	type=peer
	host=192.168.1.20
	username=adtran
	secret=YourSecretPassword
	dtmfmode=rfc2833
	context=from-did
	canreinvite=no
	disallow=all
	allow=ulaw
	insecure=port,invite
	qualify=yes
	nat=no
	videosupport=no

Here is how to route calls in Asterisk to/from the Adtran.

extensions.conf

[from-did]
	; To dial outbound 3095551234 (some number) via the PRI
	exten => _NXXNXXXXXX,1,Dial(SIP/adtran/3095551234)
	exten => _NXXNXXXXXX,n,Hangup()

	; To dial an FXS port with a DID of 3095551111 attached
	; This is how you can mimic regular POTS line functionality with a channel from the PRI,
	; but it's basically just calling extension 1000 on the adtran.
	exten => 3095551111,1,Dial(SIP/adtran/1000)
	exten => 3095551111,n,Hangup()

	; To route an inbound DID 3095552222 from the adtran to SIP extension 1234
	exten => 3095552222,1,Dial(SIP/1234)
	exten => 3095552222,n,Hangup()

Here is the configuration for the Adtran for: a two way PRI from a telco with DIDs, how to route an incoming DID to an FXS port, how to route an incoming DID to the remote Asterisk server, a two way SIP trunk to Asterisk, and for routing SIP calls from Asterisk out the PRI.

Building configuration...
!
!
! ADTRAN, Inc. OS version R11.7.0.E
! Boot ROM version 14.04.00
! Platform: Total Access 924 (2nd Gen), part number 4212924L1
! Serial number 1111111111
!
!
hostname "TA924"
enable password YourPassword
!
clock timezone -6-Central-Time
!
ip subnet-zero
ip classless
ip default-gateway 192.168.1.1
ip routing
!
!
domain-name "paperstreetonline.com"
name-server 8.8.8.8 8.8.4.4
!
!
no auto-config
!
event-history on
no logging forwarding
no logging email
!
no service password-encryption
!
portal-list "admin" console ftp http-admin ssh telnet
!
username "admin" password "YourPassword"
!
!
no ip firewall alg msn
no ip firewall alg mszone
no ip firewall alg h323
!
!
!
!
!
no dot11ap access-point-control
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface eth 0/1
  ip address  192.168.1.20  255.255.255.0
  media-gateway ip primary
  no awcp
  no shutdown
!
!
!
!
interface t1 0/1
  shutdown
!
interface t1 0/2
  tdm-group 1 timeslots 1-24 speed 64
  no shutdown
!
!
interface pri 1
  description PRI
  role user
  isdn name-delivery setup
  connect t1 0/2 tdm-group 1
  no shutdown
!
!
interface fxs 0/1
  no shutdown
!
interface fxs 0/2
  no shutdown
!
interface fxs 0/3
  no shutdown
!
interface fxs 0/4
  no shutdown
!
interface fxs 0/5
  no shutdown
!
interface fxs 0/6
  no shutdown
!
interface fxs 0/7
  no shutdown
!
interface fxs 0/8
  no shutdown
!
interface fxs 0/9
  no shutdown
!
interface fxs 0/10
  no shutdown
!
interface fxs 0/11
  no shutdown
!
interface fxs 0/12
  no shutdown
!
interface fxs 0/13
  no shutdown
!
interface fxs 0/14
  no shutdown
!
interface fxs 0/15
  no shutdown
!
interface fxs 0/16
  no shutdown
!
interface fxs 0/17
  no shutdown
!
interface fxs 0/18
  no shutdown
!
interface fxs 0/19
  no shutdown
!
interface fxs 0/20
  no shutdown
!
interface fxs 0/21
  no shutdown
!
interface fxs 0/22
  no shutdown
!
interface fxs 0/23
  no shutdown
!
interface fxs 0/24
  no shutdown
!
!
isdn-group 1
  connect pri 1
!
isdn-number-template 0 prefix "" plan 0 type 0 $
!
!
!
!
!
!
!
ip route 0.0.0.0 0.0.0.0 192.168.1.1
!
no tftp server
no tftp server overwrite
http server
http session-timeout 3600
http secure-server
no snmp agent
no ip ftp server
no ip scp server
no ip sntp server
!
!
!
!
!
!
!
!
sip
sip udp 5060
no sip tcp
!
!
!
voice feature-mode network
voice forward-mode network
!
!
!
!
!
!
!
!
!
!
!
!
voice codec-list CodecList
  default
  codec g711ulaw
!
!
!
voice trunk T01 type sip
  description "Asterisk"
  sip-server primary asterisk.paperstreetonline.com
  registrar primary asterisk.paperstreetonline.com
  trust-domain
  codec-list CodecList both
  authentication username "adtran" password "YourSecretPassword"
!
voice trunk T02 type isdn
  description "Telco PRI"
  resource-selection linear descending
  connect isdn-group 1
  modem-passthrough
  t38
  rtp delay-mode adaptive
  codec-list CodecList
!
!
voice grouped-trunk NETWORK
  description "Forwards traffic out eth0/1, set DIDs you want to pass to Asterisk here."
  trunk T01
  accept 3095552222 cost 1
  accept 3095553333 cost 1
!
!
voice grouped-trunk ISDN
  description "Forwards traffic out pri1, this just routes all calls out the PRI."
  trunk T02
  accept $ cost 0
!
!
voice user 1000
  connect fxs 0/1
  no cos
  password "1234"
  description "Here's how to terminate an inbound DID on an FXS port or mimic a POTS line."
  caller-id-override external-name "John Doe"
  did "3095551111"
  modem-passthrough
  t38
  codec-list CodecList
!
!
!
!
!
!
!
!
!
!
sip authenticate
sip privacy
!
!
!
no sip registrar authenticate
!
!
!
!
!
!
!
!
!
!
sip grammar proxy-require privacy
!
!
!
!
!
!
ip rtp quality-monitoring
ip rtp quality-monitoring udp
ip rtp quality-monitoring sip
!
line con 0
  login local-userlist
  password YourPassword
  line-timeout 60
!
line telnet 0 4
  login local-userlist
  password YourPassword
  line-timeout 60
  no shutdown
line ssh 0 4
  login local-userlist
  line-timeout 60
  no shutdown
!
sntp server 0.pool.ntp.org version 3
!
ntp source ethernet 0/1
!
!
!
end

After looking back at things, I ended up spending quite a long time in the Adtran forums to fix and troublehsoot various little things like caller ID, P-Asserted Identity, etc and had come across one great idea that a user had that I thought I would share. With all the flexibility of this Adtran box, this user was essentially able to use the Adtran as a means to be able to remove the need for having a physical dedicated Asterisk server altogether. It is well known that Asterisk typically has timing related issues when running as a virtual machine, but by removing the need for the server to have T1 cards housed directly in it, he could now run Asterisk as a VM and free up some rackspace, not to mention cut costs on power consumption. Very cool.

Leave a Reply