How to Integrate asterisk with legacy PBX via E1
Topic: Asterisk Integrate with the Legacy PBX via E1 Tunk
Step by step guide to integrate the Asterisk IPPBX with Legacy PBX using E1 trunk. If you are still using old Legacy EPBX or PBX and looking to interconnect with Asterisk to leverage the asterisk features like call recording , conference , Inter office calls through your internet or LAN connectivity then this article is for your.
Asterisk with Coral EPABX
This is my personal experience in integrating Asterisk with Coral epabx via E1 trunking, The major purpose of integration is to record all the calls dialed from EPBX ,also setup a small call center using vicidial using the Phones connected to the EPBX ,that is Analog phones.
Steps 1: Dahdi Configuration
; 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.
Step2 : Asterisk Dialplan To make and receive calls
vi /etc/asterisk/extensions.conf
[globals]
TRUNKPRI=DAHDI/g0
TRUNKPBX=DAHDI/g1
We have grouped the Port 1 of E1 as g0 to connect to Telco and Port 2 as g1 to connect to EPBX, Each group consumes 30 channels each.
Next we need the dialplan to use thes channels groups to dial in an dout.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]
; 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 incoming calls from the Telco
; 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: Dialplan to Receive call from EPBX
Now we need to write one more dialplan to accept call from EPBX and bridge to Telco or Asterisk extensions. Add the below dialplan in the extensions.conf at the last line. Here I used to Separate the calls based on the length and send to asterisk extensions or Landline or mobile number by adding 0 as prefix.
[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)Dialplan to handle Timeout on Digits received from PBX
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
Conclusion:
Hope this article is helpful in interconnecting your legacy EPBX with asterisk IPPBX using E1 or T1 Trunking. For professional support reach me on skype or telegram: striker24x7
Integrating Asterisk with Tranditional pbx ie: epabx or leagacy pbx using E1 trunking