Integrating Asterisk with Tranditional pbx ie: epabx or leagacy pbx using E1 trunking
This is my personal experience in integrating Asterisk with Coral epabx via E1 trunking.
* components required
* server with asterisk,Dahdi,Libpri installed (howtolink)
* Digium 2 port E1 card TE220P or sangoma cards
* Properly crimped PRI cable Howto
step 1
Once asterisk installed you need to configure the E1 cards to receive and make calls from the service provider
in this guide i used port 1 for the service provider and port2 for the epabx connection.
vi /etc/asterisk/chan_dahdi.conf or dahdi-channels.conf
; Span 1: TE2/0/1 "T2XXP (PCI) Card 0 Span 1"
group=0
context=from-pstn ; context to handle the calls from the PRI line
switchtype = euroisdn
signalling = pri_cpe
channel => 1-15,17-31
context = default
group = 63
; Span 2: TE2/0/2 "T2XXP (PCI) Card 0 Span 2"
group=1
context=from-epabx ; context to receive the calls from the EPABX
switchtype = euroisdn
signalling = pri_net ; very important if you use a EPABX this to be used.
channel => 32-46,48-62
context = default
group = 63
Now save and close the file.
step 2
dialplan to make and receive calls from epabx and PRI
go to extensions.conf and enter the below details
under globals context
[globals]
......
.....
TRUNKPRI=DAHDI/g0 ; a global variable to dialout via PRI line by service provider
TRUNKPBX=DAHDI/g1 ; a global variable to dial the EPABX extensions.
now dialplan to dial out via PRI and epabx extensions.
in my case the epabx needs DID to reach the extension, and my provider sends last three digits of the DID as DID number .
[default] ; context for the asterisk sip extensions to dialout and reach the epabx extensions
; dialplan to dial the outside numbers (mobile or landline , prefix is 9 and number above 6 digits)
exten => _9XXXXXX.,1,Dial(${TRUNKPRI}/${EXTEN:1},,tTo)
exten => _9XXXXXX.,2,Hangup()
; dialplan to dial the epabx extensions - in my case epabx extensions is 3 digits (400 to 499)
exten => _4XX,1,Dial(${TRUNKPBX}/${EXTEN},,TtoR)
exten => _4XX,2,Hangup()
[from-pstn] ; context to receive incomming calls fromt the service provider ie:port1 of E1 card
; dialplan to route the incomming calls from the service provider
; my provider send last 3 digits from my DID ie: my did is 4004400 so he sends 400 , 401 ...
exten => _XXX,1,Dial(SIP/${EXTEN}) ; rings my asteirsk sip extension which matches the 3 Digits.
exten => _XXX,2,Hangup()
; if you want to ring the EPABX extension then use the below dialplan
exten => _XXX,1,Dial(${TRUNKPBX}/${EXTEN},,TtoR)
exten => _XXX,2,Hangup()
step 3
as of now we can make outgoing calls from the asteirsk extension and able to dial the epabx extension from the asteirsk extensions and from the outside numbers (ie incomming call from the provider).
Now we need to write dialplan so that the EPABX extensions can make outgoing calls to landline , mobile numbers as well the Asterisk extensions.
As the Coralpbx is not in hotline , so i need to receive the digits from the EPABX extension as DTMF and dial them as a variable.
[from-epabx] ; inbound cotext to handle the incomming from the epabx as mentioned in dahdi-channels.conf
exten => s,1,Answer()
exten => s,n(start),Read(PHONE,Ringneww,14,,2,3)
exten => s,n,GotoIf($[${LEN(${PHONE})} = 4]?asterisk)
exten => s,n,GotoIf($[${LEN(${PHONE})} < 8]?landline)
exten => s,n,GotoIf($[${LEN(${PHONE})} > 8]?mobile)
exten => s,n(end),Playback(invalid)
exten => s,n(try),Goto(start)
exten => s,n(asterisk),Goto(asterisk,${PHONE},1)
exten => s,n(landline),Goto(landline,${PHONE},1)
exten => s,n(mobile),Goto(mobile,${PHONE},1)
exten => i,1,Playback(invalid)
exten => i,n,Hangup()
exten => t,1,Playback(unavailable)
exten => t,n,Hangup
[asterisk]
exten => _XXXX,1,Dial(SIP/${EXTEN:1}) ; discard first digit as my asterisk is a 3digit extension.
exten => _XXXX,2,Hangup
[landline]
exten => _X.,1,Dial(${TRUNKPRI}/${EXTEN},,tToR)
exten => _X.,2,Hangup
[mobile]
exten => _X.,1,Dial(${TRUNKPRI}/0${EXTEN},,tToR) ; to dial mobile sometimes need zero prefix
exten => _X.,2,Hangup
Also see :
Asterisk installation guide ClickHere
Digium card installation & configuation ClickHere
Sangoma Card installation & configuration ClickHere