This is to expand on what SkyKing noted later. the context=from-pstn is an internal context and would be used if you had a FXO/FXS or E1/T1 card in your Asterisk PBX. The context=from-trunk would be used as in the situation where you are receiving the channel from an external SIP or IAX trunk. The actual PSTN connection is at the router and the call is passed through a SIP trunk to Asterisk
Actually they are identical, or an aliax (sic), direct from /etc/asterisk/extensions.conf
;-------------------------------------------------------------------------------
; from-trunk:
;
; Context is really just an aliax of from-pstn
;
[from-trunk]
include => from-pstn
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
; from-pstn:
;
; Entry context for calls from the outside world to hit FreePBX
[from-pstn]
include => from-pstn-custom ; create this context in extensions_custom.conf to include customizations
include => ext-did
include => ext-did-post-custom
include => from-did-direct
include => ext-did-catchall ; THIS MUST COME AFTER ext-did
;-------------------------------------------------------------------------------
OK there were two problems. The first one was every time I unplugged and replugged the PRI line the first phone call would not send data, and you couldn’t receive a phone call until you successfully made an outgoing call. I notice this because every time I plug the old system back in the first phone call would not connect.
The 2nd problem was the dial-peer.
dial-peer voice 1 pots
incoming called-number .
direct-inward-dial
port 0/1/0:23
forward-digits all
!
dial-peer voice 2 voip
destination-pattern ^794....$
session protocol sipv2
session target ipv4:10.1.10.7:5060
session transport udp
dtmf-relay rtp-nte
codec g711ulaw
!
dial-peer voice 9001 pots
preference 1
destination-pattern [2-9]......
port 0/1/0:23
forward-digits 7
prefix 316
!
The "preference 1" was the bit that got it working. That was in the config for the CUCM.
The only thing missing now it the caller ID. It was showing DOCTYPEHTMLPUBLIC on the phone. Looking at the logs from asterisk it was sending the correct caller ID.
I was able to redo my dial-peers to allow all calls out, and accept all the phone numbers we own.
dial-peer voice 1 pots
incoming called-number .
direct-inward-dial
port 0/1/0:23
forward-digits all
!
dial-peer voice 2 voip
destination-pattern ^[2-9]…$
session protocol sipv2
session target ipv4:10.1.10.7:5060
session transport udp
dtmf-relay rtp-nte
codec g711ulaw
!
dial-peer voice 9001 pots
preference 1
destination-pattern .
port 0/1/0:23
forward-digits all
Now I would like to setup authentication between the 2821 and the asterisk server. I think I know how to do the asterisk side but not sure about the 2821 side.