Connectr Asterisk server With PSTN network

I’m a student from the Lisbon University. I’m doing my final project in VOIP technologies

I want to connect Asterisk with my internal PBX (Alcatel 4400), I have a diva server BRI card installed in an Asterisk server.

At first we made a CAPI trunk to connect the Asterisk server to the PBX with this configuration:

Capi.conf

[general]

nationalprefix=0

internationalprefix=00

rxgain=0.8

txgain=0.8

[interfaces]

msn=19151

incomingmsn=*

controller=1

softdtmf=1

accountcode=

context=demo

;echosquelch=1

;echocancel=yes

;echotail=64

;callgroup=1

deflect=12345678

devices=2

Extensions.conf

[globals]

CONSOLE=Console/dsp ; Console interface for demo

;CONSOLE=Zap/1

;CONSOLE=Phone/phone0

IAXINFO=guest ; IAXtel username/password

;IAXINFO=myuser:mypass

TRUNK=CAPI

TRUNK=Zap/g2 ; Trunk interface

TRUNKMSD=1 ; MSD digits to strip (usually 1 or 0)

;TRUNK=IAX2/user:pass@provider

[from-sip]

exten => _XXXX,1,Dial,CAPI/19151:b${EXTEN}|30|r

exten => _XXXX,1,Dial,CAPI/19151:b${EXTEN}|30|r

exten => _XXXXX,1,Dial,CAPI/19151:b${EXTEN}|30|r

exten => _XXXXXXXXXX,1,Dial,CAPI/19151:b${EXTEN}|30|r

The diva card was acting like a S0 set and we could make calls from Asterisk (SER) to the internal PSTN telephony network.

Now, I also want to be able to make calls from the PBX to Asterisk (to SER).

There is any other way I can do this, with another trunk configuration? I’ve thought in ISDN trunk, but I don’t know how to configure Asterisk.

With the configuration above, we only can make calls form Asterisk to PSTN.

How can I configure Asterisk to be able to make calls from PBX (PSTN) to an range of extensions in the Asterisk(SER)?

Thank you