Asterisk – How to Host a PRI Circuit with a Sangoma Card

These are just a few quick notes of mine on how to host a PRI circuit from a Sangoma card in an Asterisk server to another Asterisk server or wherever for that matter.

This config here is for a Sangoma A102 with two ports and Asterisk will provide the clocking source. Channels 1-23 will be the B channels and channel 24 will be the D channel for signaling. Echo cancelling will be enabled as well.
/etc/dahdi/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

#Sangoma A102 port 2 [slot:4 bus:6 span:2] 
span=2,2,0,esf,b8zs
bchan=25-47
echocanceller=mg2,25-47
hardhdlc=48


This is just a basic dahdi config with mostly defaults and our two PRI ports using the from-test context. In order to pass Caller ID properly, make sure to set facilityenable=yes and don’t forget to set the switchtype or pridialplan to whatever they need to be in your scenario.
/etc/asterisk/chan_dahdi.conf

;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-test
group=1
echocancel=yes
signalling=pri_net
channel => 1-23

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

Here are the Sangoma wanpipe config files that are pretty much the defaults. Note that TE_CLOCK=MASTER and that TE_REF_CLOCK=0 essentially states that we are the clock source and that the other Sangoma ports on this card should use us as a reference clock. Also note that we have both hardware echo cancellation and hardware DTMF detection enabled on this particular card.
/etc/wanpipe/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

Here is the second wanpipe config, I just wanted to illustrate the clocking changes that I had mentioned before, TE_CLOCK=NORMAL and TE_REF_CLOCK=0.
/etc/wanpipe/wanpipe2.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]
wanpipe2 = WAN_AFT_TE1, Comment

[interfaces]
w2g1 = wanpipe2, , TDM_VOICE, Comment

[wanpipe2]
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         = 2
TE_CLOCK        = NORMAL
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               = 2
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

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

Extremely simple example of how to route calls to DIDs through the PRI and how to set the Caller ID to mimic what an incoming call might look like to the other end.
/etc/asterisk/extensions.conf

[from-test]
	exten => 3095551234,1,Set(CALLERID(num-pres)=allowed)
	exten => 3095551234,n,Set(CALLERID(name-pres)=allowed)
	exten => 3095551234,n,Set(CALLERID(all)="Joe Blow <3095551236>"
	exten => 3095551234,n,Dial(DAHDI/1/3095551235)
	exten => 3095551234,n,Hangup()

	exten => 3095551235,1,Dial(DAHDI/23/3095551235)
	exten => 3095551235,n,Hangup()

Leave a Reply